2.2 NETCDF DATA
作者:Catherine Nunkai 上次修改时间: 2014-11-13 12:52
The Network Common Data Format (NetCDF) is an interface to a library of data access routines for storing and retrieving scientific data. NetCDFallows the creation of data ts which are lf-describing and platform-independent. netCDFwas created under contract with the Division of Atmospheric Sciences of the National Scientific Foundation and is available from the Unidata Program Center in Boulder, Colorado.
Ferret expects netCDF files to adhere to the COARDS conventions. Also Ferret treatment of netCDF files is consistent with the CF standard for netCDF files, Ferret does not implement all of that standard.
See the chapter "Converting Data to NetCDF", for a complete description of how to create netCDFdata ts or how to convert existing data ts into NetCDF.
6级多少分算过To output a variable in NetCDF, simply u:
yes? LIST/FORMAT=CDF variable_nameinfluenced
LIST/FORMAT=CDF (alias SAVE) can also be ud with abstract variables:
yes? SAVE/FILE=example.cdf/I=1:100 sin(I/100)
This will create a file named example.cdf.
The current region and data ts determine the variable names in the saved file and the range over which they are saved. Saved data can then be accesd as follows:
大学英语文章yes? USE examplegudrun
(USE is an alias for SET DATA/FORMAT=CDF, e )
To read a netCDF datat that is on a DODS (also known as OPeNDAP) rver, simply specify the DODS address in quotes:
yes? u "aa.gov/cgi-bin/nph-nc/data/"
To check whether a datat exists or a URL is available, the TEST_OPENDAP function returns the flag that the netCDF library nds back on an attempt to open the data.
If a filename is not specified for writing, Ferret will generate one. (See the command SET LIST/FILE in the Commands Reference ction). An example of converting TMAP-formatted data to netCDF goes as follows:
yes? SET DATA coads_climatology
yes? SAVE/L=1 sst,airt,uwnd,vwnd
The commands will save sst, airt, uwnd, and vwnd at the first time step over their entire regions to a netCDF file named by Ferret.
One advantage to using netCDF is that urs on a different system (i.e., VMS instead of Unix) with different software (i.e., with an analysis tool other than Ferret) can share data easily without substantial conversion work. NetCDF files are lf-describing; with a simple command the size, shape and description of all variables, grids and axes can be en.
2.1.1 NetCDF data and strides
Beginning with Ferret version 5.1 , the internal functioning of netCD Freads has been changed when "strides" are involved. Suppo that CDFVAR reprent a variable from a netCDFfile. In version 5.0 and earlier the command PLOT CDFVAR[L=1:1000:10] would have read the entire array of 1000 points from the file; Ferret's internal logic would have subsampled every 10th point from the resulting array in a manner that was consistent for netCDF variables, ASCII variables, ur defined variables, etc. In V5.1 strides applied to netCDF variables are given special treatment -- subsampling is done by the netCDF library. The primary benefit of this is to make network access to remote data ts via DODS more efficient. Beginning with Ferret v5.4, strides can be applied across the "branch point" of a modulo variable without loss of efficiency for the netCDF data t, as long as the stride is an integer fraction of the modulo length times the number of points on the axis. A remote satellite image of size, say, 1000x1000 points x 8 bit depth (8 megabytes) can efficiently be previewed using
sustainable
SHADE DODS_VAR[i=1:1000:10,j=1:1000:10]
If a grid or axis from a netCDF file is ud in the definition of a LET-defined variable (e.g. LET my_X = X[g=sst[D=coads_climatology]]) that variable definition will be invalidated when the data t is canceled (CANCEL DATA coads_climtology, in the preceding example). There is a single exception to this behavior: netCDF files such as climtological_axes.cdf, which define grids or axes that are not actually ud by any variables. The grids and axes will remain defined even after the data t, itlf, has been canceled. They may be deleted with explicit u of CANCEL GRID or CANCEL AXIS.
In Ferret version 6.02 we introduce a method whereby a grid may be redefined with strided axes. This "native stride" syntax means that the stride information needs to be specified only once, and variable names do not need to be changed.
Old syntax:
yes? SET
yes? LET strided_var = var[i=1:1000:10,j=1:1000:10]
我爱英语yes? FILL strided_var ! U the new name strided_var everywhere.
intermediateNew syntax:
yes? SET
yes? SET AXIS/STRIDE=10 `var,RETURN=xaxis`
yes? SET AXIS/STRIDE=10 `var,RETURN=yaxis`
aquarian
yes? FILL var ! The original variable name can be ud
An offt may be specified on the SET AXIS/STRIDE command with SET AXIS/STRIDE=/OFFSET=. The offt value must be less than the stride value, and it refers to the first index to u:
Old syntax
balladyes? SET
yes? LET strided_var = var[i=4:1000:10]
New syntax:
yes? SET
adderyes? SET AXIS/STRIDE=10/OFFSET=4 `var,RETURN=xaxis`
This syntax associates a new strided axis with the original axis. Everywhere that original axis is ud, the new strided behavior will be applied. This means that all variables from all datats that share the same exact axis will appear on the new strided axis. The original axis definition still exists and we can cancel the stride behavior with