API Reference¶
Opening/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 |
|
Read geotiff and convert to nctoolkit dataset |
|
Convert an xarray dataset to an nctoolkit dataset This will first save the xarray dataset as a temporary netCDF file. |
|
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 |
|
Detailed list of variables contained in a dataset. |
|
List times contained in a dataset |
|
List years contained in a dataset |
|
List months 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 |
|
List calendars of dataset files |
|
List formats of files contained in a dataset |
Plotting¶
|
Variable modification¶
|
Create new variables Existing columns that are re-assigned will be overwritten. |
|
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 vertically integrated sum over the water column This calculates the sum of the variable multiplied by the cell thickness |
|
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 |
|
Calculate a rolling standard deviation based on a window |
|
Calculate a rolling variance based on a window |
Evaluation setting¶
|
Run all stored commands in a dataset |
Cleaning functions¶
Ensemble creation¶
|
Generate an ensemble |
Arithemetic methods¶
|
Method to get the absolute value of variables |
|
Add to a dataset This will add a constant, another dataset or a netCDF file to the dataset. |
|
Create new variables Existing columns that are re-assigned will be overwritten. |
|
Method to get the exponential of variables |
|
Method to get the natural log of variables |
|
Method to get the base 10 log of variables |
|
Multiply a dataset This will multiply a dataset by a constant, another dataset or a netCDF file. |
|
Powers of variables in dataset |
|
Method to get the square root of variables |
|
Method to get the square of variables |
|
Subtract from a dataset This will subtract a constant, another dataset or a netCDF file from the dataset. |
|
Divide the data This will divide the dataset by a constant, another dataset or a netCDF file. |
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. |
|
Calculate an ensemble standard deviation |
|
Calculate an ensemble sum The sum 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. |
|
Calculate an ensemble variance |
Subsetting operations¶
|
A method for subsetting datasets to specific variables, years, longitudes etc. |
|
Crop to a rectangular longitude and latitude box |
|
Remove variables This will remove stated variables from files in the 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. |
|
Set the year in a dataset |
|
Shift method. |
Interpolation, matching and resampling methods¶
|
Regrid a dataset to a target grid |
|
Regrid a dataset to a regular latlon grid |
|
Match dataset to a spatiotemporal points dataframe |
|
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 |
|
Fill missing values with a distance-weighted average. |
|
Calculate the grid box mean for all variables This is performed for each time step. |
|
Calculate the grid box max for all variables This is performed for each time step. |
|
Calculate the grid box min for all variables This is performed for each time step. |
|
Calculate the grid box sum for all variables This is performed for each time step. |
|
Calculate the grid box range for all variables This is performed for each time step. |
Masking methods¶
|
Mask a lon/lat box |
Anomaly 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. |
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 standard deviation of all variables |
|
Calculate the temporal cumulative sum of all variables |
|
Calculate the temporal variance 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 spatial range 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 latitudinal or longitudinal centre for each year/month combination in files. |
|
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. |
Merging methods¶
|
Merge a multi-file ensemble into a single file 2 methods are available. |
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. |
Miscellaneous methods¶
|
Calculate the number of missing values |
|
Calculate the number of missing values |
|
Split the dataset into multiple evenly sized horizontal and vertical new files |
|
Collect a dataset that has been split using distribute |
|
Calculate the area of grid cells. |
|
Identify the time step when a value is first above a threshold This will do the comparison with either a number, a Dataset or a netCDF file. |
|
Identify the time step when a value is first below a threshold This will do the comparison with either a number, a Dataset or a netCDF file. |
|
Identify the final time step when a value is above a threshold This will do the comparison with either a number, a Dataset or a netCDF file. |
|
Identify the last time step when a value is below a threshold This will do the comparison with either a number, a Dataset or a netCDF file. |
|
Apply a cdo command |
|
Apply an nco command |
|
Compare all variables to a constant |
|
Method to calculate if variable in dataset is greater than that in another file or dataset This currently only works with single file datasets |
|
Method to calculate if variable in dataset is less than that in another file or dataset This currently only works with single file datasets |
|
Reduce dimensions of data This will remove any dimensions with only one value. |
|
Reduce the dataset to non-zero locations in a mask |
|
Set the precision in a dataset |
|
Check contents of files for common data problems. |
|
Check if files are corrupt |
A quick hack to change the grid file in North West European shelf Nemo grids. |
|
|
Set the grid type. |
|
Create a mask identifying the shallowest cell without missing values. |
|
Remove any variables, such as bnds etc., from variables. |
|
Remove leap years. |
|
Set a variable/dimension to double This is mostly useful for cases when time is stored as an int, but you need a double |
Ecological methods¶
|
Calculate phenologies from a dataset Each file in an ensemble must only cover a single year, and ideally have all days. |