GrADS - Matlab Interface
Keine Lizenz
I introduce here an interface between GrADS and Matlab: the read_grads.m routine reads the GrADS control file and retrieves the variable from the binary file accordingly. As far as possible, the components of the GrADS Data Descriptor File (or control file) were implemented in this routine. The companion routine write_grads.m writes a variable in the Matlab workspace as a binary file, with the appropriate control file. Examples are given hereafter.
Example:
[data,header]=read_grads('filename.ctl',''); % Reads only the header
[data,header]=read_grads('filename.ctl','varname'); % Reads the header and <varname>
[data,header]=read_grads('filename.ctl','varname','z',[z1,z2],'lon',[lon1,lon2],'lat',[lat1,lat2],'t',[t1,t2]);
[data,header]=read_grads('filename.nc','varname'); % Extension of read_grads.m to NetCDF variables
* data is a 4-D variable, with X/lon as the first dimension, Y/lat as second dimension, Z/lev as third dimension and time in fourth dimension.
* header is a structure variable, which contains all relevant information from the GrADS control file. In particular, the header.XDEF and header.YDEF sub-structures contain information for plotting the variable. header.XDEF.num is the number of X fields, and header.XDEF.vec the X coordinates.
Further details can be seen from the dedicated page: http://www.uib.no/People/kst064/REMOiso-toolbox/Matlab_Toolbox.html
Zitieren als
Christophe Sturm (2025). GrADS - Matlab Interface (https://de.mathworks.com/matlabcentral/fileexchange/15326-grads-matlab-interface), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
| Version | Veröffentlicht | Versionshinweise | |
|---|---|---|---|
| 1.0.0.0 |
