xarray_interface#

ioapps.xarray_interface.dataset(ncfile, varobj_list, unlimitdim=None)[source]#

DESCRIPTION:

This function defines a xarray dataset object and writes the respective variable objects (within the input varobj_list) to the specified netCDF formatted file.

Parameters:
ncfile: str

A Python string specifying the path to the netCDF formatted file to be written.

varobj_list: List

A Python list of variable objects to be written to the netCDF formatted file.

Return type:

None

ioapps.xarray_interface.open(ncfile)[source]#

DESCRIPTION:

This function opens a netCDF file and returns a Python object containing the contents of the respective netCDF file.

Parameters:
ncfile: str

A Python string specifying the path to the netCDF formatted file to be opened.

Returns:
ncfile_obj: Dataset

A Python Dataset object containing the contents of the input netCDF file.

Return type:

Dataset

ioapps.xarray_interface.read(ncfile, ncvarname)[source]#

DESCRIPTION:

This function parses a netCDF file and returns the attributes for the specified netCDF variable.

Parameters:
ncfile: str

A Python string specifying the path to the netCDF formatted file to be opened.

ncvarname: str

A Python string specifying the netCDF variable name.

Returns:
ncvar_obj: Dataset

A Python Dataset object containing the specified netCDF variable attributes.

Return type:

Dataset

ioapps.xarray_interface.varobj(varval, coords, dims, ncvarname)[source]#

DESCRIPTION:

This function defines an xarray Dataset object in accordance with the specified arguments.

Parameters:
varval: numpy.array

A Python numpy.array variable containing the value array for the xarray DataArray object.

coords: Dict

A Python dictionary containing the coordinate dimension key and value pairs for the respective variable.

dims: List

A Python list containing the coordinate dimension names for the respective variable.

ncvarname: str

A Python string specifying the netCDF variable name.

Returns:
var_obj: Dataset

A Python xarray Dataset object.

Return type:

Dataset

ioapps.xarray_interface.write(ncfile, var_obj, var_arr)[source]#

DESCRIPTION:

This function writes an array of values to an existing variable within the specified netCDF file.

Parameters:
ncfile: str

A Python string specifying the path to the netCDF formatted file to be opened.

var_obj: DataArray

A Python xarray DataArray object.

var_arr: numpy.array

A Python numpy.array type variable containing the value array to be written to the existing variable within the netCDF file.

Return type:

None