Skip to content

Commit 2ce735e

Browse files
committed
Merge remote-tracking branch 'origin/main' into dev_ecosystem
2 parents bf596c7 + a1d5801 commit 2ce735e

File tree

12 files changed

+23
-54
lines changed

12 files changed

+23
-54
lines changed

.github/workflows/build-and-deploy-on-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@master
17-
- name: Set up Python 3.12
17+
- name: Set up Python 3.13
1818
uses: actions/setup-python@v4
1919
with:
20-
python-version: "3.12"
20+
python-version: "3.13"
2121
- name: Install pep517
2222
run: >-
2323
python -m

.github/workflows/run-tests-push.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
runs-on: "ubuntu-latest"
99
strategy:
1010
matrix:
11-
python-version: ["3.12"]
11+
python-version: ["3.13"]
1212
fail-fast: false
1313
name: Linux Python ${{ matrix.python-version }}
1414
steps:
15-
- uses: actions/checkout@v2
16-
- uses: conda-incubator/setup-miniconda@v2
15+
- uses: actions/checkout@v4
16+
- uses: conda-incubator/setup-miniconda@v3
1717
with:
1818
activate-environment: bgcval2
1919
environment-file: environment.yml
@@ -38,6 +38,7 @@ jobs:
3838
bgcval2_make_report --help
3939
download_from_mass --help
4040
- shell: bash -l {0}
41-
run: pytest
41+
run: |
42+
pytest
4243
- shell: bash -l {0}
4344
run: sphinx-build -Ea doc doc/build

.github/workflows/run-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
runs-on: "ubuntu-latest"
1414
strategy:
1515
matrix:
16-
python-version: ["3.9", "3.10", "3.11", "3.12"]
16+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1717
fail-fast: false
1818
name: Linux Python ${{ matrix.python-version }}
1919
steps:
20-
- uses: actions/checkout@v2
21-
- uses: conda-incubator/setup-miniconda@v2
20+
- uses: actions/checkout@v4
21+
- uses: conda-incubator/setup-miniconda@v3
2222
with:
2323
activate-environment: bgcval2
2424
environment-file: environment.yml

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ This work was funded through WP1 of the Terrafirma project.
1919

2020
Current version notes:
2121

22-
- Suported versions of Python: 3.9, 3.10, 3.11, and 3.12
22+
- Suported versions of Python: 3.10, 3.11, 3.12, and 3.13
23+
- Numpy 2+ compatible
2324

2425
Environment and installation
2526
============================
@@ -110,7 +111,7 @@ conda env remove -n ENV_NAME
110111

111112
Executable name | What it does | Command
112113
:--------------:|:------------:|:------------:
113-
`analysis_timeseries` | runs timeseries analysis for single model run. | analysis_timeseries jobID key
114+
`analysis_timeseries` | runs timeseries analysis for single model run. | analysis_timeseries -j jobID -k key
114115
`analysis_p2p` | runs point to point analysis of model against observational dataset. | analysis_p2p jobID YEAR
115116
`bgcval` | runs time series and point to point. | bgcval jobID
116117
`bgcval2_make_report` | makes the single model HTML report. | bgcval2_make_report jobID

bgcval2/_runtime_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def _establish_hostname():
6161
elif gethostname().find('pmpc') > -1:
6262
hostname = "pml"
6363
elif gethostname().find('-az') > -1:
64-
hostname = "local-test-only" # for testing on GA machine
64+
hostname = "local-test-only" # for testing on GA machine (old type)
65+
elif os.environ.get("INPUT_RUN_POST", None):
66+
hostname = "local-test-only" # for testing on GA machine (new type)
6567
# FIXME local testing only
6668
elif gethostname().find('valeriu-PORTEGE-Z30-C') > -1:
6769
hostname = "local-test-only" # for testing on V's laptop

bgcval2/bgcval2_make_report.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,8 +1600,7 @@ def newImageLocation(fn):
16001600
csvFolder = paths.imagedir + '/TimeseriesCompare_CSV/' + analysis_name
16011601

16021602
for catfn in catfiles:
1603-
# print('png:', catfn)
1604-
json_fn = csvFolder+'/'+analysis_name+'_'+os.path.basename(catfn)
1603+
json_fn = ''.join([csvFolder, '/', analysis_name, '_', os.path.basename(catfn)])
16051604
together = json_fn.find('Together')
16061605
json_fn = json_fn[:together] + 'Together.json'
16071606
print('json:', json_fn)

bgcval2/bgcvaltools/generic_map_legend.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def make_figure(region):
144144
paths = paths_setter(paths_dict)
145145
orcaGridfn = paths.orcaGridfn
146146

147-
# ncfn = 'mesh_mask_eORCA1_wrk.nc'
148147
nc = Dataset(orcaGridfn, 'r')
149148
dat = nc.variables['mbathy'][:].squeeze()
150149
lats = nc.variables['nav_lat'][:].squeeze()

