Skip to content

Commit

Permalink
Added new regions and keys to focus in on cornwall and several UKOT MPAs
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Nov 22, 2023
1 parent 4e86a7f commit 017445f
Show file tree
Hide file tree
Showing 15 changed files with 344 additions and 12 deletions.
22 changes: 14 additions & 8 deletions bgcval2/bgcvaltools/makeMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def makeMask(name, newSlice, xt, xz, xy, xx, xd, debug=False):
:param xy: A one-dimensional array of the dataset latitudes.
:param xx: A one-dimensional array of the dataset longitudes.
:param xd: A one-dimensional array of the data.
This function produces a mask to hides all points that are not in the requested region.
Note that xt,xz,xy,xx,xd should all be the same shape and size.
Note that xt,xz,xy,xx,xd should all be the same shape and size.
This functional can call itself, if two regional masks are needed.
Please add your own regions, at the bottom of the list, if needed.
"""
if debug:
Expand Down Expand Up @@ -270,6 +270,12 @@ def makeMask(name, newSlice, xt, xz, xy, xx, xd, debug=False):
mx += np.ma.masked_outside(xy, 49., 52.).mask
return mx

if newSlice == 'Ascension':
mx = np.ma.masked_outside(xx, -17.246, -11.487).mask # longitude
mx += np.ma.masked_outside(xy, -10.813, -5.053).mask # Lattitue
return mx


if newSlice == 'WeddelSea':
mx = np.ma.masked_outside(xx, -60., -20.).mask
mx += np.ma.masked_outside(xy, -80., -64.).mask
Expand Down Expand Up @@ -487,13 +493,13 @@ def makeMask(name, newSlice, xt, xz, xy, xx, xd, debug=False):
print("Corner case:", la, lo, bathy[la, lo])
nmask[i] = 1
if newSlice == "maskBelowBathy":
if (bathy[la, lo] - 10.) > abs(z):
if (bathy[la, lo] - 10.) > abs(z):
nmask[i] = 1
elif newSlice in ["OnShelf", 'AMM_Shelf']:
if bathy[la, lo] >= shelfDepth:
if bathy[la, lo] >= shelfDepth:
nmask[i] = 1
elif newSlice in ["OffShelf", 'AMM_OffShelf']:
if bathy[la, lo] < shelfDepth:
if bathy[la, lo] < shelfDepth:
nmask[i] = 1
if i > 0:
try:
Expand Down
12 changes: 8 additions & 4 deletions bgcval2/bgcvaltools/pftnames.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def makeLongNameDict():
lnd['Chlorophylla'] = 'Chlorophyll'
lnd['Chlorophyll_cci'] = "Chlorophyll (CCI)"
lnd['Chlorophyll_pig'] = "Chlorophyll (Pigments)"
lnd['TotalChlorophyll'] = 'Total Chlorophyll'
lnd['TotalChlorophyll'] = 'Total Chlorophyll'
lnd['CHD'] = "Diatom Chlorophyll"
lnd['CHN'] = "Non-Diatom Chlorophyll"
lnd['DiatomChlorophyll'] = "Diatom Chlorophyll"
Expand Down Expand Up @@ -247,7 +247,7 @@ def makeLongNameDict():

lnd['VolumeMeanTemperature'] = "Volume-weighted Mean Temperature"
lnd['GlobalMeanSalinity'] = "Global Volume-weighted Mean Salinity"


lnd['TotalHeatFlux'] = "Global Total Heat Flux"
lnd['HeatFlux'] = "Heat Flux"
Expand Down Expand Up @@ -326,7 +326,7 @@ def makeLongNameDict():
lnd['SSS'] = 'Sea Surface Salinty'

lnd['MA_DraKE'] = 'Drake Passage Current'
lnd['MA_AMOC_26N'] = 'AMOC at 26.5N'
lnd['MA_AMOC_26N'] = 'AMOC at 26.5N'
lnd['MA_ZOS'] = 'Sea Surface Height'
lnd['MA_MLD'] = 'Mixed Layer Depth'
lnd['MA_MLD_Sigma'] = 'Mixed Layer Depth (Sigma)'
Expand Down Expand Up @@ -400,6 +400,10 @@ def makeLongNameDict():
lnd['LabradorSea'] = "Labrador Sea"
lnd['NorwegianSea'] = "Norwegian Sea"
lnd['Cornwall'] = "Cornwall"
lnd['Ascension'] = "Ascension Island"
lnd['TristandaCunha'] = "Tristan da Cunha"
lnd['Pitcairn'] = "Pitcairn"


lnd['100m'] = "100m deep"
lnd['200m'] = "200m deep"
Expand Down Expand Up @@ -732,7 +736,7 @@ def getLongName(text, debug=False):


def fancyUnits(units, debug=False):
"""
"""
Converts ascii units string into latex style formatting.
"""
units = units.replace('[', '').replace(']', '')
Expand Down
13 changes: 13 additions & 0 deletions key_files/mpa_airseafluxco2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name : AirSeaFluxCO2
units : mmolC/m2/d
model : MEDUSA
modelgrid : eORCA1
dimensions : 2
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBIDo_1y_*_diad-T.nc
model_vars : CO2FLUX
model_convert : NoChange
layers : layerless
regions : Global Ascension TristandaCunha Pitcairn Cornwall


