pyresample.utils.cf module

Load an AreaDefinition object from a netCDF/CF file.

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