API Reference
Session options
|
Define session options. |
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 |
|
Open a geotiff and convert to a Dataset This requires rioxarray to be installed. |
|
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. |
Adding and removing files to a dataset
|
append: Add new file(s) to a dataset. |
|
remove: Remove file(s) from a dataset |
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
|
plot: Automatically plot a dataset. |
Variable modification
|
assign: Create new variables using mathematical operations on existing variables. |
|
rename: Rename variables in a dataset |
|
Change a range or individual value to missing. |
|
Convert missing values to a constant |
|
Set the fill value |
|
sum_all: 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
top: Extract the top/surface level from a dataset |
|
bottom: Extract the bottom level from a dataset |
|
|
vertical_interp: Verticaly interpolate a dataset based on given vertical levels |
|
vertical_mean: Calculate the depth-averaged mean for each variable. |
vertical_min: Calculate the vertical minimum of variable values. |
|
vertical_max: Calculate the vertical maximum of variable values. |
|
vertical_range: Calculate the vertical range of variable values. |
|
vertical_sum: Calculate the vertical sum of variable values. |
|
|
vertical_integration: Calculate the vertically integrated sum over the water column. |
vertical_cumsum: Calculate the vertical sum of variable values. |
|
Invert the levels of 3D variables. |
|
bottom_mask: Create a mask identifying the deepest cell without missing values.. |
Rolling methods
|
rolling_mean: Calculate a rolling mean based on a window |
|
rolling_min: Calculate a rolling minimum based on a window |
|
rolling_max: Calculate a rolling maximum based on a window |
|
rolling_sum: Calculate a rolling sum based on a window |
|
rolling_range: Calculate a rolling range based on a window |
|
rolling_stdev: Calculate a rolling standard deviation based on a window |
|
rolling_var: Calculate a rolling variance based on a window |
Evaluation setting
Run all stored commands in a dataset |
Cleaning functions
Ensemble creation
|
create_ensemble: Generate an ensemble of files from a directory. |
Arithemetic methods
abs: Method to get the absolute value of variables |
|
|
add: Add to a dataset |
|
assign: Create new variables using mathematical operations on existing variables. |
exp: Method to get the exponential of variables |
|
log: Method to get the natural log, ln, of variables |
|
log10: Method to get the base 10 log, log10, of variables |
|
|
multiply: Multiply a dataset. |
|
power: Powers of variables in dataset |
sqrt: Method to get the square root of variables |
|
square: Method to get the square of variables |
|
|
subtract: Subtract from a dataset. |
|
divide: Divide the data. |
Ensemble statistics
|
ensemble_mean: Calculate an ensemble mean |
|
ensemble_min: Calculate an ensemble minimum. |
|
ensemble_max: Calculate an ensemble maximum |
ensemble_percentile: Calculate an ensemble percentile. |
|
ensemble_range: Calculate an ensemble range |
|
ensemble_stdev: Calculate an ensemble standard deviation |
|
ensemble_sum: Calculate an ensemble sum |
|
ensemble_var: Calculate an ensemble variance |
Subsetting operations
|
subset: A method for subsetting datasets to specific variables, years, longitudes etc. |
|
crop: Crop to a rectangular longitude and latitude box |
|
drop: Remove variables, days, months, years or time steps from a dataset |
Time-based methods
|
Set the date in a dataset |
Set the day for each time step in a dataset |
|
|
shift: Shift times in dataset by a number of hours, days, months, or years. |
Interpolation, matching and resampling methods
|
regrid: Regrid a dataset to a target grid |
|
to_latlon: Regrid a dataset to a regular latlon grid |
|
match_points: Match dataset to a spatiotemporal points dataframe |
|
resample_grid: Resample the horizontal grid of a dataset |
|
time_interp: Temporally interpolate variables based on date range and time resolution |
|
timestep_interp: Temporally interpolate a dataset to given number of time steps between existing time steps |
|
fill_na: Fill missing values with a distance-weighted average. |
|
box_mean: Calculate the grid box mean for all variables. |
|
box_max: Calculate the grid box max for all variables. |
|
box_min: Calculate the grid box min for all variables. |
|
box_sum: Calculate the grid box sum for all variables. |
|
box_range: Calculate the grid box range for all variables. |
Masking methods
|
mask_box: Mask a lon/lat box |
Anomaly methods
|
annual_anomaly: Calculate annual anomalies for each variable based on a baseline period. |
|
monthly:anomaly: Calculate monthly anomalies based on a baseline period. |
Statistical methods
|
tmean: Calculate the temporal mean of all variables. |
|
tmin: Calculate the temporal minimum of all variables. |
|
tmedian: Calculate the temporal median of all variables. |
|
tpercentile: Calculate the temporal percentile of all variables Useful for monthly percentile, annual/yearly percentile, seasonal percentile, daily percentile, daily climatology, monthly climatology, seasonal climatology |
|
tmax: Calculate the temporal maximum of all variables. |
|
tsum: Calculate the temporal sum of all variables. |
|
trange: Calculate the temporal range of all variables Useful for: monthly range, annual/yearly range, seasonal range, daily range, daily climatology, monthly climatology, seasonal climatology |
|
tstdev: Calculate the temporal standard deviation of all variables Useful for: monthly standard deviation, annual/yearly standard deviation, seasonal standard deviation, daily standard deviation, daily climatology, monthly climatology, seasonal climatology |
|
tcumsum: Calculate the temporal cumulative sum of all variables |
|
tvar: Calculate the temporal variance of all variables Useful for: monthly variance, annual/yearly variance, seasonal variance, daily variance, daily climatology, monthly climatology, seasonal climatology |
|
cor_space: Calculate the correlation correct between two variables in space. |
|
cor_time: Calculate the correlation correct in time between two variables |
spatial_mean: Calculate the area weighted spatial mean for all variables. |
|
spatial_min: Calculate the spatial minimum for all variables. |
|
spatial_max: Calculate the spatial maximum for all variables. |
|
spatial_percentile: Calculate the spatial percentile for all variables |
|
spatial_range: Calculate the spatial range for all variables. |
|
|
spatial_sum: Calculate the spatial sum for all variables. |
spatial_stdev: Calculate the spatial standard deviation for all variables. |
|
spatial_var: Calculate the spatial variance for all variables. |
|
|
centre: Calculate the latitudinal or longitudinal centre for each year/month combination in files. |
zonal_mean: Calculate the zonal mean for each time step |
|
zonal_min: Calculate the zonal minimum for each time step |
|
zonal_max: Calculate the zonal maximum for each time step |
|
zonal_range: Calculate the zonal range for each time step |
|
|
zonal_sum: Calculate the zonal sum for each time step |
meridonial_mean: Calculate the meridonial mean for each year/month combination in files. |
|
meridonial_min: Calculate the meridonial minimum for each year/month combination in files. |
|
meridonial_max: Calculate the meridonial maximum for each year/month combination in files. |
|
meridonial_range: Calculate the meridonial range for each year/month combination in files. |
Merging methods
|
merge: Merge a multi-file ensemble into a single file |
Splitting methods
|
split: Split the dataset |
Output and formatting methods
|
to_nc: Save a dataset to a named file. |
|
to_xarray: Open a dataset as an xarray object |
|
to_dataframe: Convert a dataset to a pandas data frame |
zip: Zip the dataset |
|
|
format: Change the netCDF format of a dataset. |
Miscellaneous methods
|
na_count: Calculate the number of missing values. |
|
na_frac: Calculate the fraction of missing values in each grid cell across all time steps. |
|
distribute: Split the dataset into multiple evenly sized horizontal and vertical new files |
Collect a dataset that has been split using distribute |
|
|
cell_area: Calculate the area of grid cells. |
|
first_above: Identify the time step when a value is first above a threshold. |
|
first_below: 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. |
|
last_above: 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. |
|
last_below: 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. |
|
cdo_command: 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_dims: Reduce dimensions of data |
|
|
reduce_grid: Reduce the dataset to non-zero locations in a mask |
Set the precision in a dataset |
|
check: Check contents of files for common data problems. |
|
is_corrupt: Check if files are corrupt |
|
A quick hack to change the grid file in North West European shelf Nemo grids. |
|
|
Set the grid type. |
surface_mask: Create a mask identifying the shallowest cell without missing values. |
|
|
strip_variables: 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 |
|
Set a variable/dimension to double This is mostly useful for cases when time is stored as an int, but you need a double |
|
Simple method to fully reset a datset |
Ecological methods
|
phenology: Calculate phenologies from a dataset |