23 changes: 23 additions & 0 deletions key_files/mpa_alkalinity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name : Alkalinity
units : meq/m^3
model : MEDUSA
modelgrid : eORCA1
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBID*_1y_*_ptrc-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*$JOBID*_1y_*$YEAR????_ptrc-T.nc
#dataFile : $BASEDIR_OBS/Alk.nc

# # Model coordinates/dimension names
model_vars : ALK
model_convert : NoChange

#data_vars : Alk
#data_convert:
# function: convertmeqm3TOumolkg

layers : Surface #50m #;100m 200m 500m 1000m 2000m
regions : Global Ascension TristandaCunha Pitcairn Cornwall

20 changes: 20 additions & 0 deletions key_files/mpa_chlorophyll.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name : Chlorophyll
units : mg C/m^3
model : MEDUSA
modelgrid : eORCA1
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*_1y_*_ptrc-T.nc
gridFile : $BASEDIR_MODEL/mesh_mask_eORCA1_wrk.nc

# Model coordinates/dimension names
model_vars : CHD CHN
model_convert : sum

layers : Surface
regions : Global Ascension TristandaCunha Pitcairn Cornwall



19 changes: 19 additions & 0 deletions key_files/mpa_dic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name : DIC
units : mmol C/m^3
model : MEDUSA
modelgrid : eORCA1
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBIDo_1y_*_ptrc-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*$JOBIDo_1y_*$YEAR????_ptrc-T.nc

# # Model coordinates/dimension names
model_vars : DIC
model_convert : NoChange


layers : Surface #50m #;100m 200m 500m 1000m 2000m
regions : Global Ascension TristandaCunha Pitcairn Cornwall

32 changes: 32 additions & 0 deletions key_files/mpa_iron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name : Iron
units : mmol Fe/m^3
datasource : Initial Conditions
model : MEDUSA
modelgrid : eORCA1
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBIDo_1y_*_ptrc-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*$JOBDo_1y_*$YEAR????_ptrc-T.nc
#dataFile : /data/euryale7/backup/ledm/UKESM/InitialConditions/UKESM_fields_1860_eORCA1_small.nc
gridFile : $BASEDIR_MODEL/mesh_mask_eORCA1_wrk.nc

# Model coordinates/dimension names
model_vars : FER
model_convert :
function: multiplyBy
factor : 1000

# Data coordinates names
#data_vars : FER
#data_tdict : ZeroToZero
#data_convert : multiplyBy
#data_convert_factor : 1000

layers : Surface #Transect ;CanRusTransect PTransect SOTransect Equator ArcTransect AntTransect ArcTransect AntTransect
regions : Global Ascension TristandaCunha Pitcairn Cornwall




35 changes: 35 additions & 0 deletions key_files/mpa_mld.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name : MLD
units : m
dimensions : 2
model : NEMO
datasource : IFERMER

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/nemo*_$JOBIDo_1y_*_grid-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/nemo*_$JOBIDo_1y_*$YEAR????_grid-T.nc
dataFile : $BASEDIR_OBS/IFREMER-MLD/mld_DT02_c1m_reg2.0-annual.nc

# Model coordinates/dimension names
model_vars : mlotst
model_convert : NoChange
layers : layerless

#model_vars : somxl010 somxzint1
#model_convert:
# path: bgcval2/functions/applyLandMask.py
# function: applyLandMask
# areafile: $PATHS_GRIDFILE
# maskname : tmask

