! This PyFerret script plots FIG_3 of the Paper "Artificial Upwelling - A New Narrative"
! and was written by M. Juerchott (mjuerchott@geomar.de) on the 12th September 2022.
! In order to run this script without error you have to change the path to the model output files to your personal folder structure.
! *** Only run it in -nodisplay -nojnl mode ***
! Save current state
define REGION/DEFAULT "save"
set data/save
set grid/save
! Clean everything
cancel data/all
cancel variable/all
cancel region/all
! Script function
use /Users/mjuerchott/runs/2021_02_Pipes_noLand_COU85/tavg.02025.01.01.nc ! [d=1] ArtUp_8.5
use /Users/mjuerchott/runs/2021_02_noPipes_noLand_COU85_cont/tavg.02025.01.01.nc ! [d=2] REF_8.5
! Where are pipes ?
let pipe_distribution = O_ZPIPE[d=1]
let ideal_age = O_IDEALAGE[d=1] / 365
! Age at pipe depth
let age_z1100_1 = if pipe_distribution LT 1200 then 1 else 0
let age_z1100_2 = if pipe_distribution GT 1000 then 1 else 0
let age_1100 = (age_z1100_1 * age_z1100_2) * ideal_age[z=1100]
let age_z900_1 = if pipe_distribution LT 1000 then 1 else 0
let age_z900_2 = if pipe_distribution GT 800 then 1 else 0
let age_900 = (age_z900_1 * age_z900_2) * ideal_age[z=900]
let age_z700_1 = if pipe_distribution LT 800 then 1 else 0
let age_z700_2 = if pipe_distribution GT 600 then 1 else 0
let age_700 = (age_z700_1 * age_z700_2) * ideal_age[z=700]
let age_z500_1 = if pipe_distribution LT 600 then 1 else 0
let age_z500_2 = if pipe_distribution GT 400 then 1 else 0
let age_500 = (age_z500_1 * age_z500_2) * ideal_age[z=500]
let age_z300_1 = if pipe_distribution LT 400 then 1 else 0
let age_z300_2 = if pipe_distribution GT 200 then 1 else 0
let age_300 = (age_z300_1 * age_z300_2) * ideal_age[z=300]
let age = age_1100 + age_900 + age_700 + age_500 + age_300
! fCO2 A2O
let fDIC_Control = F_DIC[d=2]
let fDIC_Pipe = F_DIC[d=1]
let F_DIC_Change = (fDIC_Pipe - fDIC_Control) * (60*60*24*365)
! DIC
let Change_DIC = O_DIC[d=1] - O_DIC[d=2]
let Change_DIC_1200 = Change_DIC[z=1200:6100@DIN]
! DICpre
let Change_preDIC = O_preDIC[d=1] - O_preDIC[d=2]
let Change_preDIC_1200 = Change_preDIC[z=1200:6100@DIN]
! DICrem
let Change_DICr = O_DICR[d=1] - O_DICR[d=2]
let Change_DICr_1200 = Change_DICr[z=1200:6100@DIN]
! plot routine
cancel windows/all
set windows/new
set text/font='Times New Roman'
set text/isiz=4
go portrait3x3.jnl
! tr, mr, br, bm, bl
! left column
define view/xlimits=0.07,0.47/ylimits=0.58,1 tl
define view/xlimits=0.07,0.47/ylimits=0.29,0.70 ml
define view/xlimits=0.07,0.47/ylimits=0,0.41 bl
! mid column
define view/xlimits=0.50,0.90/ylimits=0.58,1 tm
define view/xlimits=0.50,0.90/ylimits=0.29,0.70 mm
define view/xlimits=0.50,0.90/ylimits=0,0.41 bm
set view tl
shade/nolabel/HLIMITS=0:360:45/pal=pipes/levels=(0,1200,200)/k=1/l=16 pipe_distribution
go fland
label 400,110,1,0,0.13 "pipe source depth [m]"
label -40,-110,0,0,0.2 "(a)"
set view ml
shade/nolabel/HLIMITS=0:360:45/pal=cmocean_dense/levels=(0,1200,200)/l=16 age
go fland
label 400,110,1,0,0.13 "Ideal Age [years]"
label -40,-110,0,0,0.2 "(c)"
set view bl
shade/nolabel/HLIMITS=0:360:45/pal=fDIC_rev2/levels=(-8,8,1)/k=1/l=16 F_DIC_Change
go fland
label 400,110,1,0,0.13 "<#916>fDIC [mol C/m²/year]"
label -40,-110,0,0,0.2 "(e)"
set view tm
shade/nolabel/HLIMITS=0:360:45/pal=fDIC_rev1/levels=(-20,80,10)/l=16 Change_DIC_1200
go fland
label 400,110,1,0,0.13 "<#916>DIC [Pg C]"
label -40,-110,0,0,0.2 "(b)"
set view mm
shade/nolabel/HLIMITS=0:360:45/pal=fDIC_rev1/levels=(-20,80,10)/l=16 Change_preDIC_1200
go fland
label 400,110,1,0,0.13 "<#916>DICpre [Pg C]"
label -40,-110,0,0,0.2 "(d)"
set view bm
shade/nolabel/HLIMITS=0:360:45/pal=fDIC_rev1/levels=(-20,80,10)/l=16 Change_DICr_1200
go fland
label 400,110,1,0,0.13 "<#916>DICrem [Pg C]"
label -40,-110,0,0,0.2 "(f)"
! save plot
frame/file = "FIG_3.png"
! Cancel everything
cancel data/all
cancel variable/all
cancel region/all
! Restore current state
set data/restore
set grid/restore