pyremap.remapper.Remapper

class pyremap.remapper.Remapper(sourceDescriptor, destinationDescriptor, mappingFileName=None)[source]

A class for remapping fields using a given mapping file. The weights and indices from the mapping file can be loaded once and reused multiple times to map several fields between the same source and destination grids.

__init__(sourceDescriptor, destinationDescriptor, mappingFileName=None)[source]

Create the remapper and read weights and indices from the given file for later used in remapping fields.

Parameters:
  • sourceDescriptor (shared.grid.MeshDescriptor) – An object used to write a scrip file and to determine the type of the source mesh or grid.

  • destinationDescriptor (shared.grid.MeshDescriptor) – An object used to write a scrip files and to determine the type of the destination mesh or grid.

  • mappingFileName (str, optional) – The path where the mapping file containing interpolation weights and indices will be written and/or read. If None, no interpolation is performed and data sets are returned unchanged. This is useful if the source and destination grids are determined to be the same (though the Remapper does not attempt to determine if this is the case).

Methods

__init__(sourceDescriptor, destinationDescriptor)

Create the remapper and read weights and indices from the given file for later used in remapping fields.

build_mapping_file([method, additionalArgs, ...])

Given a source file defining either an MPAS mesh or a lat-lon grid and a destination file or set of arrays defining a lat-lon grid, constructs a mapping file used for interpolation between the source and destination grids.

remap(ds[, renormalizationThreshold])

Given a source data set, returns a remapped version of the data set, possibly masked and renormalized.

remap_file(inFileName, outFileName[, ...])

Given a source file defining either an MPAS mesh or a lat-lon grid and a destination file or set of arrays defining a lat-lon grid, constructs a mapping file used for interpolation between the source and destination grids.