data_vars : mld
data_tdict : ZeroToZero
data_convert:
path: bgcval2/functions/applyLandMask.py
function: applyLandMask
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 Ascension TristandaCunha Pitcairn Cornwall

27 changes: 27 additions & 0 deletions key_files/mpa_nitrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name : Nitrate
units : mmol N/m^3
datasource : WOA
model : MEDUSA
modelgrid : eORCA1
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBID*_1y_*_ptrc-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*$JOBID*_1y_*$YEAR????_ptrc-T.nc
dataFile : $BASEDIR_OBS/WOA/annual/woa13_all_n00_01.nc

# Model coordinates/dimension names
model_vars : DIN
model_convert : NoChange

# Data coordinates names
data_vars : n_an
data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface 50m #;100m 200m 500m 1000m 2000m
regions : Global Ascension TristandaCunha Pitcairn Cornwall



25 changes: 25 additions & 0 deletions key_files/mpa_oxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name : Oxygen
units : mmol O2/m^3
datasource : WOA
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*_1y_*_ptrc-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*_1y_*$YEAR????_ptrc-T.nc
dataFile : $BASEDIR_OBS/WOA/annual/woa13_all_o00_01.nc

# Model coordinates/dimension names
model_vars : OXY
model_convert : NoChange

# Data coordinates names
data_vars : o_an
data_tdict : ZeroToZero
data_convert:
function: multiplyBy
factor : 44.661

layers : Surface 100m 500m
regions : Global Ascension TristandaCunha Pitcairn Cornwall

17 changes: 17 additions & 0 deletions key_files/mpa_ph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name : pH
units : ''
model : MEDUSA
modelgrid : eORCA1
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*$JOBID*_1y_*_diad-T.nc
#modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*$JOBID*_1y_*$YEAR????_ptrc-T.nc
# dataFile : $BASEDIR_OBS/WOA/annual/woa13_all_n00_01.nc
# # Model coordinates/dimension names
model_vars : PH3
model_convert : NoChange

layers : Surface #50m #;100m 200m 500m 1000m 2000m
regions : Global Ascension TristandaCunha Pitcairn Cornwall
23 changes: 23 additions & 0 deletions key_files/mpa_salinity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name : Salinity
units : PSU
dimensions : 3
model : NEMO
datasource : WOA
# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/nemo_$JOBIDo_1y_*_grid-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/nemo*$JOBIDo_1y_*$YEAR????_grid-T.nc
dataFile : $BASEDIR_OBS/WOA/annual/woa13_decav_s00_01v2.nc
gridFile : $PATHS_GRIDFILE

# Model coordinates/dimension names
model_vars : so_abs so
model_convert : choose_best_var

# Data coordinates names
data_vars : s_an
data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface
regions : Global Ascension TristandaCunha Pitcairn Cornwall
25 changes: 25 additions & 0 deletions key_files/mpa_silicate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name : Silicate
units : mmol Si/m^3
datasource : WOA
dimensions : 3

# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/medusa*_1y_*_ptrc-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/medusa*_1y_*$YEAR????_ptrc-T.nc
dataFile : $BASEDIR_OBS/WOA/annual/woa13_all_i00_01.nc

# Model coordinates/dimension names
model_vars : SIL
model_convert : NoChange

# Data coordinates names
data_vars : i_an
data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface
regions : Global Ascension TristandaCunha Pitcairn Cornwall



28 changes: 28 additions & 0 deletions key_files/mpa_temperature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name : Temperature
units : degrees C
dimensions : 3
model : NEMO
datasource : WOA
# The filenames
modelFiles : $BASEDIR_MODEL/$JOBID/nemo_$JOBIDo_1y_*_grid-T.nc
modelFile_p2p : $BASEDIR_MODEL/$JOBID/nemo*$JOBIDo_1y_*$YEAR????_grid-T.nc
dataFile : $BASEDIR_OBS/WOA/annual/woa13_decav_t00_01v2.nc
gridFile : $PATHS_GRIDFILE

# Model coordinates/dimension names
model_vars : thetao_con thetao
model_convert : choose_best_var


# Data coordinates names
data_vars : t_an
data_convert : NoChange
data_tdict : ZeroToZero

layers : Surface
regions : Global Ascension TristandaCunha Pitcairn Cornwall




Loading

0 comments on commit 017445f

Please sign in to comment.