Skip to content

climate-service-center/xweights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8636f54 · Jan 27, 2025
Jan 27, 2025
Sep 15, 2023
Oct 11, 2023
Sep 15, 2023
Oct 11, 2023
Oct 27, 2023
Mar 4, 2022
Sep 15, 2023
Dec 4, 2023
Jul 1, 2022
Mar 4, 2022
Sep 15, 2023
Oct 27, 2023
Mar 4, 2022
Oct 11, 2023
Mar 4, 2022
Mar 4, 2022
Mar 4, 2022
Oct 27, 2023
Jul 1, 2022
Sep 15, 2023
Mar 4, 2022

Repository files navigation

xweights

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, firstly you need to 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

Credits

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