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

A few handy jobs for looking aat a few UK MPA regions. #119

Merged
merged 5 commits into from
Nov 24, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ _sidebar.rst.inc
local_test/BGC_data/valeriu
mass_scripts
CompareReports2
.idea/workspace.xml
36 changes: 28 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,26 @@ 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 == 'TristandaCunha': # MPA covers two islands. This is very approximate
# Edinburgh of 7 seas: -37.10646514207477 South,, -12.297874143783694 West
# Gough island: -40.322968275628654 South, -9.935193569988446 West
mx = np.ma.masked_outside(xx, -12.3 - 3., -9.9 + 3.).mask # longitude # West
mx += np.ma.masked_outside(xy, -40.3 -3, -37.1 + 3.).mask # Lattitue # South
return mx

if newSlice == 'Pitcairn': # MPA covers several islands. This is very approximate
# Ducie Island: 24.66 S 124.75 W (Eastern most)
# Oeno island: 23.9 S 130.74 W (western most) (Western boundary is not the full EEZ)
mx = np.ma.masked_outside(xx, -130.74 - 1.5, 124.75 + 3.).mask # longitude # West
mx += np.ma.masked_outside(xy, -24.66 -3, -23.9 + 3.).mask # Lattitue # South
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 +507,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
120 changes: 120 additions & 0 deletions input_yml/TerraFIRMA_overshoot_mpas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
# GC5 N96 ORCA1 spinup analysis
name: TerraFIRMA_overshoot_MPAs

# Run the single job analysis
do_analysis_timeseries: True

# Download from mass:
do_mass_download: False

# master analysis suite
master_suites: kmf mpas # physics bgc #alkalinity physics kmf1

# Run without strick check (if True, breaks if job has no years.)
strict_file_check: False

clean: True

jobs:
u-cs495:
description: 'PI-Control'
label: 'Pi-Control'
colour: 'blue'
thickness: 1.2
linestyle: '-'
shifttime: -100.
timerange: [1850, 2200]
suite: kmf mpas #physics bgc #alkalinity physics


u-cx209:
description: 'E-mode free ice RAMP UP 8GtC/yr #1'
label: 'Ramp-up'
colour: 'black'
thickness: 1.2
linestyle: '-'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas #physics bgc #alkalinity physics

# 1.5k Stabilisation
u-cy837:
description: '1.5K Stabilisation from u-cx209 (#1)'
label: '1.5K Stable'
colour: 'lawngreen'
thickness: 1.2
linestyle: '-'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas # physics bgc #alkalinity physics


# 2k Stabilisation
u-cy838:
description: '2.0K Stabilisation from u-cx209 (#1)'
label: '2K Stable'
colour: 'goldenrod'
thickness: 1.2
linestyle: '-'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas # physics bgc #alkalinity physics


# other Stabilisations
u-cz375:
description: '3.0K Stabilisation from u-cx209 (#1)'
label: '3K Stable'
colour: 'red' #
thickness: 1.2
linestyle: '-'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas # physics bgc #alkalinity physics
u-cz376:
description: '4.0K Stabilisation from u-cx209 (#1)'
label: '4K Stable'
colour: 'sienna'
thickness: 1.2
linestyle: '-'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas # physics bgc #alkalinity physics
u-cz377:
description: '5.0K Stabilisation from u-cx209 (#1)'
label: '5K Stable'
colour: 'maroon'
thickness: 1.2
linestyle: '-'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas # physics bgc #alkalinity physics

# Ramp downs
u-da697:
description: '1.5K Rampdown from u-cx209 (#1)'
label: '1.5K Rampdown'
colour: 'lawngreen'
thickness: 1.2
linestyle: ':'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas # physics bgc #alkalinity physics

u-cz944:
description: 'Ramp down from cy838 (- 2.0K Stabilisation from u-cx209) (#1)'
label: '2K Rampdown'
colour: 'goldenrod'
thickness: 1.2
linestyle: 'dashed'
shifttime: 0.
#timerange: [1800, 2050]
suite: kmf mpas #physics bgc #alkalinity physics







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

Loading
Loading