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

Added a new subpolar North Atlantic region (SPNA) #127

Merged
merged 13 commits into from
Mar 26, 2024
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
6 changes: 6 additions & 0 deletions bgcval2/bgcvaltools/makeMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ def makeMask(name, newSlice, xt, xz, xy, xx, xd, debug=False):
xy, 60., 80.).mask
return mx

if newSlice in ['SubpolarNorthAtlantic', 'SPNA',]:
# Based on SPNA region here: https://www.nature.com/articles/s43247-021-00120-y#citeas
mx = np.ma.masked_outside(xx, -35., -10.).mask + np.ma.masked_outside(
xy, 40., 65.).mask
return mx

if newSlice == 'AtlanticSOcean':
mx = np.ma.masked_outside(xx, -40., 20.).mask + np.ma.masked_outside(
xy, -50., -75.).mask
Expand Down
2 changes: 2 additions & 0 deletions bgcval2/bgcvaltools/pftnames.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ def makeLongNameDict():
lnd['Remainder'] = "Oligotrophic Gyres"
lnd['ArcticOcean'] = "Arctic Ocean"
lnd['NorthernSubpolarAtlantic'] = "Northern Subpolar Atlantic"
lnd['SPNA'] = "Subpolar North Atlantic"
lnd['SubpolarNorthAtlantic'] = lnd['SPNA']
lnd['NorthernSubpolarPacific'] = "Northern Subpolar Pacific"

lnd['SouthernOcean'] = "Southern Ocean"
Expand Down
3 changes: 3 additions & 0 deletions bgcval2/timeseries/timeseriesAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ def loadModel(self):
self.modeldetails,
regions=self.regions,
layers=self.layers,
metrics= self.metrics,
modeldataD=modeldataD,
meantime=meantime,
)

for l in self.layers:
Expand Down
32 changes: 20 additions & 12 deletions bgcval2/timeseries/timeseriesTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ def __init__(self,
layers=[
'Surface',
],
modeldataD = {},
metrics = ['mean', ],
meantime = 0,
data=''):
self.fn = fn
if type(nc) == type('filename'):
Expand All @@ -276,6 +279,9 @@ def __init__(self,
self.details = details
self.regions = regions
self.layers = layers
self.metrics = metrics
self.modeldataD = modeldataD
self.meantime = meantime
self.name = self.details['name']
if data == '': data = std_extractData(nc, self.details)
self.Fulldata = data
Expand All @@ -294,7 +300,7 @@ def run(self):
depths = {}
lays = self.layers[:]
lays.reverse()

for l in lays:
try:
layer = int(l)
Expand All @@ -317,6 +323,18 @@ def run(self):
continue

for region in self.regions:
loadthisregion = 0
for m in self.metrics:
if self.modeldataD.get((region, l, m), False) and self.meantime in self.modeldataD[(region, l, m)]:
# Data arra already exists and This time point's data already exists
print('Dataloader: No need to load this setting', (region, l, m))
continue
print('Dataloader: We need to re-load this setting', (region, l, m), self.meantime)

# This region does not exist in the processed data, so add it.
loadthisregion +=1
if loadthisregion == 0:
continue
arr, arr_t, arr_z, arr_lat, arr_lon = self.createDataArray(
region, layer)
if len(arr) == 0:
Expand All @@ -336,17 +354,7 @@ def run(self):
print("DataLoader:\tLoaded", self.name, 'in', end=' ')
print('{:<24} layer: {:<8}'.format(region, layer), end=' ')
print('\tdata length:',
len(self.load[(region, layer)]),
end=' ')
print('\tmean:',
self.load[(region, layer)].mean(),
'of',
len(self.load[(region, layer)]),
end=' ')
print('\trange:', [
self.load[(region, layer)].min(),
self.load[(region, layer)].max()
])
len(self.load[(region, layer)]),)

def _makeTimeDict_(self, ):
""" Make a dictionairy linking the time index with the float time.
Expand Down
2 changes: 1 addition & 1 deletion key_files/alkalinity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ model_convert : NoChange
# function: convertmeqm3TOumolkg

layers : Surface #50m #;100m 200m 500m 1000m 2000m
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA

2 changes: 1 addition & 1 deletion key_files/atmospco2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBIDo_1y_*_diad-T.nc
model_vars : ATM_PCO2
model_convert : NoChange
layers : layerless
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA



2 changes: 1 addition & 1 deletion key_files/chlorophyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ model_vars : CHD CHN
model_convert : sum

layers : Surface
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA



2 changes: 1 addition & 1 deletion key_files/dic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ model_convert : NoChange


layers : Surface #50m #;100m 200m 500m 1000m 2000m
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA

2 changes: 1 addition & 1 deletion key_files/dust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ model_vars : AEOLIAN
model_convert:
function: NoChange
layers : layerless
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA
2 changes: 1 addition & 1 deletion key_files/iron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ model_convert :
#data_convert_factor : 1000

layers : Surface #Transect ;CanRusTransect PTransect SOTransect Equator ArcTransect AntTransect ArcTransect AntTransect
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA



Expand Down
4 changes: 1 addition & 3 deletions key_files/mld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ data_convert:
maskname : mask
areafile: $BASEDIR_OBS/IFREMER-MLD/mld_DT02_c1m_reg2.0-annual.nc
#layers : Surface
#regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global OnShelf OffShelf ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthAtlanticOcean SouthAtlanticOcean NorthPacificOcean SouthPacificOcean #;Remainder NorthernSubpolarAtlantic NorthernSubpolarPacific

regions : Global OnShelf OffShelf ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthAtlanticOcean SouthAtlanticOcean NorthPacificOcean SouthPacificOcean SPNA
2 changes: 1 addition & 1 deletion key_files/mpa_mld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ data_convert:
maskname : mask
areafile: $BASEDIR_OBS/IFREMER-MLD/mld_DT02_c1m_reg2.0-annual.nc
#layers : Surface
#regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
#regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA
regions : Global Ascension TristandaCunha Pitcairn Cornwall

2 changes: 1 addition & 1 deletion key_files/nitrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface 50m #;100m 200m 500m 1000m 2000m
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA



2 changes: 1 addition & 1 deletion key_files/oxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ data_convert:
factor : 44.661

layers : Surface 100m 500m
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA

2 changes: 1 addition & 1 deletion key_files/salinity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA
2 changes: 1 addition & 1 deletion key_files/silicate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA



2 changes: 1 addition & 1 deletion key_files/temperature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA SPNA



Expand Down
Loading