pyresample.utils.cf module

Load an AreaDefinition object from a netCDF/CF file.

pyresample.utils.cf._convert_XY_CF_to_Proj(crs, axis_info)

Convert XY values from CF to PROJ convention. With CF =< 1.9 only affects geostationary projection.

pyresample.utils.cf._get_area_extent_from_cf_axis(x, y)

Compute the area_extent of the AreaDefinition object from the information on the x and y axes.

pyresample.utils.cf._guess_cf_axis_varname(nc_handle, variable, axis, type_of_grid_mapping)

Guess the name of the netCDF variable holding the coordinate axis of a netCDF field.

pyresample.utils.cf._guess_cf_lonlat_varname(nc_handle, variable, lonlat)

Guess the name of the netCDF variable holding the longitude (or latitude) of a netCDF field.

pyresample.utils.cf._is_valid_coordinate_standardname(coord_standard_name, axis, type_of_grid_mapping)

Check that a CF coordinate variable has the expected CF standard_name with regard to the typw of grid mapping.

pyresample.utils.cf._is_valid_coordinate_variable(nc_handle, coord_varname, axis, type_of_grid_mapping)

Check if a variable is a valid CF coordinate variable.

pyresample.utils.cf._load_cf_area_one_variable(nc_handle, variable, y=None, x=None)

Load the AreaDefinition corresponding to one netCDF variable/field.

pyresample.utils.cf._load_cf_area_one_variable_areadef(axis_info, crs, unit, grid_mapping_variable)

Prepare the AreaDefinition object.

pyresample.utils.cf._load_cf_area_one_variable_axis(nc_handle, variable, type_of_grid_mapping, y=None, x=None)

Identidy and load axis x and y.

pyresample.utils.cf._load_cf_area_one_variable_crs(nc_handle, variable)

Load the CRS corresponding to variable.

pyresample.utils.cf._load_cf_area_several_variables(nc_handle)

Load the AreaDefinition corresponding to several netCDF variables/fields.

pyresample.utils.cf._load_cf_axis_info(nc_handle, coord_varname)

Load and compute information for a coordinate axis (e.g. first & last values, spacing, length, etc…).

pyresample.utils.cf._load_crs_from_cf_gridmapping(nc_handle, grid_mapping_varname)

Initialize a CRS object from a CF grid_mapping variable.

pyresample.utils.cf._open_nc_file(nc_file)
Return type:

Dataset

pyresample.utils.cf.load_cf_area(nc_file, variable=None, y=None, x=None)

Load an AreaDefinition object from a netCDF/CF file.

Parameters:
  • nc_file (string or object) – path to a netCDF/CF file, or opened xarray.Dataset object

  • variable (string, optional) – name of the variable to load the AreaDefinition from. If the variable is not a CF grid_mapping container variable, it should be a variable having a :grid_mapping attribute. If variable is None the file will be searched for valid CF area definitions

  • y (string, optional) – name of the variable to use as ‘y’ axis of the CF area definition If y is None an appropriate ‘y’ axis will be deduced from the CF file

  • x (string, optional) – name of the variable to use as ‘x’ axis of the CF area definition If x is None an appropriate ‘x’ axis will be deduced from the CF file

Returns:

are_def, cf_info – cf_info holds info about how the AreaDefinition was defined in the CF file.

Return type:

geometry.AreaDefinition object, dict