pyVPRM 3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. pyvprm-3.0/LICENSE +21 -0
  2. pyvprm-3.0/MANIFEST.in +6 -0
  3. pyvprm-3.0/PKG-INFO +40 -0
  4. pyvprm-3.0/README.md +97 -0
  5. pyvprm-3.0/pyVPRM/VPRM.py +1118 -0
  6. pyvprm-3.0/pyVPRM/__init__.py +1 -0
  7. pyvprm-3.0/pyVPRM/lib/__init__.py +0 -0
  8. pyvprm-3.0/pyVPRM/lib/downmodis.py +1012 -0
  9. pyvprm-3.0/pyVPRM/lib/fancy_plot.py +75 -0
  10. pyvprm-3.0/pyVPRM/lib/flux_tower_class.py +444 -0
  11. pyvprm-3.0/pyVPRM/lib/fluxnet_info/fluxnet_sites.pkl +0 -0
  12. pyvprm-3.0/pyVPRM/lib/fluxnet_info/site_infos.txt +218 -0
  13. pyvprm-3.0/pyVPRM/lib/functions.py +471 -0
  14. pyvprm-3.0/pyVPRM/meteorologies/__init__.py +0 -0
  15. pyvprm-3.0/pyVPRM/meteorologies/era5_class_dkrz.py +279 -0
  16. pyvprm-3.0/pyVPRM/meteorologies/era5_class_draft.py +60 -0
  17. pyvprm-3.0/pyVPRM/meteorologies/era5_monthly_xr.py +149 -0
  18. pyvprm-3.0/pyVPRM/meteorologies/met_base_class.py +67 -0
  19. pyvprm-3.0/pyVPRM/meteorologies/met_local_measurement.py +56 -0
  20. pyvprm-3.0/pyVPRM/sat_managers/__init__.py +0 -0
  21. pyvprm-3.0/pyVPRM/sat_managers/base_manager.py +430 -0
  22. pyvprm-3.0/pyVPRM/sat_managers/city.py +21 -0
  23. pyvprm-3.0/pyVPRM/sat_managers/copernicus.py +29 -0
  24. pyvprm-3.0/pyVPRM/sat_managers/esa_world_cover.py +21 -0
  25. pyvprm-3.0/pyVPRM/sat_managers/mapbiomas.py +35 -0
  26. pyvprm-3.0/pyVPRM/sat_managers/modis.py +266 -0
  27. pyvprm-3.0/pyVPRM/sat_managers/proba_v.py +86 -0
  28. pyvprm-3.0/pyVPRM/sat_managers/sentinel2.py +192 -0
  29. pyvprm-3.0/pyVPRM/sat_managers/synmap.py +21 -0
  30. pyvprm-3.0/pyVPRM/sat_managers/viirs.py +232 -0
  31. pyvprm-3.0/pyVPRM/sat_managers/viirs09ga.py +173 -0
  32. pyvprm-3.0/pyVPRM/vprm_configs/__init__.py +0 -0
  33. pyvprm-3.0/pyVPRM/vprm_configs/copernicus_land_cover.yaml +94 -0
  34. pyvprm-3.0/pyVPRM/vprm_configs/esa_world_cover.yaml +71 -0
  35. pyvprm-3.0/pyVPRM/vprm_configs/synmap.yaml +106 -0
  36. pyvprm-3.0/pyVPRM/vprm_models/__init__.py +1 -0
  37. pyvprm-3.0/pyVPRM/vprm_models/model_params/__init__.py +0 -0
  38. pyvprm-3.0/pyVPRM/vprm_models/vprm_base.py +691 -0
  39. pyvprm-3.0/pyVPRM/vprm_models/vprm_base_no_xeric.py +585 -0
  40. pyvprm-3.0/pyVPRM/vprm_models/vprm_modified.py +530 -0
  41. pyvprm-3.0/pyVPRM/vprm_models/vprm_nn.py +130 -0
  42. pyvprm-3.0/pyVPRM.egg-info/PKG-INFO +40 -0
  43. pyvprm-3.0/pyVPRM.egg-info/SOURCES.txt +47 -0
  44. pyvprm-3.0/pyVPRM.egg-info/dependency_links.txt +1 -0
  45. pyvprm-3.0/pyVPRM.egg-info/not-zip-safe +1 -0
  46. pyvprm-3.0/pyVPRM.egg-info/requires.txt +23 -0
  47. pyvprm-3.0/pyVPRM.egg-info/top_level.txt +1 -0
  48. pyvprm-3.0/setup.cfg +4 -0
  49. pyvprm-3.0/setup.py +54 -0
