! jnl file that uses Argo data to make different salinity maps ! 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_psal_plot time_start time_end depth_min depth_max lat_min lat_max lon_min lon_max iland station 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 lat/lon ranges, you must fill in values ! for the first 4 variables as well as the lat/lon ranges. ! depth values are entered in the range of 0 - 2000dbar ! time values are entered corresponding to monthly values starting with Jan, 2004 ! iland 0=hig res, 1=low res go fland ! station 1=overlay stations, all other values disable ! 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 time region cancel/all data cancel/all var cancel/all sym set window/clear go set_pixel_size 1024 768 set mem/size=100 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 ! assigning variables to arguments passed in the go command as well as default values let lat_min=`$5%-65%` let lat_max=`$6%60%` let lon_min=`$7%-180%` let lon_max=`$8%180%` let depth_min=`$3%1000%` let depth_max=`$4%1000%` let time_start=`$1%6%` let time_end=`$2%6%` let iland=`$9%1%` let station=`$10%0%` let depth_axis=`$11%1%` 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 ! 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 dyn_t = if mskt1 eq 1 then t_b1 else t_b2 let dyn_s = if mskt1 eq 1 then s_b1 else s_b2 let dyn_p=z[d=1,g=`t1, return=grid`] ! setting map scales properly let beq=if (`lon_min`) eq (`lon_max`) then 1 else 0 if `beq` then let lon_max=`lon_max`+360 endif let blm=if (`lon_min`) gt (`lon_max`) then 1 else 0 if `blm` then let lon_max=`lon_max`+360 endif define symbol xdeg `lon_max-lon_min` define symbol ydeg `lat_max-lat_min` define symbol alasp `($ydeg)/($xdeg)` set win/asp=($alasp):axis if `depth_axis` then ! you want meters instead of db as the depth axis unit ! first need to change to depth from pressure 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_p let top_line=(((-1.82*10^-15*dyn_p+2.279*10^-10)*dyn_p-2.2512*10^-5)*dyn_p+9.72659)*dyn_p let dep=top_line/bot_line ! then regrid onto original pressure grid spacing let psal=zaxreplace(dyn_s,dep,z[gz=`t1, return=grid`]) elseif ! you want db instead of m as the depth axis unit let psal=dyn_s endif ! begin mapping process ! only map an average if the two depths/times are different. otherwise, map at that depth/time only ! only plot averaged points if there is data down at the deepest layer let mskd=if psal[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`,z=`depth_max`] then 1 ! depth is the same let a=if `depth_max` eq `depth_min` then 1 else 0 if `a` then let psal_map=psal[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`,z=`depth_min`,l=`time_start`:`time_end`@ave] endif !time is the same let b=if `time_start` eq `time_end` then 1 else 0 if `b` then let psal_map= if mskd[l=`time_start`] eq 1 then psal[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`,z=`depth_min`:`depth_max`@ave,l=`time_start`] endif !both are the same let c= if `a` eq 1 and `b` eq 1 then 1 else 0 if `c` then let psal_map= psal[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`,z=`depth_min`,l=`time_start`] endif !both are different let d= if `a` eq 0 and `b` eq 0 then 1 else 0 if `d` then let psal_map=if mskd[l=`time_start`:`time_end`@ave] eq 1 then psal[x=`lon_min`:`lon_max`,y=`lat_min`:`lat_max`,z=`depth_min`:`depth_max`@ave,l=`time_start`:`time_end`@ave] endif let con_lev= $12&"()"|*>"*"& fill/set/nolab/pal=cofi_sal/lev="`con_lev`" psal_map ppl shakey 1,1,.08,0,5,9,,,, ppl fill ! adding contours con/set_up/over/nolab/lev="`con_lev`" psal_map ppl conset .08,,,,4,,,5.7,1.,1 ppl contour/overlay ! now use etopo6 to add bathymetry ! check zonal range to see if using high or low land resoluion let rcheck=`lon_max`-`lon_min` if `rcheck gt 120` then if `iland eq 0` then use etopo12_grid.nc shade/over/nokey/nolab/pal=black/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/lev=(0,10000,10000) btdata12[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] shade/over/nokey/nolab/palette=lightgreyscale/over/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/levels=(-1000,0,1000) btdata12[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] shade/over/nokey/nolab/pal=grey/over/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/lev=(-200,0,200) btdata12[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] endif if `iland eq 1` then use etopo12_grid.nc fill/over/nokey/nolab/palette=black/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/levels=(0,10000,10000) btdata12[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] endif endif if `rcheck le 120` then if `iland eq 0` then use etopo6_grid.nc fill/over/nokey/nolab/palette=black/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/levels=(0,10000,10000) btdata[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] fill/over/nokey/nolab/palette=lightgreyscale/over/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/levels=(-1000,0,1000) btdata[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] fill/over/nokey/nolab/palette=grey/over/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/levels=(-200,0,200) btdata[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] else use etopo6_grid.nc fill/over/nokey/nolab/palette=black/hlim=`lon_min`:`lon_max`/vlim=`lat_min`:`lat_max`/levels=(0,10000,10000) btdata[y=`lat_min`:`lat_max`,x=`lon_min`:`lon_max`] endif endif if `station eq 1` then go fer_psal_station_loc_overlay endif 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_psal_map time_start time_end depth_min depth_max lat_min lat_max lon_min lon_max iland station con_lev