nctoolkit.DataSet.add
nctoolkit.DataSet.add#
- DataSet.add(self, x=None, var=None)#
Add to a dataset This will add a constant, another dataset or a netCDF file to the dataset. nctoolkit will automatically determine the appropriate comparison required.
- Parameters
x (int, float, DataSet or netCDF file) – 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.
var (str) –
A variable in the x to use for the operation
Examples
------------ –
you wanted to add 10 to all variables in a dataset (If) –
would do the following (you) –
ds.add(10) (>>>) –
add the values in a dataset ds2 from a dataset ds1 (To) –
would do the following –
ds1.add(ds2) (>>>) –
in the datasets must match. Addition will occur in matching timesteps in ds1 and ds2. If there is only 1 timestep in ds2 (Grids) –
then –
data from that timestep will be added to the data in all ds1 time steps. (the) –
the data from another netCDF file will work in the same way (Adding) –
ds1.add("example.nc") (>>>) –