Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing bugs from pr41 #42

Merged
merged 3 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bgcval2/analysis_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -3996,7 +3996,7 @@ def load_yml_and_run(compare_yml, config_user):
for jobID in jobs:
analysis_timeseries(
jobID=jobID,
analysisSuite=suites[jobID],
suites=suites[jobID],
config_user=config_user
)

Expand Down
100 changes: 42 additions & 58 deletions bgcval2/analysis_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ def analysis_timeseries(
The strictFileCheck switch checks that the data/model netcdf files exist.
It fails if the switch is on and the files no not exist.

analysisSuite chooses a set of fields to look at.
suites chooses a set of fields to look at.

regions selects a list of regions, default is 'all', which is the list supplied by Andy Yool.

:param jobID: the jobID
:param clean: deletes old images if true
:param annual: Flag for monthly or annual model data.
:param strictFileCheck: CStrickt check for model and data files. Asserts if no files are found.
:param analysisSuite: Which data to analyse, ie level1, physics only, debug, etc
:param suites: Which data to analyse, ie level1, physics only, debug, etc
:param regions:

"""
Expand Down Expand Up @@ -1165,14 +1165,7 @@ def caldiafrac(nc, keys):
'units': 'mmol O2/m^3'
}

if analysisSuite.lower() == 'spinup':
av[name]['layers'] = layerList
else:
av[name]['layers'] = [
'Surface',
'500m',
'1000m',
] #layerList
av[name]['layers'] = layerList
av[name]['regions'] = regionList
av[name]['metrics'] = metricList

Expand Down Expand Up @@ -1669,26 +1662,26 @@ def convertmeqm3TOumolkg(nc, keys):
av[name]['datadetails'] = {'name': '', 'units': ''}
av[name]['dataFile'] = ''
av[name]['datasource'] = ''
if analysisSuite.lower() == 'fast':
av[name]['Dimensions'] = 2
av[name]['modeldetails'] = {
'name': name,
'vars': [
'OCN_PH',
],
'convert': ukp.NoChange,
'units': 'pH',
}
else:
av[name]['Dimensions'] = 3
av[name]['modeldetails'] = {
'name': name,
'vars': [
'PH3',
],
'convert': ukp.NoChange,
'units': 'pH',
}
# if analysisSuite.lower() == 'fast':
# av[name]['Dimensions'] = 2
# av[name]['modeldetails'] = {
# 'name': name,
# 'vars': [
# 'OCN_PH',
# ],
# 'convert': ukp.NoChange,
# 'units': 'pH',
# }
# else:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls remove commented out code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section is in the 4000 lines that are scheduled to be deleted over the next few PRs. I'll remove it then!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the more you remove (obv if needs to be removed) the less spaghetti the code becomes so your next PR will be cleaner to solve :)

av[name]['Dimensions'] = 3
av[name]['modeldetails'] = {
'name': name,
'vars': [
'PH3',
],
'convert': ukp.NoChange,
'units': 'pH',
}
#av[name]['datadetails'] = {'name': name, 'vars':['Alk',], 'convert': convertmeqm3TOumolkg,'units':'meq/m^3',}

av[name]['layers'] = [
Expand Down Expand Up @@ -3009,20 +3002,15 @@ def meanLandMask(nc, keys):
'units': 'degrees C'
}

tregions = [
'Global', 'ignoreInlandSeas', 'Equator10', 'AtlanticSOcean',
'SouthernOcean', 'ArcticOcean', 'Remainder',
'NorthernSubpolarAtlantic', 'NorthernSubpolarPacific', 'WeddelSea',
'Cornwall'
]
tregions.extend(PierceRegions)
#tregions = ['Global',]
if analysisSuite.lower() == 'spinup':
av[name]['layers'] = layerList
av[name]['regions'] = regionList
else:
av[name]['layers'] = layerList
av[name]['regions'] = tregions
#tregions = [
# 'Global', 'ignoreInlandSeas', 'Equator10', 'AtlanticSOcean',
# 'SouthernOcean', 'ArcticOcean', 'Remainder',
# 'NorthernSubpolarAtlantic', 'NorthernSubpolarPacific', 'WeddelSea',
# 'Cornwall'
#]
#tregions.extend(PierceRegions)
av[name]['layers'] = layerList
av[name]['regions'] = regionList
av[name]['metrics'] = metricList

#try:
Expand Down Expand Up @@ -3070,18 +3058,14 @@ def meanLandMask(nc, keys):
'units': 'PSU'
}

salregions = [
'Global', 'ignoreInlandSeas', 'Equator10', 'AtlanticSOcean',
'SouthernOcean', 'ArcticOcean', 'Remainder',
'NorthernSubpolarAtlantic', 'NorthernSubpolarPacific', 'WeddelSea'
]
salregions.extend(PierceRegions)
if analysisSuite.lower() in ['spinup', 'salinity']:
av[name]['layers'] = layerList
av[name]['regions'] = regionList
else:
av[name]['layers'] = layerList
av[name]['regions'] = salregions
#salregions = [
# 'Global', 'ignoreInlandSeas', 'Equator10', 'AtlanticSOcean',
# 'SouthernOcean', 'ArcticOcean', 'Remainder',
# 'NorthernSubpolarAtlantic', 'NorthernSubpolarPacific', 'WeddelSea'
#]
#salregions.extend(PierceRegions)
av[name]['layers'] = layerList
av[name]['regions'] = regionList
av[name]['metrics'] = metricList

av[name]['datasource'] = 'WOA'
Expand Down Expand Up @@ -4565,7 +4549,7 @@ def singleTimeSeriesProfile(jobID, key):
if key in FullDepths:
analysis_timeseries(
jobID=jobID,
analysisSuite=[
suites=[
key,
],
)
Expand All @@ -4577,7 +4561,7 @@ def singleTimeSeries(
):
# try:
analysis_timeseries(jobID=jobID,
analysisSuite=[
suites=[
key,
],
strictFileCheck=False) #clean=1)
Expand Down