gridded.pyugrid.grid_io package

Submodules

gridded.pyugrid.grid_io.utils module

Utilities to help with grid io

NOTE: this isn’t used yet, but should be useful for loading non UGRID-compliant files.

Ideally, we’ll add loading from shape files or what have you in the future

gridded.pyugrid.grid_io.utils.load_from_varnames(filename, names_mapping, attribute_check=None, post_process=None)[source]

Load a UGrid from a netcdf file where the roles are defined by the names of the variables.

Parameters
  • filename – names of the file to load (or OPeNDAP URL).

  • names_mapping – dict that maps the variable names to UGrid components

  • attribute_check=None – list of global attributes that are expected

  • post_process – function to call to do some custom post processing. it should be a callable that takes (Dataset, UGrid)

The names_mapping dict has to contain at least: ‘nodes_lon’, ‘nodes_lat’

Optionally (and mostly required), it can contain: face_face_connectivity’, ‘face_coordinates_lon’, ‘face_coordinates_lat’, and ‘faces’

Module contents

gridded.pyugrid.grid_io.load_from_varnames(filename, names_mapping, attribute_check=None, post_process=None)[source]

Load a UGrid from a netcdf file where the roles are defined by the names of the variables.

Parameters
  • filename – names of the file to load (or OPeNDAP URL).

  • names_mapping – dict that maps the variable names to UGrid components

  • attribute_check=None – list of global attributes that are expected

  • post_process – function to call to do some custom post processing. it should be a callable that takes (Dataset, UGrid)

The names_mapping dict has to contain at least: ‘nodes_lon’, ‘nodes_lat’

Optionally (and mostly required), it can contain: face_face_connectivity’, ‘face_coordinates_lon’, ‘face_coordinates_lat’, and ‘faces’