The altimetry.tools.nctools module contains tools dedicated to easily handle NetCDF data.
A class for easy-handling of NetCDF data based on NetCDF4 package.
Example : | To load different sets of data, try these :
|
---|
Get attributes of a NetCDF file
:return {type:dict} outStr: Attribute structure. :author: Renaud Dussurget
number of files loaded
array of file IDs
limits of the domain : [latmin,lonmin,latmax,lonmax] (default = [-90.,0.,90.,360.])
Note
limits are automatically reset using altimetry.tools.recale_limits()
NetCDF data loader
Parameters: |
|
---|
Note
using altimetry.tools.nctools.limit allows subsetting to a given region.
Parameters: | kwargs – additional arguments for subsetting along given dimensions. |
---|
Note
You can index along any dimension by providing the name of the dimensions to subsample along. Values associated to the provided keywords should be a length 2 or 3 tuple (min,max,<step>) (cf. altimetry.data.nctools.load_ncVar()).
Parameters: | output_is_dict – data structures are dictionnaries (eg. my_hydro_data.variable[‘data’]). If false uses an object with attributes (eg. my_hydro_data.variable.data). |
---|
:return {type:dict} outStr: Output data structure containing all recorded parameters as specificied by NetCDF file PARAMETER list.
Author : | Renaud Dussurget |
---|
print function wrapper. Print a message depending on the verbose level
Parameters: | MSG_LEVEL ({in}{required}{type=int}) – level of the message to be compared with self.verbose |
---|---|
Example : | display a message self.log(0,'This message will be shown for any verbose level')
|
Author : | Renaud DUSSURGET (RD), LER PAC/IFREMER |
Change : | Added a case for variables with missing dimensions |
append a variable from a given data structure to the existing dataset.
Parameters: |
|
---|
Read data from a NetCDF file
Parameters: |
|
---|
length of the dataset
this option prevent from trying to detect standard CF dimensions such longitude, latitude, time in the file and keep the original dimensions of the file
Note
Set this option to True when file is not standard (eg. not following CF conventions).
Note
Normal behaviour is to match dimensions (ie. a dimension and the associated variable of the same name) with specific names. Resulting variables associated with these dimensions will be called : * lon (longitudes) : matches dimensions starting with ‘lon’ * lat (latitudes) : matches dimensions starting with ‘lat’ * time (time) : matches dimensions starting with ‘date’ or ‘time’ * depth (date) : matches dimensions starting with ‘dep’ or ‘lev’
verbosity level on a scale of 0 (silent) to 4 (max verbosity)
Write a netCDF file using a data structure.
Parameters: |
|
---|
Note
the data structure requires a “_dimensions” field (dimension structure)
Loads a variable from the NetCDF file and saves it as a data structure.
Parameters: | varName – variable name |
---|---|
Keywords kwargs: | |
additional keyword arguments for slicing the dataset. Keywords should be named the name of the dimensions to subsample along and associated value should be a length 2 or 3 tuple (min,max,<step>). |