pyvprm-3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Dr. Theo Glauch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pyvprm-3.0/MANIFEST.in ADDED
@@ -0,0 +1,6 @@
1
+ include pyVPRM/vprm_configs/copernicus_land_cover.yaml
2
+ include pyVPRM/vprm_configs/esa_world_cover.yaml
3
+ include pyVPRM/vprm_configs/synmap.yaml
4
+ include pyVPRM/lib/fluxnet_info/fluxnet_sites.pkl
5
+ include pyVPRM/lib/fluxnet_info/site_infos.txt
6
+
pyvprm-3.0/PKG-INFO ADDED
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyVPRM
3
+ Version: 3.0
4
+ Summary: Vegetation Photosynthesis and Respiration Model
5
+ Home-page: https://github.com/tglauch/pyVPRM/
6
+ Author: Theo Glauch
7
+ Author-email: theo.glauch@drl.de
8
+ License: MIT
9
+ Keywords: CO2 Biosphere Atmosphere Physics VPRM
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
15
+ License-File: LICENSE
16
+ Requires-Dist: numpy
17
+ Requires-Dist: scipy
18
+ Requires-Dist: xarray
19
+ Requires-Dist: xesmf
20
+ Requires-Dist: pyproj
21
+ Requires-Dist: joblib
22
+ Requires-Dist: uuid
23
+ Requires-Dist: pandas
24
+ Requires-Dist: astropy
25
+ Requires-Dist: pyyaml
26
+ Requires-Dist: rasterio
27
+ Requires-Dist: rioxarray
28
+ Requires-Dist: geopandas
29
+ Requires-Dist: h5py
30
+ Requires-Dist: pytz
31
+ Requires-Dist: tzwhere
32
+ Requires-Dist: timezonefinder
33
+ Requires-Dist: pygrib
34
+ Requires-Dist: matplotlib
35
+ Requires-Dist: lxml
36
+ Requires-Dist: requests
37
+ Requires-Dist: statsmodels
38
+ Requires-Dist: loguru
39
+
40
+ A tool to calculate the CO2 exchange flux between atmosphere and terrestrial biosphere using the Vegetation Photosynthesis and Respiration Model
pyvprm-3.0/README.md ADDED
@@ -0,0 +1,97 @@
1
+ [![DOI](https://zenodo.org/badge/626435494.svg)](https://doi.org/10.5281/zenodo.14216613)
2
+
3
+
4
+
5
+ <img src="https://github.com/tglauch/pyVPRM/assets/29706254/ba2565e6-1434-4a95-8086-936462f8d05d" width=45% height=50%>
6
+
7
+ # About
8
+
9
+
10
+ `pyVPRM` is a software package to calculate the CO2 exchange flux between atmosphere and terrestrial biosphere using the Vegetation Photosynthesis and Respriation Model (VPRM). It takes into account both, the primary productivity (GPP) as well as the respiration. The net flux between both of them is the net ecosystem exchange (NEE). The implementation is flexible and can be run with different satellite products (Sentinel-2, MODIS, VIIRS,...), land cover products (Copernicus Land Cover Service, ESA 10-m World Cover Map, MapBiomas) and climate models like the ECMWFS ERA5 Reanalysis. Through its modular structure it is also easily extendable.
11
+
12
+ Among others it can be used for
13
+
14
+ 1. Fitting the parameters of a VPRM model against Eddy-Covariance Fluxtower measurements (e.g. FLUXNET or ICOS)
15
+ 2. Making CO2 flux predictions for a given region of interest
16
+ 3. Generating input files to run VPRM in the Weather Research and Forecasting Model (WRF)
17
+
18
+ In case of any questions please write an E-Mail to theo.glauch@dlr.de.
19
+
20
+ ## Example Net Ecosystem Fluxes generated with pyVPRM
21
+
22
+ <figure>
23
+ <img src="https://github.com/user-attachments/assets/def61395-f90e-421b-9264-f0608161bd7a", height=300pt>
24
+ </figure>
25
+
26
+ <figure>
27
+ <img src="https://github.com/user-attachments/assets/48c412b2-cf5f-4573-9db8-e60909893218", height=300pt>
28
+ </figure>
29
+
30
+
31
+ # How to use
32
+
33
+ ## Installation
34
+
35
+ In general we recommmend to set up a new virtual environment for the use of ```pyVPRM```, where you install all the required software. You might also want to consider the best practice about the use of conda and pip here (https://www.anaconda.com/blog/using-pip-in-a-conda-environment).
36
+
37
+ Prerequisites: ```pyVPRM``` requires an installation of the Earth System Modelling Framework (ESMF) and its python interface - ESMFpy - to use all functionalities that include regridding. On many HPCs specialized for Earth System Modelling and Climate Research ESMF is pre-installed. If you need to install it yourself you find instructions on the ESMF Github here: https://github.com/esmf-org. Installation through conda is possible as explained here here https://github.com/conda-forge/esmf-feedstock. It is recommendend to also install NETCDF4 to use all the functionalities of ESMF.
38
+
39
+ ```
40
+ conda config --add channels conda-forge
41
+ conda config --set channel_priority strict
42
+ conda install -c conda-forge dask netCDF4
43
+ conda install esmf
44
+ conda install esmpy
45
+ ```
46
+
47
+ Afterwards install ```pyVPRM``` using pip via
48
+
49
+ ```
50
+ pip install git+https://github.com/tglauch/pyVPRM.git
51
+ ```
52
+
53
+ ## Start your own project
54
+
55
+ In order to start your own project you need to at least follow theses steps:
56
+
57
+ 1. Get the necessary satellite data for your region of interest
58
+ 2. Get the land cover maps for your region of interest
59
+ 3. Create a config file for your project
60
+ 4. Generate your project scripts based on the functions of the vprm class in `VPRM.py`
61
+ 5. Run the calculations
62
+
63
+ Remarks:
64
+ - If there is not yet an interface for your satellite data or land cover map, implement a new subclass in `pyVPRM/sat_managers/`
65
+ - For new land cover maps you need to additionaly provide a mapping of the land cover classes to the VPRM classes in a config file which is stored in `pyVPRM/vprm_configs`
66
+ - Open access to land cover maps: Copernicus: https://lcviewer.vito.be/2019 | ESA World Cover: https://viewer.esa-worldcover.org
67
+ - Open access to satellite data: MODIS,VIIRS: https://e4ftl01.cr.usgs.gov | Sentinel-2: https://scihub.copernicus.eu/
68
+
69
+ ## Examples
70
+
71
+ In order to get started with ```pyVPRM``` there are a number of example scripts with corresponding `README` and comments available in the github respository: https://github.com/tglauch/pyVPRM_examples.git. It contains example scripts for:
72
+
73
+ - Generating WRF inputs under ``./wrf_preprocessor``
74
+ - Generating VPRM fluxes (GPP / NEE): ``./vprm_predictions``
75
+ - Fitting VPRM parameters: ``./fit_vprm_parameters``
76
+ - Downloading MODIS/VIIRS data using ``pyVPRM``: ``./sat_data_download``
77
+
78
+ To download the entire example repository run
79
+ ```
80
+ git clone https://github.com/tglauch/pyVPRM_examples.git
81
+ ```
82
+
83
+ The repositorty comes with pre-prepared input data, so you do not need to care about getting the data first. Check it out!
84
+
85
+ # Modular Structure
86
+
87
+ The pyVPRM implementation has a modular structure to allow for an easy replacement of satellite images and land cover maps, as well as the meteorologies. The file structure is as follows
88
+
89
+
90
+ ```pyVPRM/sat_managers```
91
+
92
+ The ```satellite_data_manager``` class in this library is the basic data structure for all satellite image and land cover maps calcuations in pyVPRM. It provides function to reproject, transform, merge and crop satellite images. All other classes for specific satellite images or land cover maps, with the respective loading routines, are derived from this base class and implemented in the respective class files in the folder.
93
+
94
+
95
+ ```pyVPRM/meteorologies```
96
+
97
+ The classes in this folder provide the interface for the satellite data. This will usually strongly depend on the data availability. You'll likely need to make modifications here or implement your own class. All meteorology classes are derived from the base class in ```met_base_class.py```. An example to implement a new meteorology class can be found in ```era5_class_draft.py```.