gfdlvitals 3.0.9__tar.gz → 3.0.10__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.
- {gfdlvitals-3.0.9/gfdlvitals.egg-info → gfdlvitals-3.0.10}/PKG-INFO +2 -2
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/cubesphere.py +3 -1
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/ice.py +4 -1
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/land_lm4.py +3 -1
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/latlon.py +3 -1
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/tripolar.py +3 -1
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/extensions.py +3 -8
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/extract_ocean_scalar.py +10 -4
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/xrtools.py +6 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/version.py +1 -1
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10/gfdlvitals.egg-info}/PKG-INFO +2 -2
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/LICENSE +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/README.md +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/docs/source/conf.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/__init__.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/__init__.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/averagers/land_lm3.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/cli.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/diags/__init__.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/diags/amoc.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/diags/fms.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/diags/m6toolbox.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/models/CM4.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/models/ESM2.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/models/__init__.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/plot.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/LM3_variable_dictionary.pkl +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/LICENSE.txt +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Black.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Bold.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Italic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Light.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Medium.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Regular.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-Thin.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/LICENSE.txt +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/RobotoCondensed-Bold.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/RobotoCondensed-BoldItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/RobotoCondensed-Italic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/RobotoCondensed-Light.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/RobotoCondensed-LightItalic.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/RobotoCondensed-Regular.ttf +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/historical.db +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/picontrol.db +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/sample.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/__init__.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/average.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/git.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/gmeantools.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/merge.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/util/netcdf.py +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals.egg-info/SOURCES.txt +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals.egg-info/dependency_links.txt +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals.egg-info/not-zip-safe +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals.egg-info/requires.txt +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals.egg-info/top_level.txt +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/scripts/db2nc +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/scripts/gfdlvitals +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/scripts/plotdb +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/setup.cfg +0 -0
- {gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/setup.py +0 -0
|
@@ -62,7 +62,9 @@ def xr_average(fyear, tar, modules):
|
|
|
62
62
|
_masked_area.sum().data,
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
t_bounds = dset.time_bnds
|
|
66
|
+
dt = t_bounds[:,:,1] - t_bounds[:,:,0]
|
|
67
|
+
weights = dt.astype("float") * _masked_area
|
|
66
68
|
_dset_weighted = xrtools.xr_weighted_avg(dset, weights)
|
|
67
69
|
xrtools.xr_to_db(
|
|
68
70
|
_dset_weighted, fyear, f"{fyear}.{region}Ave{modules[member]}.db"
|
|
@@ -136,7 +136,10 @@ def xr_average(fyear, tar, modules):
|
|
|
136
136
|
newvars = {x: x + "_min" for x in list(_dset_min.variables)}
|
|
137
137
|
_dset_min = _dset_min.rename(newvars)
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
t_bounds = dset.time_bnds
|
|
140
|
+
dt = t_bounds[:,:,1] - t_bounds[:,:,0]
|
|
141
|
+
weights = dt.astype("float")
|
|
142
|
+
|
|
140
143
|
_dset_weighted = xrtools.xr_weighted_avg(_dset, weights)
|
|
141
144
|
newvars = {x: x + "_mean" for x in list(_dset_weighted.variables)}
|
|
142
145
|
_dset_weighted = _dset_weighted.rename(newvars)
|
|
@@ -111,7 +111,9 @@ def xr_average(fyear, tar, modules):
|
|
|
111
111
|
|
|
112
112
|
# _masked_area = _masked_area.fillna(0)
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
t_bounds = dset.time_bnds
|
|
115
|
+
dt = t_bounds[:,:,1] - t_bounds[:,:,0]
|
|
116
|
+
weights = dt.astype("float") * _masked_area
|
|
115
117
|
if _measure == "soil_area":
|
|
116
118
|
area_x_depth = _masked_area * depth
|
|
117
119
|
gmeantools.write_sqlite_data(
|
|
@@ -57,7 +57,9 @@ def xr_average(fyear, tar, modules):
|
|
|
57
57
|
_masked_area.sum().data,
|
|
58
58
|
)
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
t_bounds = dset.time_bnds
|
|
61
|
+
dt = t_bounds[:,:,1] - t_bounds[:,:,0]
|
|
62
|
+
weights = dt.astype("float") * _masked_area
|
|
61
63
|
_dset_weighted = xrtools.xr_weighted_avg(dset, weights)
|
|
62
64
|
xrtools.xr_to_db(
|
|
63
65
|
_dset_weighted, fyear, f"{fyear}.{region}Ave{modules[member]}.db"
|
|
@@ -62,7 +62,9 @@ def xr_average(fyear, tar, modules):
|
|
|
62
62
|
_masked_area.sum().data,
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
t_bounds = dset.time_bnds
|
|
66
|
+
dt = t_bounds[:,:,1] - t_bounds[:,:,0]
|
|
67
|
+
weights = dt.astype("float") * _masked_area
|
|
66
68
|
_dset_weighted = xrtools.xr_weighted_avg(dset, weights)
|
|
67
69
|
xrtools.xr_to_db(
|
|
68
70
|
_dset_weighted, fyear, f"{fyear}.{region}Ave{modules[member]}.db"
|
|
@@ -617,26 +617,21 @@ def open_db(
|
|
|
617
617
|
for var in variables:
|
|
618
618
|
tsobj = Timeseries(dbfile, var, legacy_land=legacy_land, start=start, end=end)
|
|
619
619
|
if len(tsobj.t) > 0:
|
|
620
|
-
data[var] = tsobj.data
|
|
621
|
-
years = years + list(tsobj.t)
|
|
620
|
+
data[var] = pd.Series(tsobj.data, index=list(tsobj.t))
|
|
622
621
|
attributes[var] = {
|
|
623
622
|
"long_name": tsobj.long_name,
|
|
624
623
|
"units": tsobj.units,
|
|
625
624
|
"cell_measure": tsobj.cell_measure,
|
|
626
625
|
}
|
|
627
626
|
|
|
628
|
-
years = sorted(list(set(years)))
|
|
629
|
-
years = [x + float(yearshift) for x in years]
|
|
630
|
-
|
|
631
|
-
variables = list(set(variables) - set(skipped))
|
|
632
|
-
|
|
633
627
|
if start is None:
|
|
634
628
|
start = -1 * math.inf
|
|
635
629
|
|
|
636
630
|
if end is None:
|
|
637
631
|
end = math.inf
|
|
638
632
|
|
|
639
|
-
df = pd.DataFrame(data
|
|
633
|
+
df = pd.DataFrame(data)
|
|
634
|
+
df.index = df.index + float(yearshift)
|
|
640
635
|
df = df[(df.index >= start) & (df.index <= end)]
|
|
641
636
|
df.index = cftime.num2date(
|
|
642
637
|
(df.index * 365.0) - (365.0 / 2.0) - 1,
|
|
@@ -19,18 +19,21 @@ def mom6(fdata, fyear, outdir, outname="globalAveOcean.db"):
|
|
|
19
19
|
Path to output directory
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
ignore_list = ["time_bounds", "time_bnds", "average_T2", "average_T1", "average_DT"]
|
|
22
|
+
ignore_list = ["time_bounds", "time_bnds", "average_T2", "average_T1", "average_DT", "nv"]
|
|
23
23
|
|
|
24
24
|
var_dict = fdata.variables.keys()
|
|
25
25
|
var_dict = list(set(var_dict) - set(ignore_list))
|
|
26
26
|
|
|
27
27
|
for varname in var_dict:
|
|
28
|
-
if len(fdata.variables[varname].shape)
|
|
28
|
+
if len(fdata.variables[varname].shape) <= 2:
|
|
29
29
|
units = gmeantools.extract_metadata(fdata, varname, "units")
|
|
30
30
|
long_name = gmeantools.extract_metadata(fdata, varname, "long_name")
|
|
31
31
|
result = fdata.variables[varname]
|
|
32
32
|
if result.shape[0] == 12:
|
|
33
|
-
result
|
|
33
|
+
if len(result.shape) == 2:
|
|
34
|
+
result = result[:, 0]
|
|
35
|
+
else:
|
|
36
|
+
result = result[:]
|
|
34
37
|
result = np.ma.average(
|
|
35
38
|
result,
|
|
36
39
|
weights=[
|
|
@@ -50,7 +53,10 @@ def mom6(fdata, fyear, outdir, outname="globalAveOcean.db"):
|
|
|
50
53
|
axis=0,
|
|
51
54
|
)
|
|
52
55
|
elif result.shape[0] == 1:
|
|
53
|
-
result
|
|
56
|
+
if len(result.shape) == 2:
|
|
57
|
+
result = result[0, 0]
|
|
58
|
+
else:
|
|
59
|
+
result = result[0]
|
|
54
60
|
sqlfile = f"{outdir}/{fyear}.{outname}"
|
|
55
61
|
gmeantools.write_metadata(sqlfile, varname, "units", units)
|
|
56
62
|
gmeantools.write_metadata(sqlfile, varname, "long_name", long_name)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
""" Tools for working with xarray datasets """
|
|
2
2
|
|
|
3
3
|
import xarray as xr
|
|
4
|
+
import numpy as np
|
|
4
5
|
|
|
5
6
|
from gfdlvitals.util.gmeantools import write_sqlite_data
|
|
6
7
|
from gfdlvitals.util.gmeantools import write_metadata
|
|
@@ -84,8 +85,13 @@ def xr_weighted_avg(dset, weights):
|
|
|
84
85
|
variables = list(dset.variables.keys())
|
|
85
86
|
for x in variables:
|
|
86
87
|
if sorted(dset[x].dims) == sorted(weight.dims):
|
|
88
|
+
if 'timedelta' in str(dset[x].dtype):
|
|
89
|
+
dset[x] = dset[x].astype(np.float32)
|
|
87
90
|
_dset[x] = dset[x]
|
|
88
91
|
|
|
92
|
+
if isinstance(weight, xr.DataArray):
|
|
93
|
+
weight = weight.fillna(0.0)
|
|
94
|
+
|
|
89
95
|
_dset_weighted = _dset.weighted(weight).mean()
|
|
90
96
|
for x in list(_dset_weighted.variables):
|
|
91
97
|
_dset_weighted[x] = _dset_weighted[x].astype(dset[x].dtype)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-BlackItalic.ttf
RENAMED
|
File without changes
|
|
File without changes
|
{gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-BoldItalic.ttf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-LightItalic.ttf
RENAMED
|
File without changes
|
|
File without changes
|
{gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-MediumItalic.ttf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto/Roboto-ThinItalic.ttf
RENAMED
|
File without changes
|
{gfdlvitals-3.0.9 → gfdlvitals-3.0.10}/gfdlvitals/resources/fonts/Roboto_Condensed/LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|