(To be written.)
a NetCDF read/write helper by automatically interpreting conventions
open(files, varname)
a GPhys constructor from a NetCDF file (or multiple NetCDF files).
ARGUMENTS
RETURN VALUE
EXAMPLES
From a single file:
file = NetCDF.open('hogehoge.nc') gphys = GPhys::NetCDF_IO(file, 'temp') file = NetCDF.open('hogehoge.nc', 'a') # writable gphys = GPhys::NetCDF_IO(file, 'temp')
From a single file:
gphys = GPhys::NetCDF_IO('hogehoge.nc', 'temp') gphys = GPhys::NetCDF_IO('/data/netcdf/hogehoge.nc', 'temp')
If you use a String to specify a file path, the file is opened as read-only.
To use data separated into multiple files. Suppose that you have hoge_yr2000.nc, hoge_yr2001.nc, and hoge_yr2002.nc in the current directory. You can open it by using a regular expression as follows:
gphys = GPhys::NetCDF_IO(/hoge_yr(\d\d\d\d).nc/, 'temp')
Here, the parentheses to enclose \d\d\d\d is NEEDED.
The same thing can be done as follows by using Array or NArray:
files = ['hoge_yr2000.nc', 'hoge_yr2001.nc', 'hoge_yr2002.nc'] gphys = GPhys::NetCDF_IO(files, 'temp') files = NArray['hoge_yr2000.nc', 'hoge_yr2001.nc', 'hoge_yr2002.nc'] gphys = GPhys::NetCDF_IO(files, 'temp')
Same as above but to use the full path:
gphys = GPhys::NetCDF_IO(/\/data\/nc\/hoge_yr(\d\d\d\d).nc/, 'temp')
Here, the directory separator '/' is escaped as '\/'.
To use data separated into multiple files. Suppose that you have hoge_x0y0.nc, hoge_x1y0.nc, hoge_x0y1.nc, hoge_x1y1.nc, where the data is separated 2 dimensionally into 2*2 = 4 files.
gphys = GPhys::NetCDF_IO(/hoge_x(\d)y(\d).nc/, 'temp')
Note that 2 pairs of parentheses are needed here. Alternatively, you can also do it like this:
files = NArray[ ['hoge_x0y0.nc', 'hoge_x1y0.nc'], ['hoge_x0y1.nc', 'hoge_x1y1.nc'] ] gphys = GPhys::NetCDF_IO(files, 'temp')
write(file, gphys, name=nil)
Write a GPhys into a NetCDF file. The whole data under the GPhys (such as coordinate vars) are written self-descriptively.
ARGUMENTS
RETURN VALUE
set_convention(convention)
Set a NetCDF convention to be interpreted.
ARGUMENTS
RETURN VALUE
convention
Returns the current NetCDF convention to be interpreted.
RETURN VALUE