Skip to main content

lat/lon and local-cartesian regridding

Project description

regridcart Regridding lat/lon to local Cartesian coordinates

This package takes care of regridding data defined with latitude/longitude coordinates onto a local Cartesian grid of a fixed resolution. To use it you simply define the domain you want to regrid onto and then call the resample method.

Usage

import regridcart as rc
import xaray as xr

da_src = xr.open_dataarray("...")

target_domain = rc.LocalCartesianDomain(
    central_latitude=lat0,
    central_longitude=lon0,
    l_meridional=1000.0e3,
    l_zonal=3000.0e3,
)

dx = 1.0e3 # new resoluion 1km
da_regridded = rc.resample(target_domain, da=da_src, dx=dx)

The provided data-array is assumed to have latitude/longitude coordinates defined by one of the following:

  1. lat and lon coordinates along which the data is aligned, i.e. lat and lon are given as 1D arrays
  2. lat and lon are given as auxilliary variables so that the data isn't aligned along the lat/lon directions, but rather the lat and lon of every datapoint is given
  3. the data-array has projection information defined in a CF-compliant manner using the grid_mapping attribute (http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch05s06.html)
  4. the data-array was loaded from a raster-file using rioxarray.open_rasterio so that the projection information is available via da.rio.crs

The package also implements cropping (rc.crop_field_to_domain), plotting domain outline (domain.plot_outline) and can also with data already on a Cartesian grid with rc.CartesianDomain. See notebooks/examples.ipynb for detailed examples.

Installation

regridcart can be installed with pip from pypi, but it relies on cartopy and xesmf which in turn rely on proj and emsf, these can most easily be installed with conda:

conda install xarray cartopy xesmf -c conda-forge
pip install regridcart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

regridcart-0.1.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file regridcart-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: regridcart-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for regridcart-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca282ddb4e852cece89729e8e6bbb4d93589fa69e794f039f68c9502c89003da
MD5 b5b6353d07006380b7b4d489f786517e
BLAKE2b-256 9afa007cbb36f3914f86f04146b9022533dc481353f1c966cec100e4bfe9b52d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page