! jnl file that uses Argo data to make different dynamic height section anomaly plots. The sections are either ! in a N-s direction or an E-W direction. This does not make arbitrary section plots. The anomaly is from the monthly ! mean. ! This file requires input arguments for the location of section, the times, the depth range and the distance range. ! To run the program in ferret, you will need to type the following line with or without the various values ! filled in: ! go fer_dyn_ht_point_monthly_anom x1 y1 x2 y2 time month depth_min depth_max depth_axis con_lev ! 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 time ranges, you must do the first 4. ! You can't choose to do the depth_min and depth_max without filling in the ! x1, y1, x2, y2, time_start, and time_end ! x1 corresponds to the starting longitude point ! x2 corresponds to the ending longitude point ! y1 corresponds to the starting latitude point ! y2 corresponds to the ending latitude point ! depth values are entered in the range of 0 - 2000dbar with the default being 0 - 1000dbar ! time values are entered corresponding to monthly values starting with Jan, 2004 ! month values are entered in the range of 1-12 corresponding to the monthly anomaly you would like to look ! ranging from Jan-Dec. ! NOTE: These plots only make sense if time and month values correspond. In other words, if you want to look ! at a January monthly anomaly, you choose '1' for month and then choose '1' for Jan. 2004, '13' for Jan. 2005, ! '25' for Jan. 2006, or '37' for Jan. 2007. No other choices make sense. ! NOTE: These plots only make sense if time and month values correspond. In other words, if you want to look ! at a January monthly anomaly, you choose '1' for month and then can choose '1' for Jan. 2004, '13' for Jan. 2005, ! '25' for Jan. 2006, or '37' for Jan. 2007. No other choices make sense. ! con_lev sets the contour and fill levels of the plot. This is done in the following format: (lo,hi,delta). ! More than one can be chosen: (lo,mid,delta1),(mid,hi,delta2). See the Ferret Users Manual for more information. ! if no values are entered, the default region is 50S to 25N and 130E to 250E with an average over the ! entire depth and the monthly anomaly for Jan. 2007. cancel/all data cancel/all var cancel/all sym set window/clear go set_pixel_size 1024 768 set mem/size=200 set region/z=0:2000/y=-50:25/x=130:250 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 ! 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`] use climatological_axes.cdf let depth_min=`$7%0%` let depth_max=`$8%100%` let time=`$5%37%` let month=`$6%1%` ! setting the default values let x1=`$1%202.1%` let x2=`$3%230%` let y1=`$2%21.3%` let y2=`$4%34.5%` let depth_axis=`$9%0%` set mode interpolate ! 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 ! start of plotting section. 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 ! setting depth region set region/z=`depth_min`:`depth_max` ! setting depth region set region/z=`depth_min`:`depth_max` ! define track start x=`x1`, y=`y1` ! end x=`x2` y=`y2` let changey= `y2`-`y1` let changex= `x2`-`x1` let slope1= `changey`/`changex` let xlon1= `x1`+(i[i=1:230]-1)/10 let xlat1= `y1`+slope1*(i[i=1:230]-1)/10 ! defining sample xy region let c= if (`x1`) le (`x2`) then 1 else 0 if `c` then let xlow= (`x1`)-30 let xhigh= (`x2`)+30 else let xlow= (`x2`)-30 let xhigh= (`x1`)+30 endif let d= if (`y1`) le (`y2`) then 1 else 0 if `d` then let ylow= (`y1`)-30 let yhigh= (`y2`)+30 else let ylow= (`y2`)-30 let yhigh= (`y1`)+30 endif define grid/like=dyn_s arg_grd let dyn_p = z[d=1,g=arg_grd] 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. set mode interpolate go dynamic_height ! a vertical section can only be made if the depths are different. ! depth is the same let a=if `depth_max` eq `depth_min` then 1 else 0 if `a` then say "depth is the same - cannot graph a section" endif ! depths are different let dyn_ht= samplexy(dyn_htz[x=`xlow`:`xhigh`,y=`ylow`:`yhigh`],xlon1,xlat1) let c_dyn_ht=dyn_ht[gt=month_irreg@mod] let dyn_ht_anom=dyn_ht-c_dyn_ht fill/nolab/set/pal=centered dyn_ht_anom[z=`depth_min`:`depth_max`,l=`time`] ppl axlabp,0,-1 if `depth_axis` then ppl ylab Depth (meters) elseif ppl ylab Pressure (dbar) endif ppl shakey 1,,.08,,5,,,,,, ppl fill let anom_max=dyn_ht_anom[x=@max,z=@max,l=`time`] let anom_min=dyn_ht_anom[z=@min,x=@min,l=`time`] ! creating an equal, centered key let abs_max=ABS(`anom_max`) let abs_min=ABS(`anom_min`) ! case where anom_max is bigger than anom_min let maxz=if `abs_max` gt `abs_min` and `abs_max` lt 1 then 1 else 0 if `maxz` then let lev_max = (int(10*abs_max)+1)/10 let lev_min = (int(-10*abs_max)-1)/10 endif let maxnz=if `abs_max` gt `abs_min` and `abs_max` gt 1 then 1 else 0 if `maxnz` then let lev_max=int(anom_max)+1 let lev_min=int((-1*anom_max))-1 endif let anom_diff=lev_max-lev_min let anom_delta=anom_diff/8 ! case where anom_min is bigger than anom_max let minz=if `abs_min` gt `abs_max` and `abs_min` lt 1 then 1 else 0 if `minz` then let lev_max = (int(10*abs_min)+1)/10 let lev_min = (int(10*anom_min)-1)/10 endif let minnz=if `abs_min` gt `abs_max` and `abs_min` gt 1 then 1 else 0 if `minnz` then let lev_max=int(abs_min)+1 let lev_min=int(anom_min)-1 endif let anom_diff=lev_max-lev_min let anom_delta=anom_diff/8 let con_lev= $10&"(`lev_min`,`lev_max`,`anom_delta`)"|*>"*"& ! adding contours con/over/nolab/set/lev="`con_lev`" dyn_ht_anom[z=`depth_min`:`depth_max`,l=`time`] ppl conset .11,,,,,,,5.7,1.,1 ppl contour/overlay say Plot is finished say To adjust parameters, use the command line to pass arguments say For this file, the form to pass arguments is say go fer_dyn_ht_point_monthly_anom x1 y1 x2 y2 time month depth_min depth_max depth_axis con_lev