! jnl file that uses Argo data to make different dynamic height line yearly anomaly plots ! requires input arguments for time range, depth range and lat/lon range ! to run the program in ferret, you will need to type the following line with the various values filled in: ! go fer_dyn_ht_line_yearly_anom time_start type time_end depth_min depth_max lat_min lat_max lon_min lon_max ! If you choose not to give values for the various variables, default ones will be substituted for you. ! If you only want to choose some values, you can, but you cannot skip any values. This means you can ! fill in the first 2 and no others, or if you want to specify the lat/lon ranges, you must fill in values ! for the first 4 variables as well as the lat/lon ranges. ! type means T vs. time(1), T vs. latitude (2), or T vs. longitude (3) ! depth values are entered in the range of 0 - 2000dbar ! time values are entered corresponding to monthly values starting with Jan, 2004 ! if no values are entered, the default region is 50S to 25N and 130E to 250E with an average over the ! entire depth and time region cancel/all data cancel/all var cancel/all sym set window/clear go set_pixel_size 1024 768 set mem/size=200 ! assigning variables to arguments passed in the go command as well as default values let lat_min=`$6%-30%` let lat_max=`$7%30%` let lon_min=`$8%10%` let lon_max=`$9%170%` let depth_min=`$4%0%` let depth_max=`$5%100%` let time_start=`$2%1%` let time_end=`$3%48%` let type_plot=`$1%2%` let depth_axis=`$10%0%` set mode interpolate set region/z=`depth_min`:`depth_max`/y=`lat_min`:`lat_max`/x=`lon_min`:`lon_max` define viewport/xlim=.0,.95/ylim=0,1 top PPL DFLTFNT DR ppl conpre @P1@DR ppl axlsze 0.15,.15 ppl axset 1,1,1,1 ppl pen 0,7 ppl pen 1,7 ppl labset .15,.15,.15 ! Ensuring longitudes are properly plotted let boundb=if (`lon_min`) gt (`lon_max`) then 1 else 0 if `boundb` then let lon_max=`lon_max`+360 endif ! load in first file use RG_ArgoClim_Temp_2014.nc let t1=ARGO_TEMPERATURE_MEAN[d=1]+ARGO_TEMPERATURE_ANOMALY[d=1] ! now set up grid for entire time range define axis/x=20.5E:19.5E:1/unit=degree xlong define axis/y=64.5S:79.5N:1/unit=degree ylat define axis/t="16-Jan-2004":"16-Dec-2023":1/units=months tclim let dyn_p=z[d=1,g=`t1, return=grid`] define grid/x=xlong/y=ylat/z=dyn_p/t=tclim RG_grid ! now load in second temp file use RG_ArgoClim_Temp_2024.nc let t2=ARGO_TEMPERATURE_MEAN[d=2]+ARGO_TEMPERATURE_ANOMALY[d=2] ! now try to put all data onto same grid let t_b1 = t1[gt=RG_grid@asn] let t_b2 = t2[gt=RG_grid@nrst] ! load in first salinity file use RG_ArgoClim_Psal_2014.nc let s1=ARGO_SALINITY_MEAN[d=3]+ARGO_SALINITY_ANOMALY[d=3] ! now load in second psal file use RG_ArgoClim_Psal_2024.nc let s2=ARGO_SALINITY_MEAN[d=4]+ARGO_SALINITY_ANOMALY[d=4] ! now try to put all data onto same grid let s_b1 = s1[gt=RG_grid@asn] let s_b2 = s2[gt=RG_grid@nrst] ! mask out the current data let mskt1 = if t_b1 then 1 else 0 ! define new full time scale data let temp = if mskt1 eq 1 then t_b1 else t_b2 let psal = if mskt1 eq 1 then s_b1 else s_b2 let dyn_pres=z[d=1,g=`t1, return=grid`] ! checking on depth max. If using meters, depth max is no longer 2000 let max_dep=if `depth_max` eq 2000 then 1 else 0 if `depth_axis` then ! you want meters instead of db as the depth axis unit ! first need to change to depth from pressure for temperature let xo=sin(y[g=`t1, return=grid`]*3.1415926/180) let xxo=xo*xo let bot_line=9.780318*(1.0+(5.2788*10^-3+2.36*10^-5*xxo)*xxo) + 1.092*10^-6*dyn_pres let top_line=(((-1.82*10^-15*dyn_pres+2.279*10^-10)*dyn_pres-2.2512*10^-5)*dyn_pres+9.72659)*dyn_pres let dep=top_line/bot_line ! then regrid onto original pressure grid spacing let dyn_t=zaxreplace(temp,dep,z[gz=`dyn_pres, return=grid`]) ! second need to change to depth from pressure for salinity let xos=sin(y[g=`s1, return=grid`]*3.1415926/180) let xxos=xos*xos let bot_line=9.780318*(1.0+(5.2788*10^-3+2.36*10^-5*xxos)*xxos) + 1.092*10^-6*dyn_pres let top_line=(((-1.82*10^-15*dyn_pres+2.279*10^-10)*dyn_pres-2.2512*10^-5)*dyn_pres+9.72659)*dyn_pres let dep=top_line/bot_line ! then regrid onto original pressure grid spacing let dyn_s=zaxreplace(psal,dep,z[gz=`dyn_pres, return=grid`]) ! now set pressure for density calculation let dyn_p=dyn_pres if `max_dep` then let depth_max=1900 else ! you want db instead of m as the depth axis unit let dyn_t=temp let dyn_s=psal let dyn_p=z[d=1,g=`t1, return=grid`] endif let dens=rho_un(dyn_s,dyn_t,dyn_p) let potemp=THETA_FO(dyn_s,dyn_t,dyn_p,0) let podens=rho_un(dyn_s,potemp,0.)-1000 go dynamic_height ! only lat is the same let a=if (`lat_min`) eq (`lat_max`) and (`lon_min`) ne (`lon_max`) and `time_start` ne `time_end` then 1 else 0 ! only lon is the same let b=if (`lon_min`) eq (`lon_max`) and (`lat_min`) ne (`lat_max`) and `time_start` ne `time_end` then 1 else 0 ! only time is the same let c=if (`lon_min`) ne (`lon_max`) and (`time_start`) eq (`time_end`) and (`lat_min`) ne (`lat_max`) then 1 else 0 ! lat and lon are the same, time is different let d=if (`lon_min`) eq (`lon_max`) and (`lat_min`) eq (`lat_max`) and `time_start` ne `time_end` then 1 else 0 ! lat, lon and time are different let e=if (`lon_min`) ne (`lon_max`) and (`lat_min`) ne (`lat_max`) and `time_start` ne `time_end` then 1 else 0 ! lon and time are the same, lat is different let f=if (`lon_min`) eq (`lon_max`) and (`time_start`) eq (`time_end`) and (`lat_min`) ne (`lat_max`) then 1 else 0 ! lat and time are the same, lon is different let g=if (`lat_min`) eq (`lat_max`) and (`time_start`) eq `time_end` and (`lon_min`) ne (`lon_max`) then 1 else 0 ! type 1 plot - line of T vs. time let ltime=if `type_plot` eq 1 then 1 else 0 if `ltime` then say dyn_ht vs time if `ltime` then ! only lat is the same if `a` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`,l=`time_start`:`time_end`]- dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`,l=1:156@ave] endif ! only lon is the same if `b` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`,y=`lat_min`:`lat_max`@ave,l=`time_start`:`time_end`]-dyn_ht[x=`lon_min`,y=`lat_min`:`lat_max`@ave,l=1:156@ave] endif ! lat and lon are the same if `d` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`,y=`lat_min`,l=`time_start`:`time_end`] - dyn_ht[x=`lon_min`,y=`lat_min`,l=1:156@ave] endif ! all three are different if `e` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`:`lat_max`@ave,l=`time_start`:`time_end`] - dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`:`lat_max`@ave,l=1:156@ave] endif endif if `ltime` then plot/nolab/line=13/set dyn_ht_plot_anom if `depth_axis` then ppl ylab Argo Dynamic Height (`depth_min`/`depth_max` meters) elseif ppl ylab Argo Dynamic Height (`depth_min`/`depth_max` dbar) endif ppl axlabp -1,-1 ppl labset 0.15 0.15 0.15 0.15 ppl axlsze,0.15,0.15 ppl plot ppl origin ,($orig_yorg) !restore y origin endif ! type 2 plot - line of T vs. latitude let llat=if `type_plot` eq 2 then 1 else 0 if `llat` then say dyn_ht vs. latitude if `llat` then ! only lon is the same if `b` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`,y=`lat_min`:`lat_max`,l=`time_start`:`time_end`@ave]-dyn_ht[x=`lon_min`,y=`lat_min`:`lat_max`,l=1:156@ave] endif ! all three are different if `e` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`:`lat_max`,l=`time_start`:`time_end`@ave] - dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`:`lat_max`,l=1:156@ave] endif ! time is the same if `c` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`:`lat_max`,l=`time_start`] - dyn_ht[x=`lon_min`:`lon_max`@ave,y=`lat_min`:`lat_max`,l=1:156@ave] endif ! lon and time are the same if `f` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`,y=`lat_min`:`lat_max`,l=`time_start`] - dyn_ht[x=`lon_min`,y=`lat_min`:`lat_max`,l=1:156@ave] endif endif if `llat` then plot/nolab/line=13/set dyn_ht_plot_anom if `depth_axis` then ppl ylab Argo Dynamic Height (`depth_min`/`depth_max` meters) elseif ppl ylab Argo Dynamic Height (`depth_min`/`depth_max` dbar) endif ppl axlabp -1,-1 ppl labset 0.15 0.15 0.15 0.15 ppl axlsze,0.15,0.15 ppl plot ppl origin ,($orig_yorg) !restore y origin endif ! type 3 plot - line of T vs. longitude let llon=if `type_plot` eq 3 then 1 else 0 if `llon` then say dyn_ht vs. longitude if `llon` then ! only lat is the same if `a` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`,l=`time_start`:`time_end`@ave]- dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`,l=1:156@ave] endif ! all three are different if `e` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`@ave,l=`time_start`:`time_end`@ave] - dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`@ave,l=1:156@ave] endif ! time is the same if `c` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`@ave,l=`time_start`] - dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`@ave,l=1:156@ave] endif ! time and lat are the same if `g` then let dyn_ht_plot_anom= dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`,l=`time_start`] - dyn_ht[x=`lon_min`:`lon_max`,y=`lat_min`,l=1:156@ave] endif endif if `llon` then plot/nolab/line=13/set dyn_ht_plot_anom if `depth_axis` then ppl ylab Argo Dynamic Height (`depth_min`/`depth_max` meters) elseif ppl ylab Argo Dynamic Height (`depth_min`/`depth_max` dbar) endif ppl axlabp -1,-1 ppl labset 0.15 0.15 0.15 0.15 ppl axlsze,0.15,0.15 ppl plot ppl origin ,($orig_yorg) !restore y origin endif