PyGHGaq 0.0.1__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.
- pyghgaq-0.0.1/LICENCE +19 -0
- pyghgaq-0.0.1/PKG-INFO +37 -0
- pyghgaq-0.0.1/README.md +20 -0
- pyghgaq-0.0.1/pyproject.toml +24 -0
- pyghgaq-0.0.1/setup.cfg +4 -0
- pyghgaq-0.0.1/src/PyGHGaq/PyGHGaq.py +128 -0
- pyghgaq-0.0.1/src/PyGHGaq/__init__.py +0 -0
- pyghgaq-0.0.1/src/PyGHGaq.egg-info/PKG-INFO +37 -0
- pyghgaq-0.0.1/src/PyGHGaq.egg-info/SOURCES.txt +10 -0
- pyghgaq-0.0.1/src/PyGHGaq.egg-info/dependency_links.txt +1 -0
- pyghgaq-0.0.1/src/PyGHGaq.egg-info/requires.txt +2 -0
- pyghgaq-0.0.1/src/PyGHGaq.egg-info/top_level.txt +1 -0
pyghgaq-0.0.1/LICENCE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
pyghgaq-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyGHGaq
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A package to calculate GHG emissions from aquatic ecosystems
|
|
5
|
+
Author-email: César Ordóñez <cesar.ordonez@unige.ch>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ceordonez/PyGHGaq
|
|
8
|
+
Project-URL: Issues, https://github.com/ceordonez/PyGHGaq/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENCE
|
|
14
|
+
Requires-Dist: pandas>=2.3.3
|
|
15
|
+
Requires-Dist: numpy>=2.3.4
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# PyGHGaq
|
|
19
|
+
|
|
20
|
+
This package contains different methods and properties to estimate GHG ($\text{CH}_4$ and $\text{CO}_2$) emissions and concentrations for aquatic ecosystems
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
pip install pyghgaq
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import pyghgaq
|
|
29
|
+
|
|
30
|
+
cw = np.random(20)
|
|
31
|
+
csat = np.random(20)
|
|
32
|
+
k = np.random(20)
|
|
33
|
+
flux = pyghgaq.atm_diff_flux(cw, csat, k)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## IMPORTANT
|
|
37
|
+
THIS PACKAGE IS STILL IN DEVELOPMENT
|
pyghgaq-0.0.1/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# PyGHGaq
|
|
2
|
+
|
|
3
|
+
This package contains different methods and properties to estimate GHG ($\text{CH}_4$ and $\text{CO}_2$) emissions and concentrations for aquatic ecosystems
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
pip install pyghgaq
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
import pyghgaq
|
|
12
|
+
|
|
13
|
+
cw = np.random(20)
|
|
14
|
+
csat = np.random(20)
|
|
15
|
+
k = np.random(20)
|
|
16
|
+
flux = pyghgaq.atm_diff_flux(cw, csat, k)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## IMPORTANT
|
|
20
|
+
THIS PACKAGE IS STILL IN DEVELOPMENT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "PyGHGaq"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="César Ordóñez", email="cesar.ordonez@unige.ch" },
|
|
10
|
+
]
|
|
11
|
+
description = "A package to calculate GHG emissions from aquatic ecosystems"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = ["LICEN[CS]E*"]
|
|
20
|
+
dependencies = ["pandas>=2.3.3", "numpy>=2.3.4"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/ceordonez/PyGHGaq"
|
|
24
|
+
Issues = "https://github.com/ceordonez/PyGHGaq/issues"
|
pyghgaq-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pandas as pd
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def csat(
|
|
6
|
+
atmpress_hpa: np.ndarray, catm_ppm: np.ndarray, hcp_molm3pa: np.ndarray
|
|
7
|
+
) -> np.ndarray:
|
|
8
|
+
"""
|
|
9
|
+
Return
|
|
10
|
+
-------
|
|
11
|
+
Concentration of saturation in mmolm3
|
|
12
|
+
"""
|
|
13
|
+
return atmpress_hpa * catm_ppm * hcp_molm3pa * 1e-2
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def atm_dif_flux(
|
|
17
|
+
csat_mmolm3: np.ndarray, cw_mmolm3: np.ndarray, k_md: np.ndarray
|
|
18
|
+
) -> np.ndarray:
|
|
19
|
+
"""
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
Diffusive flux to/from the atmosphere in mmolm2d
|
|
23
|
+
"""
|
|
24
|
+
return k_md * (cw_mmolm3 - csat_mmolm3)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def hcp(
|
|
28
|
+
varname: str,
|
|
29
|
+
temp_c: pd.Series,
|
|
30
|
+
sal_psu: pd.Series,
|
|
31
|
+
catm_ppm: pd.Series,
|
|
32
|
+
constant: dict,
|
|
33
|
+
coeff: int = 1,
|
|
34
|
+
) -> pd.Series:
|
|
35
|
+
"""Calculate Henry's Coefficient
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
varname : string
|
|
40
|
+
Could be ch4 or co2
|
|
41
|
+
temp_c : pandas.Series
|
|
42
|
+
Temperature of equilibrium.
|
|
43
|
+
sal_psu : pandas.Series
|
|
44
|
+
Water salinity in PSU
|
|
45
|
+
constant : dict
|
|
46
|
+
Constant data (defined in utils/constant.yml).
|
|
47
|
+
coeff : float
|
|
48
|
+
0 Use Sanders 2015 - Only consider correction by temperature (Use this for freshwaters).
|
|
49
|
+
1 Use Wiss 1974 to estimate Henry's Coefficient for CO2 and Wiesenburg & Guinasso 1979 for CH4, considering Salinity and Temperature coerrections (default).
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
hcp_t : float
|
|
54
|
+
Henry's coefficient for CH4 or CO2 in mmolm-3Pa-1
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
if coeff == 0:
|
|
58
|
+
if varname == "ch4":
|
|
59
|
+
hcp25 = constant["H_CH4_T25"]
|
|
60
|
+
dlnHcpd1_T = constant["dlnH_CH4_d1T"]
|
|
61
|
+
elif varname == "co2":
|
|
62
|
+
hcp25 = constant["H_CO2_T25"]
|
|
63
|
+
dlnHcpd1_T = constant["dlnH_CO2_d1T"]
|
|
64
|
+
hcp_t = hcp25 * np.exp(dlnHcpd1_T * (1 / (temp_c + 273.15) - 1 / 298.15))
|
|
65
|
+
return hcp_t
|
|
66
|
+
|
|
67
|
+
elif coeff == 1:
|
|
68
|
+
hcp_t = hcp_sal(varname, sal_psu, temp_c, catm_ppm)
|
|
69
|
+
return hcp_t
|
|
70
|
+
else:
|
|
71
|
+
## CHANGE TO RAISE AN ERROR
|
|
72
|
+
return None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def hcp_sal(
|
|
76
|
+
var: str, sal_psu: pd.Series, temp_c: pd.Series, catm_ppm: pd.Series
|
|
77
|
+
) -> pd.Series:
|
|
78
|
+
"""Correct Henrys coefficient for CO2 (Weiss 1974) and CH4 (Wiesenburg and Guinasso 1979) considering salnity and temperature corrections.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
----------
|
|
82
|
+
var : string.
|
|
83
|
+
Variable name (ch4, co2).
|
|
84
|
+
sal_psu : pandas.Series or float.
|
|
85
|
+
Salinity in PSU.
|
|
86
|
+
temp_c : pandas.Series or float.
|
|
87
|
+
Water temperature in deg C.
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
hcpsalt_mmolm3Pa : list
|
|
92
|
+
Henry's coefficient estimated considering salinity and temperature corrections [molm-3Pa-1]
|
|
93
|
+
"""
|
|
94
|
+
temp_k = temp_c + 273.15
|
|
95
|
+
fx = catm_ppm * 1e-6
|
|
96
|
+
if var == "co2": # folowing Weiss 1974
|
|
97
|
+
A = [-58.0931, 90.5069, 22.2940]
|
|
98
|
+
B = [0.027766, -0.025888, 0.0050578]
|
|
99
|
+
hcpsalt_molm3Pa = (
|
|
100
|
+
np.exp(
|
|
101
|
+
+A[0]
|
|
102
|
+
+ A[1] * 100 / temp_k
|
|
103
|
+
+ A[2] * np.log(temp_k / 100)
|
|
104
|
+
+ sal_psu * (B[0] + B[1] * temp_k / 100 + B[2] * (temp_k / 100) ** 2)
|
|
105
|
+
)
|
|
106
|
+
* 1000
|
|
107
|
+
/ 101325
|
|
108
|
+
)
|
|
109
|
+
elif var == "ch4": # folowing Wiesenburg and Guinasso 1979
|
|
110
|
+
# A = [-417.5053, 599.8626, 380.3636, -62.0764]
|
|
111
|
+
A = [-415.2807, 596.8104, 379.2599, -62.0757]
|
|
112
|
+
B = [-0.05916, 0.032174, -0.0048198]
|
|
113
|
+
|
|
114
|
+
c_molm3 = (
|
|
115
|
+
np.exp(
|
|
116
|
+
+np.log(fx)
|
|
117
|
+
+ A[0]
|
|
118
|
+
+ A[1] * 100 / temp_k
|
|
119
|
+
+ A[2] * np.log(temp_k / 100)
|
|
120
|
+
+ A[3] * (temp_k / 100)
|
|
121
|
+
+ sal_psu * (B[0] + B[1] * temp_k / 100 + B[2] * (temp_k / 100) ** 2)
|
|
122
|
+
)
|
|
123
|
+
* 1000
|
|
124
|
+
/ 1e9
|
|
125
|
+
)
|
|
126
|
+
hcpsalt_molm3Pa = c_molm3 / (101325 * fx)
|
|
127
|
+
return hcpsalt_molm3Pa
|
|
128
|
+
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyGHGaq
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A package to calculate GHG emissions from aquatic ecosystems
|
|
5
|
+
Author-email: César Ordóñez <cesar.ordonez@unige.ch>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ceordonez/PyGHGaq
|
|
8
|
+
Project-URL: Issues, https://github.com/ceordonez/PyGHGaq/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENCE
|
|
14
|
+
Requires-Dist: pandas>=2.3.3
|
|
15
|
+
Requires-Dist: numpy>=2.3.4
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# PyGHGaq
|
|
19
|
+
|
|
20
|
+
This package contains different methods and properties to estimate GHG ($\text{CH}_4$ and $\text{CO}_2$) emissions and concentrations for aquatic ecosystems
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
pip install pyghgaq
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import pyghgaq
|
|
29
|
+
|
|
30
|
+
cw = np.random(20)
|
|
31
|
+
csat = np.random(20)
|
|
32
|
+
k = np.random(20)
|
|
33
|
+
flux = pyghgaq.atm_diff_flux(cw, csat, k)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## IMPORTANT
|
|
37
|
+
THIS PACKAGE IS STILL IN DEVELOPMENT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENCE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/PyGHGaq/PyGHGaq.py
|
|
5
|
+
src/PyGHGaq/__init__.py
|
|
6
|
+
src/PyGHGaq.egg-info/PKG-INFO
|
|
7
|
+
src/PyGHGaq.egg-info/SOURCES.txt
|
|
8
|
+
src/PyGHGaq.egg-info/dependency_links.txt
|
|
9
|
+
src/PyGHGaq.egg-info/requires.txt
|
|
10
|
+
src/PyGHGaq.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PyGHGaq
|