Transform#

Functions that can convert from underlying databases or model outputs into the standardised OpenGHG format. This could include, for example, creating a Flux file for a limited domain based on data from the EDGAR database. In constrast to standardisation functions, this will usually include some amount of transformation such as selection and/or regridding.

Regridding#

openghg.transform.regrid_uniform_cc(data, lat_out, lon_out, lat_in=None, lon_in=None, latlon=None, method='conservative')[source]#

Regrid data between two uniform, cell centered grids. All coordinates (lat_out, lon_out, lat_in, lon_in) should be for the centre of the representative cell and in degrees.

Adapted from code written by @DTHoare

Parameters:
  • data (TypeVar(ArrayLikeMatch, ndarray, DataArray)) – Data to be regridded. Data must have dimensions (lat, lon) if 2D or (time, lat, lon) if 3D.

  • lat_out (Union[ndarray, DataArray]) – 1D array for output latitude grid

  • lon_out (Union[ndarray, DataArray]) – 1D array for output longituide grid

  • lat_in (Union[ndarray, DataArray, None]) – 1D array for input latitude grid. Only used if data is a numpy array and not a DataArray

  • lon_in (Union[ndarray, DataArray, None]) – 1D array for input longitude grid. Only used if data is a numpy array and not a DataArray

  • latlon (Optional[list]) – Names for latitude and longitude coordinates within data. Default = [“lat”, “lon”]

  • method (str) – Method to use for regridding. Mainly use: - “conservative” - “conservative_normed” (ignores NaN values) See xesmf documentation for full list of options.

Returns:

Regridded data using specified method

Return type:

ndarray / DataArray

Emissions#

Transform emissions data