Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Valeriu Predoi <[email protected]>
  • Loading branch information
ledm and valeriupredoi authored Dec 13, 2023
1 parent c78c1ea commit d8a8884
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
9 changes: 3 additions & 6 deletions bgcval2/bgcval2_make_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,10 @@ def newImageLocation(fn):
outlevels = {}
for i, fn in enumerate(l2Fields):
for lv in levels:
if fn.find(lv)>-1:
outlevels[lv]= True
if fn.find(lv) > -1:
outlevels[lv] = True
fn = fn.replace(lv, '')
outdict[fn]= True
outdict[fn] = True

l2Fields = [key for key, v in outdict.items()]
slices = [key for key, v in outlevels.items()]
Expand All @@ -1000,7 +1000,6 @@ def newImageLocation(fn):
Descriptions = {}
FileLists = {}
FileOrder = {}
#print(l2Fields, slices)

for key in sorted(l2Fields):
#if key not in ['Alkalinity','Nitrate']: continue
Expand Down Expand Up @@ -1546,8 +1545,6 @@ def newImageLocation(fn):
if found: continue
sectionTitle = 'Physics Key Metrics'
if fn.find(key) > -1:
# if key in ['MA_SST', 'MA_SSS', 'MA_Nitrate',] and fn.find('Global_Surface') < 0:
# continue
try:
categories[sectionTitle].append(fn)
except:
Expand Down
7 changes: 0 additions & 7 deletions bgcval2/functions/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,11 @@ def twentysixnorth025(nc,keys,**kwargs):
continue
if not depths[t, z, la, lo] or np.ma.is_masked(depths[t, z, la, lo]):
continue
# if not alttmask_AMOC26N[la, lo]:
# continue
# if not tmask_AMOC26N[z, la, lo]:
# continue
# if np.ma.is_masked(zv[0, z, la, lo]):
# continue
atlmoc[z, la] = atlmoc[z, la] - e1v[t, 0, la, lo] * thkcello[t, z, la, lo] * vo[t, z, la, lo] / 1.E06

for z in range(thkcello.shape[1] -2, 1, -1): # add from the bottom up
atlmoc[z, :] = atlmoc[z+1, :] + atlmoc[z, :]
print('AMOC:', atlmoc.max())
#assert 0
return atlmoc.max()


Expand Down
3 changes: 1 addition & 2 deletions bgcval2/p2p/matchDataAndModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ def loadMesh(self, modelfile=None):
if not set(ncER.variables.keys()).intersection(set(depthNames)):
print('load mesh: no depth field available in ', modelfile)
self.depthcc = np.array([0])
# assert 0

# self.depthcc = choose_best_ncvar(ncER, depthNames)[:]
self.datescc = var_to_datetime(ncER.variables[self.modelcoords['t']])
Expand Down Expand Up @@ -1135,7 +1134,7 @@ def var_to_datetime(ncvar):
if units in ['months since 0000-01-01 00:00:00', ]:
units = 'months since 2000-01-01 00:00:00'
return num2date(ncvar[:], 'months since 2000-01-01 00:00:00', calendar='360_day')
elif units.find('months since')>-1:
elif units.find('months since') > -1:
return num2date(ncvar[:], units, calendar='360_day')

return num2date(ncvar[:], ncvar.units, calendar=calendar)
Expand Down
8 changes: 3 additions & 5 deletions bgcval2/revert_shelves.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from bgcval2.Paths.paths import paths_setter




def get_paths(
config_user=None
):
Expand Down Expand Up @@ -84,12 +82,12 @@ def remove_data(jobID,

# generate a time key from year/month.
if month:
if isinstance(month, str) and len(month) ==1:
if isinstance(month, str) and len(month) == 1:
month = int(month)
if isinstance(month, int):
month = bvt.mnStr(month)

time_key = year+month
time_key = year + month
else:
time_key = year

Expand Down Expand Up @@ -186,7 +184,7 @@ def get_args():
default=['all',],
nargs='+',
type=str,
help='One or more datasets - default is everything. ',
help='One or more datasets - default is everything (all available keys). ',
required=False)

parser.add_argument('-d',
Expand Down

0 comments on commit d8a8884

Please sign in to comment.