A module to handle file IO regarding GPhys.
Many of the functionality of this module is implemented in the modules for specific file types such as NumRu::GPhys::NetCDF_IO, to which this module directs operations.
For example, GPhys::IO.open(file, name) simply calls GPhys::*_IO.open(file, name), where '*' is NetCDF, GrADS, or grib.
open(file, varname)
Opens a GPhys in file
having the name varname
.
ARGUMENTS
RETURN VALUE
open_multi(files, varname)
Opens a GPhys by combining a variable across multiple files.
It initializes GPhys objects over the files by calling open and
unites them into a single GPhys object by using GPhys.join
or
GPhys.join_md
.
ARGUMENTS
GPhys.join
is used in this case.when NArray, it must consist of paths or file pointers (that are accepted by open). Each dimension with multiple elements must correspond to a dimension along which joining is made. For example, a 2D tiling can be specified as
files = NArray.to_na([['f00.nc','f10.nc'],['f01.nc','f11.nc']]) gp = GPhys::IO.open_multi( files, "f" )
GPhys.join_md
is used in this case.
When Regexp, similar to when NArray, but expresses the paths. The dimensions to join is specified by "captures" (parentheses). For example, the above 2D tiling can be specified as
files = /f(\d)(\d).nc/ gp = GPhys::IO.open_multi( files, "f" )
The regexp can contain a directory path (e.g., /dir\/sub\/f(\d)(d).nc/),
but the directory part must be unique (i.e., a simple string),
so only a single directly can be specified. All captures must
be in the part representing the file names (in the directory).
GPhys.join_md
is used in this case.
RETURN VALUE
write(file, gphys, name=nil)
Writes a GPhys object in a file
ARGUMENTS
write_grid(file, grid_or_gphys)
each_along_dims_write(gphyses, files, *loopdims){...} # a block is expected
var_names(file)
var_names_except_coordinates(file)
file2type(file)
Figures out the file type supported in this module.
ARGUMENTS
RETURN VALUE
file2specific_module(file)
file2file_class(file)
parse_gturl(gturl)
Parses GTOOL4-type URLs to specify path, variable name, and optionally subsets, whose format is path[@|/]varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
ARGUMENTS
RETURN VALUES
open_gturl(gturl)
a GPhys constructor from a Gtool4-type URL. See parse_gturl for its format.
RETURN VALUE
str2gphys(str)
Open a GPhys from a slash("/")-separated String such as "U.nc/U" and "U.nc".
ARGUMENTS
RETURN VALUE
GTURLfmt