nctoolkit 1.2.2__tar.gz → 1.2.4__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.
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/PKG-INFO +1 -1
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/add_etc.py +11 -5
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/fldstat.py +2 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/mergers.py +8 -3
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/mp_adders.py +11 -1
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/mp_matchups.py +2 -1
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/show.py +7 -1
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/tozlev.py +5 -3
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/verticals.py +7 -8
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit.egg-info/SOURCES.txt +1 -0
- nctoolkit-1.2.4/pyproject.toml +5 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/setup.py +1 -1
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/CITATION.cff +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/CODE_OF_CONDUCT.md +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/CONTRIBUTIONS.md +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/LICENSE +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/MANIFEST.in +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/README.md +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/benchmarks/benchmark_nctoolkit_versus_xarray.ipynb +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/cheatsheet/nctoolkit_cheatsheet.pdf +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/cheatsheet/nctoolkit_cheatsheet.pptx +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/checklists/api_checker.ipynb +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/data/geotiff.tif +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/data/pubplot_test.png +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/data/test1.html +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/data/test2.html +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/__init__.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/anomaly.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/api.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/append.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/assign.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/cdo_command.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/cellareas.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/centres.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/checks.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/cleanup.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/clear.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/compare.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/compare_data.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/corr.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/create_ensemble.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/crop.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/deprecated.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/distgrid.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/drop.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/ensembles.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/esoteric.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/experimental.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/fill.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/flatten.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/format.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/generate_grid.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/inttime.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/invert.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/masking.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/matchpoint.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/meridonials.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/mp_matchers.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/nco_command.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/phenology.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/plot.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/reduce.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/reduce_grid.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/regrid.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/remove.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/rename.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/resample.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/rollstat.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/run.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/runners.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/runthis.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/session.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/set.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/setters.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/shape.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/shift.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/split.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/static_plot.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/strip_vars.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/subset.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/sumall.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/temp_file.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/temporal_stat.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/temporals.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/thresholds.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/to_lonlat.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/to_nc.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/toxarray.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/unify.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/utils.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/validator.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/validator_funs.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/zip.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/nctoolkit/zonals.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/requirements.txt +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/setup.cfg +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/testing/test_parallel.py +0 -0
- {nctoolkit-1.2.2 → nctoolkit-1.2.4}/testing/test_scripting.py +0 -0
|
@@ -145,11 +145,17 @@ def operation(self, method="mul", ff=None, var=None):
|
|
|
145
145
|
else:
|
|
146
146
|
ff_times_df = (
|
|
147
147
|
pd.DataFrame({"time": ff_times})
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
)
|
|
149
|
+
ff_times_df["year"] = [x.year for x in ff_times]
|
|
150
|
+
ff_times_df["month"] = [x.month for x in ff_times]
|
|
151
|
+
ff_times_df["day"] = [x.day for x in ff_times]
|
|
152
|
+
# .assign(
|
|
153
|
+
# year=lambda x: x.time.dt.year,
|
|
154
|
+
# month=lambda x: x.time.dt.month,
|
|
155
|
+
# day=lambda x: x.time.dt.day,
|
|
156
|
+
# )
|
|
157
|
+
ff_times_df = (
|
|
158
|
+
ff_times_df
|
|
153
159
|
.drop(columns="time")
|
|
154
160
|
)
|
|
155
161
|
|
|
@@ -216,9 +216,14 @@ def merge(self, join="variables", match=["year", "month", "day"], check=True):
|
|
|
216
216
|
all_df = []
|
|
217
217
|
if len(all_times) > 1:
|
|
218
218
|
for i in range(0, len(all_times)):
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
try:
|
|
220
|
+
month = [v.month for v in all_times[i]]
|
|
221
|
+
year = [v.year for v in all_times[i]]
|
|
222
|
+
day = [v.day for v in all_times[i]]
|
|
223
|
+
except:
|
|
224
|
+
month = [int(str(v).split("T")[0].split("-")[1]) for v in all_times[i]]
|
|
225
|
+
year = [int(str(v).split("T")[0].split("-")[0]) for v in all_times[i]]
|
|
226
|
+
day = [int(str(v).split("T")[0].split("-")[2]) for v in all_times[i]]
|
|
222
227
|
i_data = pd.DataFrame({"year": year, "month": month, "day": day})
|
|
223
228
|
i_data = i_data.loc[:, match]
|
|
224
229
|
all_df.append(i_data)
|
|
@@ -2,7 +2,7 @@ import pandas as pd
|
|
|
2
2
|
from nctoolkit.api import open_data, open_thredds
|
|
3
3
|
from nctoolkit.matchpoint import open_matchpoint
|
|
4
4
|
import nctoolkit.api as api
|
|
5
|
-
|
|
5
|
+
import xarray as xr
|
|
6
6
|
|
|
7
7
|
def match_points(
|
|
8
8
|
ds=None,
|
|
@@ -91,6 +91,10 @@ def add_data(self, x=None, variables=None, depths=None, nan=None, top=False, qui
|
|
|
91
91
|
Set to True to suppress output
|
|
92
92
|
|
|
93
93
|
"""
|
|
94
|
+
self.depths = None
|
|
95
|
+
|
|
96
|
+
invert = False
|
|
97
|
+
|
|
94
98
|
thredds = False
|
|
95
99
|
try:
|
|
96
100
|
if len(x.history) == 0:
|
|
@@ -157,6 +161,7 @@ def add_data(self, x=None, variables=None, depths=None, nan=None, top=False, qui
|
|
|
157
161
|
self.data = open_data(x, checks=False)
|
|
158
162
|
# ds_vars = open_data(self.data[0], checks = False)
|
|
159
163
|
|
|
164
|
+
|
|
160
165
|
if variables is None:
|
|
161
166
|
if quiet is False:
|
|
162
167
|
print("All variables will be used")
|
|
@@ -221,6 +226,11 @@ def add_data(self, x=None, variables=None, depths=None, nan=None, top=False, qui
|
|
|
221
226
|
else:
|
|
222
227
|
self.data = open_data(x, checks=False)
|
|
223
228
|
|
|
229
|
+
# if invert:
|
|
230
|
+
# self.depths.invert_levels()
|
|
231
|
+
# self.data.invert_levels()
|
|
232
|
+
# print("inverted")
|
|
233
|
+
|
|
224
234
|
self.variables = variables
|
|
225
235
|
|
|
226
236
|
if len(kwargs) > 0:
|
|
@@ -302,7 +302,8 @@ def matchup(self, tmean=False, regrid="bil", max_extrap=5, quiet = False):
|
|
|
302
302
|
if self.variables is not None:
|
|
303
303
|
ds.subset(variables=self.variables)
|
|
304
304
|
if self.top:
|
|
305
|
-
ds.
|
|
305
|
+
if len(ds.levels) > 1:
|
|
306
|
+
ds.cdo_command("topvalue")
|
|
306
307
|
|
|
307
308
|
if self.temporal:
|
|
308
309
|
for opt in ["day", "year", "month"]:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import subprocess
|
|
2
2
|
from dateutil.parser import parse
|
|
3
|
+
import xarray as xr
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
def nc_times(ff):
|
|
@@ -31,7 +32,12 @@ def nc_times(ff):
|
|
|
31
32
|
cdo_result = [parse(x) for x in cdo_result]
|
|
32
33
|
return cdo_result
|
|
33
34
|
except:
|
|
34
|
-
|
|
35
|
+
try:
|
|
36
|
+
ds = xr.open_dataset(ff)
|
|
37
|
+
times = list(ds.time.values)
|
|
38
|
+
return times
|
|
39
|
+
except:
|
|
40
|
+
return cdo_result
|
|
35
41
|
|
|
36
42
|
|
|
37
43
|
def nc_format(ff):
|
|
@@ -55,9 +55,11 @@ def to_zlevels(self, levels=None, thickness=None, depths=None, surface=None):
|
|
|
55
55
|
# Set up the thickness
|
|
56
56
|
|
|
57
57
|
ds = self.copy()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
|
|
59
|
+
var_select = list(ds.contents.query("nlevels > 1").variable)
|
|
60
|
+
if len(var_select) > 1:
|
|
61
|
+
ds.subset(variables=ds.contents.query("nlevels > 1").variable)
|
|
62
|
+
ds.run()
|
|
61
63
|
vars = ds.variables
|
|
62
64
|
|
|
63
65
|
sorted = False
|
|
@@ -176,22 +176,21 @@ def vertical_interp(
|
|
|
176
176
|
if surface is None:
|
|
177
177
|
raise ValueError("Please provide surface")
|
|
178
178
|
|
|
179
|
-
if fixed is None:
|
|
180
|
-
if thickness is None:
|
|
181
|
-
raise ValueError("You must provide the fixed arg")
|
|
182
|
-
|
|
183
179
|
if depths is None:
|
|
184
180
|
if fixed is False:
|
|
185
181
|
if thickness is None:
|
|
186
|
-
raise ValueError("Please provide thickness")
|
|
182
|
+
raise ValueError("Please provide thickness or depths")
|
|
183
|
+
|
|
184
|
+
if thickness is not None:
|
|
185
|
+
fixed = False
|
|
186
|
+
|
|
187
|
+
if depths is not None:
|
|
188
|
+
fixed = False
|
|
187
189
|
|
|
188
190
|
if not isinstance(fixed, bool):
|
|
189
191
|
if thickness is None:
|
|
190
192
|
raise TypeError("fixed must be a bool")
|
|
191
193
|
|
|
192
|
-
if thickness is not None:
|
|
193
|
-
fixed = False
|
|
194
|
-
|
|
195
194
|
if isinstance(levels, (int, float)):
|
|
196
195
|
levels = [levels]
|
|
197
196
|
|
|
@@ -46,7 +46,7 @@ extras_require["complete"] = ["geoviews", "rioxarray", "cfchecker", "geocube", "
|
|
|
46
46
|
REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()]
|
|
47
47
|
|
|
48
48
|
setup(name='nctoolkit',
|
|
49
|
-
version='1.2.
|
|
49
|
+
version='1.2.4',
|
|
50
50
|
description=DESCRIPTION,
|
|
51
51
|
description_content_type='text/plain',
|
|
52
52
|
long_description=LONG_DESCRIPTION,
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|