bgcval2/functions/standard_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ def maskzeroes(nc, keys):
136136
"""
137137
var0 = find_best_var(nc, keys)
138138
arr = np.ma.array(nc.variables[var0][:]) #, dtype=np.float64)
139-
#return np.ma.masked_where(arr == 0. + arr.mask, arr)
140139
arr = np.ma.masked_where(arr == 0. + arr.mask, arr)
141140
print('maskzeroes:', arr.min(), '->', arr.max(), arr.dtype, arr.mean())
142-
#assert 0
143141
return arr
144142

145143
def sums(nc,keys):

bgcval2/timeseries/timeseriesAnalysis.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,6 @@ def loadModel(self):
312312
], self.metrics)):
313313
lats = DL.load[(r, l, 'lat')]
314314
lons = DL.load[(r, l, 'lon')]
315-
#print(lats, lons, len(lats), len(lons), lats.max(), lons.max())
316-
# assert 0
317315
if l in volumeWeightedLayers:
318316
depths = DL.load[(r, l, 'z')]
319317
weights = np.array([
@@ -328,9 +326,6 @@ def loadModel(self):
328326
weights.append(0)
329327
continue
330328

331-
# if not self.weightsDict.get((la, lo), False):
332-
# print('TimeseriesAnalysis: coords not in weights:', (la, lo))
333-
# assert 0
334329
try:
335330
weights.append(self.weightsDict[(la, lo)])
336331
except:
@@ -475,8 +470,6 @@ def loadModelWeightsDict(self, ):
475470
if tmask.ndim == 2:
476471
area = np.ma.masked_where(tmask == 0, area)
477472
area = area.squeeze()
478-
#print('loadModelWeightsDict: area:', area.shape, area.max())
479-
#assert 0
480473
self.weightsDict = {}
481474
if self.modelcoords['lat'] == self.modelcoords['lon'] == False:
482475
####
@@ -506,8 +499,6 @@ def loadModelWeightsDict(self, ):
506499
if self.debug:
507500
print("timeseriesAnalysis:\t loadModelWeightsDict.",
508501
list(self.weightsDict.keys())[0])
509-
#print('loadModelWeightsDict:', len(self.weightsDict.keys()), self.weightsDict)
510-
#assert 0
511502

512503
def loadModelwcvDict(self, ):
513504
"""

bgcval2/timeseries/timeseriesTools.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,6 @@ def save_json(
286286

287287
filename = bvt.folder(csvFolder) + '_'.join([analysisname, name, region, layer, metric, ts ]) + csvformat
288288

289-
# json_arrD = {job:[float(d) for d in data] for job, data in arrD.items()}
290-
# if region in ['IrmingerSea',]:
291-
# for j in json_arrD:
292-
# print('\n\n',j,name, region, json_arrD[j])
293-
# print('\n\n',j,name, region, arrD[j])
294-
#
295-
# assert 0
296289
jsondata = {
297290
# json can't save numpy.float32, so we convert to list of floats.
298291
'timesD': {job:[float(t) for t in times] for job, times in timesD.items()},
@@ -498,11 +491,7 @@ def createDataArray(self, region, layer):
498491
self.oneDData['arr_lon'],
499492
self.oneDData['arr'],
500493
)
501-
# print('createDataArray: mask:', len(m), sum(m))
502-
# print(self.oneDData['arr_lat'][:3], self.oneDData['arr_lon'][:3])
503494
lat = np.ma.masked_where(m,self.oneDData['arr_lat'])
504-
# print('createDataArray', lat.min(), lat.max())
505-
#assert 0
506495

507496
return np.ma.masked_where(m,self.oneDData['arr']),\
508497
np.ma.masked_where(m,self.oneDData['arr_t']),\
@@ -532,8 +521,6 @@ def createOneDDataArray(self, layer):
532521
lat = self.nc.variables[self.coords['lat']][:]
533522
lon = bvt.makeLonSafeArr(self.nc.variables[self.coords['lon']]
534523
[:]) # makes sure it's between +/-180
535-
# print('createOneDDataArray:', lat, lon)
536-
# assert 0
537524
dims = choose_best_ncvar(self.nc, self.details['vars']).dimensions
538525
dat = self.__getlayerDat__(layer)
539526

@@ -677,17 +664,8 @@ def createOneDDataArray(self, layer):
677664
print("Unknown dimensions order", dims)
678665
assert False
679666

680-
#print('lat:', arr_lat, 'lon:', arr_lon)
681-
print('createOneDDataArray: Arr:', np.array(arr).min(), np.array(arr).max(), len(arr))
682-
683667
arr = np.ma.masked_invalid(np.ma.array(arr))
684-
print('createOneDDataArray: Arr:', np.array(arr).min(), np.array(arr).max(), len(arr))
685-
#mask = np.ma.masked_where((arr > 1E20) + arr.mask, arr).mask
686-
#print('len:', mask, np.sum(mask), len(mask))
687668
mask = arr.mask
688-
#print('len:', mask, np.sum(mask), len(mask))
689-
690-
#assert 0
691669

692670
self.oneDData = {}
693671
self.oneDData['arr_lat'] = np.ma.masked_where(mask,

0 commit comments

Comments
 (0)