nctoolkit.DataSet.multiply

DataSet.multiply(self, x=None, var=None)

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.

Parameters

var (str) – A variable in the x to multiply the dataset by

Examples

If you wanted to multiply variables in a dataset by 10, you would do the following:

>>> data.multiply(10)

To multiply the values in a dataset by the values of variables in dataset data2, you would do the following:

>>> data1.multiply(data2)

Grids in the datasets must match. Multiplication will occur in matching timesteps in data1 and data2. If there is only 1 timestep in data2, then the data from that timestep in data2 will multiply the data in all timesteps in data1.

Multiplying a dataset by the data from another NetCDF file will work in the same way:

>>> data1.multiply("example.nc")