Skip to main content

xweights

https://github.com/ludwiglierhammer/xweights/actions/workflows/ci.yml/badge.svg https://codecov.io/gh/ludwiglierhammer/xweights/branch/main/graph/badge.svg https://img.shields.io/pypi/v/xweights.svg Documentation Status pre-commit.ci status

Python “xweights” contains functions to calculate grid weighted area means from predefined regions or from an user-given shapefile. This tool is a wrapper around the python package xESMF.

Features

  • Calculate grid-weighted-means and save the output as CSV file

  • As input you need a dataset dictionary. Values are xarray.Datasets and keys correspondin strings.

Installation

Note: Before building xweights from source, you nedd first install cartopy by using conda:

conda install -c conda-forge cartopy

You can install the package directly with pip:

pip install xweights

If you want to contribute, I recommend cloning the repository and installing the package in development mode, e.g.

git clone https://github.com/ludwiglierhammer/xweights.git
cd xweights
pip install -e .

In additon you have to install xESMF using _Conda:

conda install -c conda-forge xesmf

This will install the package but you can still edit it and you don’t need the package in your PYTHONPATH

Requirements

  • python3.6 or higher

  • numpy

  • pandas

  • geopandas

  • xarray

  • py-cordex

  • xesmf

Contact

In cases of any problems, needs or wishes do not hesitate to contact:

ludwig.lierhammer@hereon.de

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2022-03-04)

  • First release on PyPI.

0.1.1 (2022-07-01)

  • adjusted to pre-commit

  • use functions from pyhomogenize

0.1.2 (2022-07-08)

  • change pyhomogenize version requirements

0.2.0 (2022-07-11)

  • rename spatial_averager

  • keep geometry attributes

0.2.1 (2022-07-11)

  • read and write column name to attributes

0.2.2 (2022-07-12)

  • add data and tables via pip install

0.2.3 (2023-01-26)

  • remove cartopy from requirements.txt

0.2.4 (2023-03-13)

  • using pycordex >= 0.5.1

0.2.5 (2023-08-23)

  • adding new region: counties_merged (merge counties less than 400m2)

0.2.6 (2023-08-30)

  • optionally: wite variable attributes to dataframe

0.3.0 (2023-09-15)

  • added new regions: IPCC WG1 Reference Regions v4 from Atlas

  • xweights/_io.py is no longer available

  • xweights/_domains.py is no longer available

  • function spatial_averager -> spatial_averaging

  • function compute_weighted_means:

    • optionally: set averager_ds to calculate a general xesmf.SpatialAverager

    • parameter shp -> gdf

    • parameter input -> dataset_dict

    • parameter dataset_dict has to be a dictionary

    • parameter outdir -> output

  • function compute_weighted_means_ds: parameters are now similar to compute_weighted_means

  • command-line interface is no longer available

Release files for xweights 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xweights 0.3.0
File Size Uploaded
xweights-0.3.0.tar.gz 10.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for xweights 0.3.0
File Interpreter ABI Platform
xweights-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 MB

Release files / xweights-0.3.0.tar.gz

Download URL xweights-0.3.0.tar.gz
Size 10.0 MB
Tags Source
SHA-256 checksum
How to use checksums
c2a4ce0a022c58a3a7bfaba38eacf49cb999b665d028faa5c91e3c07b3d9c09d
BLAKE2b-256 checksum
How to use checksums
1465c0c37e70364f58107347fdb8052c60512450118eecdcc459ab4a52a11000
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Release files / xweights-0.3.0-py3-none-any.whl

Download URL xweights-0.3.0-py3-none-any.whl
Size 10.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
18c38606e2e77e71c6249caa08cb599e8feb624aa342268371a74a858b3b39ae
BLAKE2b-256 checksum
How to use checksums
ddbe92ff9e5abd27e07b80d83e72c74bde21714536e149e26f33536ca36ed0b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page