NCLOAD Load all variables from a NetCDF file and convert trajectories to cells. NCLOAD(FILENAME) loads all variables from the NetCDF file FILENAME and places them into a structure of the same name in the calling workspace. The extension '.nc' in FILENAME is optional. If FILENAME contains a full pathname, only the final portion after the last '/' or '\' is used for the structure name. Note that any hyphens '-' in the filename are replaced with underscores in the structure name, as the former are not allowed in variable names. For example, if FILENAME='/Home/data' contains variables 'num', 'lat', and 'lon', then the result of calling NCLOAD('data') will be a structure 'data' with fields 'data.num', 'data.lat', and 'data.lon'. Then USE can be used to map these variables into the main workspace. NCLOAD(FILENAME,VAR1,VAR2,...,VARN) will only load the variables with the names VAR1, VAR2,...VARN. NCLOAD will convert any variables that are numeric but not doubles to doubles. This is because experience has shown using other data types in code that is expecting doubles can lead to errors in Matlab. __________________________________________________________________ Convert trajectory data In addition, if FILENAME has the global attribute featureType = 'trajectory' then any variables in FILENAME are have 'Dimensions: obs' will be interpreted as concatentated trajectory data, following the NetCDF Climate and Forecast (CF) Metadata Conventions Appendix H.4.3 http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html NCLOAD adopts the convention that a variable named 'ids', having 'Dimensions: obs', provides the id for all other variables. All variables of dimension obs will be converted to cell arrays by first calling COLBREAKS using ids as the first argument, then COL2CELL. Alternatively, all variables with 'Dimensions: obs' will be interpreted as being in the NaN-separated column format used by COL2CELL, which will be called to put then in cell array format. This format is supported to provide for reverse compatibility; it is recommended to use the CF trajectory convention instead. __________________________________________________________________ The following formats also work: ncload filename ncload filename var1 var2 ... varN In this format, the input strings have to be the actual names of the file and variables, as opposed to variables containing those names. This is basically a way to conveniently work with small NetCDF files as if they were mat-files. Typically, NetCDF files load much faster. Usage: ncload(filename); ncload filename ncload(filename,'num','lat','lon'); ncload filename num lat lon __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2019--2020 J.M. Lilly --- type 'help jlab_license' for details