API Reference¶
Reading/copying data¶
|
Read netcdf data as a DataSet object |
|
Read netcdf data from a url as a DataSet object |
|
Read thredds data as a DataSet object |
|
Make a deep copy of an DataSet object |
Merging or analyzing multiple datasets¶
|
Merge datasets |
|
Calculate the temporal correlation coefficient between two datasets This will calculate the temporal correlation coefficient, for each time step, between two datasets. |
|
Calculate the spatial correlation coefficient between two datasets This will calculate the spatial correlation coefficient, for each time step, between two datasets. |
Accessing attributes¶
List variables contained in a dataset |
|
List years contained in a dataset |
|
List months contained in a dataset |
|
List times contained in a dataset |
|
List levels contained in a dataset |
|
The size of an object This will print the number of files, total size, and smallest and largest files in an DataSet object. |
|
The current file or files in the DataSet object |
|
The history of operations on the DataSet |
|
The starting file or files of the DataSet object |
Plotting¶
|
|
|
Open the current dataset’s file in ncview |
Variable modification¶
|
Create new variables using mathematical expressions, and keep original variables |
|
Create new variables using mathematical expressions, and drop original variables |
|
Rename variables in a dataset |
|
Set the missing value for a single number or a range |
|
Calculate the sum of all variables for each time step |
NetCDF file attribute modification¶
|
Set the long names of variables |
|
Set the units for variables |
Vertical/level methods¶
|
Extract the top/surface level from a dataset This extracts the first vertical level from each file in a dataset. |
|
Extract the bottom level from a dataset This extracts the bottom level from each NetCDF file. |
|
Verticaly interpolate a dataset based on given vertical levels This is calculated for each time step and grid cell |
|
Calculate the depth-averaged mean for each variable This is calculated for each time step and grid cell |
|
Calculate the vertical minimum of variable values This is calculated for each time step and grid cell |
|
Calculate the vertical maximum of variable values This is calculated for each time step and grid cell |
|
Calculate the vertical range of variable values This is calculated for each time step and grid cell |
|
Calculate the vertical sum of variable values This is calculated for each time step and grid cell |
|
Calculate the vertical sum of variable values This is calculated for each time step and grid cell |
|
Invert the levels of 3D variables This is calculated for each time step and grid cell |
|
Create a mask identifying the deepest cell without missing values. |
Rolling methods¶
|
Calculate a rolling mean based on a window |
|
Calculate a rolling minimum based on a window |
|
Calculate a rolling maximum based on a window |
|
Calculate a rolling sum based on a window |
|
Calculate a rolling range based on a window |
Evaluation setting¶
|
Run all stored commands in a dataset |
Cleaning functions¶
Ensemble creation¶
|
Generate an ensemble |
Arithemetic methods¶
|
Create new variables using mathematical expressions, and keep original variables |
|
Create new variables using mathematical expressions, and drop original variables |
|
Add to a dataset This will add a constant, another dataset or a NetCDF file to the dataset. :param x: An int, float, single file dataset or netcdf file to add to the dataset. If a dataset or netcdf file is supplied, this must have only one variable, unless var is provided. The grids must be the same. :type x: int, float, DataSet or netcdf file :param var: A variable in the x to use for the operation :type var: str. |
|
Subtract from a dataset This will subtract a constant, another dataset or a NetCDF file from the dataset. :param x: An int, float, single file dataset or netcdf file to subtract from the dataset. If a dataset or netcdf is supplied this must only have one variable, unless var is provided. The grids must be the same. :type x: int, float, DataSet or netcdf file :param var: A variable in the x to use for the operation :type var: str. |
|
Multiply a dataset This will multiply a dataset by a constant, another dataset or a NetCDF file. :param x: An int, float, single file dataset or netcdf file to multiply the dataset by. If multiplying by a dataset or single file there must only be a single variable in it, unless var is supplied. The grids must be the same. :type x: int, float, DataSet or netcdf file :param var: A variable in the x to multiply the dataset by :type var: str. |
|
Divide the data This will divide the dataset by a constant, another dataset or a NetCDF file. :param x: An int, float, single file dataset or netcdf file to divide the dataset by. If a dataset or netcdf file is supplied, this must have only one variable, unless var is provided. The grids must be the same. :type x: int, float, DataSet or netcdf file :param var: A variable in the x to use for the operation :type var: str. |
Ensemble statistics¶
|
Calculate an ensemble mean |
|
Calculate an ensemble min |
|
Calculate an ensemble maximum |
|
Calculate an ensemble percentile This will calculate the percentles for each time step in the files. |
|
Calculate an ensemble range The range is calculated for each time step; for example, if each file in the ensemble has 12 months of data the statistic will be calculated for each month. |
Subsetting operations¶
|
Crop to a rectangular longitude and latitude box |
|
A method for subsetting datasets to specific variables, years, longitudes etc. |
|
Select variables from a dataset |
|
Remove variables This will remove stated variables from files in the dataset. |
|
Select years from a dataset This method will subset the dataset to only contain years within the list given. |
|
Select months from a dataset This method will subset the dataset to only contain months within the list given. |
|
Select season from a dataset |
|
Select timesteps from a dataset |
Time-based methods¶
|
Set the date in a dataset You should only do this if you have to fix/change a dataset with a single, not multiple dates. |
|
Shift times in dataset by a number of hours |
|
Shift times in dataset by a number of days |
|
Shift times in dataset by a number of months |
|
Shift times in dataset by a number of years |
|
Shift method. |
Interpolation and resampling methods¶
|
Regrid a dataset to a target grid |
|
Regrid a dataset to a regular latlon grid |
|
Resample the horizontal grid of a dataset |
|
Temporally interpolate variables based on date range and time resolution |
|
Temporally interpolate a dataset to given number of time steps between existing time steps |
Masking methods¶
|
Mask a lon/lat box |
Summary methods¶
|
Calculate annual anomalies for each variable based on a baseline period The anomaly is derived by first calculating the climatological annual mean for the given baseline period. |
|
Calculate monthly anomalies based on a baseline period The anomaly is derived by first calculating the climatological monthly mean for the given baseline period. |
|
Calculate phenologies from a dataset Each file in an ensemble must only cover a single year, and ideally have all days. |
Statistical methods¶
|
Calculate the temporal mean of all variables |
|
Calculate the temporal minimum of all variables |
|
Calculate the temporal median of all variables |
|
Calculate the temporal percentile of all variables |
|
Calculate the temporal maximum of all variables |
|
Calculate the temporal sum of all variables |
|
Calculate the temporal range of all variables |
|
Calculate the temporal variance of all variables |
|
Calculate the temporal cumulative sum of all variables |
|
Calculate the correlation correct between two variables in space This is calculated for each time step. |
|
Calculate the correlation correct in time between two variables The correlation is calculated for each grid cell, ignoring missing values. |
|
Calculate the area weighted spatial mean for all variables This is performed for each time step. |
|
Calculate the spatial minimum for all variables This is performed for each time step. |
|
Calculate the spatial maximum for all variables This is performed for each time step. |
|
Calculate the spatial sum for all variables This is performed for each time step. |
|
Calculate the spatial range for all variables This is performed for each time step. |
|
Calculate the spatial sum for all variables This is performed for each time step. |
|
Calculate the latitudinal or longitudinal centre for each year/month combination in files. This applies to each file in an ensemble. by : str Set to ‘latitude’ if you want the latitiduinal centre calculated. ‘longitude’ for longitudinal. by_area : bool If the variable is a value/m2 type variable, set to True, otherwise set to False. |
|
Calculate the monthly mean for each year/month combination in files. |
|
Calculate the monthly minimum for each year/month combination in files. |
|
Calculate the monthly maximum for each year/month combination in files. |
|
Calculate the monthly range for each year/month combination in files. |
|
Calculate the daily mean for each variable |
|
Calculate the daily minimum for each variable |
|
Calculate the daily maximum for each variable |
|
Calculate the daily mean for each variable |
|
Calculate the daily range for each variable |
|
Calculate the daily sum for each variable |
Calculate a daily mean climatology |
|
Calculate a daily minimum climatology |
|
Calculate a daily maximum climatology |
|
Calculate a daily mean climatology |
|
Calculate a daily range climatology |
|
Calculate the monthly mean climatologies Defined as the minimum value in each month across all years. |
|
Calculate the monthly minimum climatologies Defined as the minimum value in each month across all years. |
|
Calculate the monthly maximum climatologies Defined as the maximum value in each month across all years. |
|
Calculate the monthly range climatologies Defined as the range of value in each month across all years. |
|
|
Calculate the annual mean for each variable |
|
Calculate the annual minimum for each variable |
|
Calculate the annual maximum for each variable |
|
Calculate the annual sum for each variable |
|
Calculate the annual range for each variable |
|
Calculate the seasonal mean for each year. |
|
Calculate the seasonal minimum for each year. |
|
Calculate the seasonal maximum for each year. |
|
Calculate the seasonal range for each year. |
Calculate a climatological seasonal mean |
|
Calculate a climatological seasonal min This is defined as the minimum value in each season across all years. |
|
Calculate a climatological seasonal max This is defined as the maximum value in each season across all years. |
|
Calculate a climatological seasonal range This is defined as the range of values in each season across all years. |
|
|
Calculate the zonal mean for each year/month combination in files. |
|
Calculate the zonal minimum for each year/month combination in files. |
|
Calculate the zonal maximum for each year/month combination in files. |
|
Calculate the zonal range for each year/month combination in files. |
|
Calculate the meridonial mean for each year/month combination in files. |
|
Calculate the meridonial minimum for each year/month combination in files. |
|
Calculate the meridonial maximum for each year/month combination in files. |
|
Calculate the meridonial range for each year/month combination in files. |
Seasonal methods¶
|
Calculate the seasonal mean for each year. |
|
Calculate the seasonal minimum for each year. |
|
Calculate the seasonal maximum for each year. |
|
Calculate the seasonal range for each year. |
Calculate a climatological seasonal mean |
|
Calculate a climatological seasonal min This is defined as the minimum value in each season across all years. |
|
Calculate a climatological seasonal max This is defined as the maximum value in each season across all years. |
|
Calculate a climatological seasonal range This is defined as the range of values in each season across all years. |
|
|
Select season from a dataset |
Merging methods¶
|
Merge a multi-file ensemble into a single file Merging will occur based on the time steps in the first file. |
|
Time-based merging of a multi-file ensemble into a single file This method is ideal if you have the same data split over multiple files covering different data sets. |
Climatology methods¶
Calculate a daily mean climatology |
|
Calculate a daily minimum climatology |
|
Calculate a daily maximum climatology |
|
Calculate a daily mean climatology |
|
Calculate a daily range climatology |
|
Calculate the monthly mean climatologies Defined as the minimum value in each month across all years. |
|
Calculate the monthly minimum climatologies Defined as the minimum value in each month across all years. |
|
Calculate the monthly maximum climatologies Defined as the maximum value in each month across all years. |
|
Calculate the monthly range climatologies Defined as the range of value in each month across all years. |
Splitting methods¶
|
Split the dataset Each file in the ensemble will be separated into new files based on the splitting argument. |
Output and formatting methods¶
|
Save a dataset to a named file This will only work with single file datasets. |
|
Open a dataset as an xarray object |
|
Open a dataset as a pandas data frame |
|
Zip the dataset This will compress the files within the dataset. |
|
Zip the dataset This will compress the files within the dataset. This works lazily. :param ext: New format. Must be one of “nc”, “nc1”, “nc2”, “nc4” and “nc5” . NetCDF = nc1 NetCDF version 2 (64-bit offset) = nc2/nc NetCDF4 (HDF5) = nc4 NetCDF4-classi = nc4c NetCDF version 5 (64-bit data) = nc5 :type ext: str. |
Miscellaneous methods¶
|
Calculate the area of grid cells. |
|
Apply a cdo command |
|
Apply an nco command |
|
Compare all variables to a constant |
|
Reduce dimensions of data This will remove any dimensions with only one value. |
|
Reduce the dataset to non-zero locations in a mask :param mask: single variable dataset or path to .nc file. The mask must have an identical grid to the dataset. :type mask: str or dataset. |