[Thread Prev][Thread Next][Index]

[las_users] las 8.6.1 Hovmoller Plots & Vertical Section Plots plot issue



Hi!

Today I just deployed las 8.6.1 for testing, with default datasets what I found is LAS was unable to generate both Vertical Section Plots  and Hovmoller Plots. Also I think in latest build addXML utility is missing "$ADDXML_HOME/dist/lib/addXML.jar"

Please find debug file, let me know if I missed something.

Regards,
Akshay Hegde,
Data and Information,
CSIR-NIO
https://about.me/akshay.k.hegde

 Cached data cleared from memory
 **ERROR: command syntax: "/"
CONTOUR/FILL/NOKEY//KEY=CONT/LEVELS=v/OVER/NOLAB 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
Command file, command group, or REPEAT execution aborted
ERROR RUNNING SCRIPT

go "$1"
 !-> go "/usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/WEB-INF/classes/resources/ferret/temp/ferret_operation_271270_1497721646430.jnl"
! Symbols from the server
                        DEFINE SYMBOL data_0_ID = salt
                                 DEFINE SYMBOL data_0_dataset_ID = levitus_climatology_cdf
                                 DEFINE SYMBOL data_0_dataset_doc = docs/levitus_monthly.html
                                 DEFINE SYMBOL data_0_dataset_name = Levitus Climatology
                                 DEFINE SYMBOL data_0_dataset_url = file:levitus_climatology
                                 DEFINE SYMBOL data_0_dsid = levitus_climatology_cdf
                                 DEFINE SYMBOL data_0_ftds_url = http://test.nio.org/thredds/dodsC/las/levitus_climatology_cdf/data_levitus_climatology.jnl
                                 DEFINE SYMBOL data_0_grid_type = regular
                                 DEFINE SYMBOL data_0_intervals = xyz
                                 DEFINE SYMBOL data_0_name = SALINITY
                                 DEFINE SYMBOL data_0_points = xyz
                                 DEFINE SYMBOL data_0_region = region_0
                                 DEFINE SYMBOL data_0_title = SALINITY
                                 DEFINE SYMBOL data_0_units = PPT
                                 DEFINE SYMBOL data_0_url = levitus_climatology
                                 DEFINE SYMBOL data_0_var = salt
                                 DEFINE SYMBOL data_0_xpath = /lasdata/datasets/levitus_climatology_cdf/variables/salt
                                 DEFINE SYMBOL data_count = 1
                                 DEFINE SYMBOL ferret_annotations = file
                                 DEFINE SYMBOL ferret_fill_type = fill
                                 DEFINE SYMBOL ferret_image_format = gif
                                 DEFINE SYMBOL ferret_land_type = shade
                                 DEFINE SYMBOL ferret_service_action = Plot_2D
                                 DEFINE SYMBOL ferret_size = .8333
                                 DEFINE SYMBOL ferret_view = xz
                                 DEFINE SYMBOL las_debug = false
                                 DEFINE SYMBOL las_output_type = xml
                                 DEFINE SYMBOL operation_ID = Plot_2D_zoom
                                 DEFINE SYMBOL operation_key = 6DC98B0E79A4A508B41D08FE1989CACB
                                 DEFINE SYMBOL operation_name = Color plot
                                 DEFINE SYMBOL operation_service = ferret
                                 DEFINE SYMBOL operation_service_action = Plot_2D
                                 DEFINE SYMBOL product_server_clean_age = 168
                                 DEFINE SYMBOL product_server_clean_interval = 24
                                 DEFINE SYMBOL product_server_clean_time = 00:01
                                 DEFINE SYMBOL product_server_clean_units = hour
                                 DEFINE SYMBOL product_server_default_catid = ocean_atlas_subset
                                 DEFINE SYMBOL product_server_default_dsid = ocean_atlas_subset
                                 DEFINE SYMBOL product_server_default_operation = Plot_2D_XY_zoom
                                 DEFINE SYMBOL product_server_default_option = Options_2D_image_contour_xy_7
                                 DEFINE SYMBOL product_server_default_varid = TEMP-ocean_atlas_subset
                                 DEFINE SYMBOL product_server_default_view = xy
                                 DEFINE SYMBOL product_server_ps_timeout = 3600
                                 DEFINE SYMBOL product_server_ui_timeout = 10
                                 DEFINE SYMBOL product_server_use_cache = true
                                 DEFINE SYMBOL product_server_version = 8.4
                                 DEFINE SYMBOL region_0_x_hi = 360
                                 DEFINE SYMBOL region_0_x_lo = 0
                                 DEFINE SYMBOL region_0_y_hi = 0
                                 DEFINE SYMBOL region_0_y_lo = 0
                                 DEFINE SYMBOL region_0_z_hi = 5000
                                 DEFINE SYMBOL region_0_z_lo = 0
                                 DEFINE SYMBOL result_annotations_ID = annotations
                                 DEFINE SYMBOL result_annotations_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_annotations.xml
                                 DEFINE SYMBOL result_annotations_type = annotations
                                 DEFINE SYMBOL result_cancel_ID = cancel
                                 DEFINE SYMBOL result_cancel_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_cancel.txt
                                 DEFINE SYMBOL result_cancel_type = cancel
                                 DEFINE SYMBOL result_count = 8
                                 DEFINE SYMBOL result_debug_ID = debug
                                 DEFINE SYMBOL result_debug_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_debug.txt
                                 DEFINE SYMBOL result_debug_type = debug
                                 DEFINE SYMBOL result_map_scale_ID = map_scale
                                 DEFINE SYMBOL result_map_scale_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_map_scale.xml
                                 DEFINE SYMBOL result_map_scale_type = map_scale
                                 DEFINE SYMBOL result_plot_image_ID = plot_image
                                 DEFINE SYMBOL result_plot_image_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_plot_image.png
                                 DEFINE SYMBOL result_plot_image_type = image
                                 DEFINE SYMBOL result_ref_map_ID = ref_map
                                 DEFINE SYMBOL result_ref_map_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_ref_map.png
                                 DEFINE SYMBOL result_ref_map_type = image
                                 DEFINE SYMBOL result_rss_ID = rss
                                 DEFINE SYMBOL result_rss_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E34150E76D7B7804D554BE0AC91A9B27_rss.rss
                                 DEFINE SYMBOL result_rss_type = rss
         GO ($operation_service_action)
 !-> GO Plot_2D
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! $Author: rhs $
! 11/11  ACM consolidate scripts. XY plots needs unique product script;
!            the other 2D directions can all run from a single script
!
! Plot_2d.jnl decides which script to call to make a 2D plot.
!
! Set the gif filename, changing it from .gif to the name from this request
! Set up to write info to the debug log so that FshowGO can be used
GO LAS_initial_setup
! LAS_initial_setup.jnl
!
! Handle initial setup. Write output to the debug file so that FshowGO can be used
! to see the tree of script calls. Reset the name .gif that plot information
! is written to initially until the FRAME command is issued.
!
! IF the job is not going to produce an image, send in argument of 0,
! then this will exit after doing the FshowGO setup.
!
! 10/4/2016 fixes so init scripts still work
 
 
SET MODE VERIFY:ALWAYS
 
DEFINE SYMBOL initialize_script_arg = ($1"2")
 !-> DEFINE SYMBOL initialize_script_arg = 2
 
! Make sure to do the SET REDIRECT just once.
 
IF `($initial_setup_done"0|*>1") NE 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
DEFINE SYMBOL initial_setup_done = 1
 
! Put the output into the log file so that FshowGO will list
! the tree of GO script calls.
SET REDIRECT/APPEND/TEE/file="($result_debug_filename)" STDOUT,STDERR
 !-> SET REDIRECT/APPEND/TEE/file="/usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_debug.txt" STDOUT,STDERR
 
IF `($initialize_script_arg) EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
 
IF ($program_name"0|PyFerret>1|*>0") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! Reset the default gif filename used internally by Ferret.
! This must be done before PPLUS is opened.  Some of the scripts use PPL
! symbol editing, so even before any plot commands are issued, pplus is
! started.
!
! Define the gif filename (preventing collisions of file named ".gif" in multiple sessions)
 
! When a colorbar is also made, the colorbar image overwrites the main plot in
! V6.8. Add characters to the GIFFILE setting here, the correct images will
! be set when the image is saved with FRAME.
 
! Some google earth plots scripts come in without a result image filename.
! Just make up a name here. (A gif file with this name will be written in the
! temp directory.)
IF `($result_plot_image_filename%0|*>1%) EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL gifplot_name = ($result_plot_image_filename)
 !-> DEFINE SYMBOL gifplot_name = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_plot_image.png
IF ($result_colorbar_filename%0|*>1%) THEN \
DEFINE SYMBOL gifplot_name = ($result_plot_image_filename)_($session_pid)
 !-> IF 0 THEN DEFINE SYMBOL gifplot_name = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_plot_image.png_20999
 
IF `(($reset_gifname"0|*>1") EQ 0) AND ($FERRET_VERSION"0") GE 6.721` THEN
 !-> IF 1 THEN
   IF `STRINDEX("($gifplot_name)", "gif") GT 0` THEN
 !-> IF 0 THEN
   ENDIF
ENDIF
 
! Do this again looking for .png
 
IF `(($reset_gifname"0|*>1") EQ 0) AND ($FERRET_VERSION"0") GE 6.721` THEN
 !-> IF 1 THEN
   IF `STRINDEX("($gifplot_name)", "png") GT 0` THEN
 !-> IF 1 THEN
      SET GIFFILE "($gifplot_name).gif"
 !-> SET GIFFILE "/usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/6DC98B0E79A4A508B41D08FE1989CACB_plot_image.png.gif"
      DEFINE SYMBOL reset_gifname = 1
   ENDIF
ENDIF
 
! End of file ------------ LAS_initial_setup.jnl--------------------------
! Exit_GO
 
!! Make a 2d plot...
   go draw_plot_2D
! Enter_GO draw_plot_2D
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! draw_plot_2D.jnl
!
! Author: ansley
! Date: 2006/08/11 16:45:54
! 3/7/2007: ACM. Put code to check that the region was not too small, resulting
!           in degenerate plot into LAS_initialize_data.jnl rather than in the
!           individual plot scripts.
! 3/29/2007 ACM Fix logic interpreting contents of ferret_interpolate_data
! 7/15/2007 ACM Add lines to remove labels when a degenerate 2D plot is made
!               This happens when the region chosen is smaller than a grid cell.
! 3/2008 ACM Use SHADE/TRIM for shade underlays of FILL plots (Ferret v6.1)
!11/2011 ACM Consolidate all except XY plots into a single 2D plot script.
 
! draw_plot_2D.jnl creates a 2D plot for use with the Back End Server
! code that sits behind a Live Access Server (LAS).
 
! Set any Ferret modes
!
 
IF ($ferret_interpolate_data%0|false>0|true>1|1|0|*>1%) THEN SET MODE INTERPOLATE
 !-> IF 0 THEN SET MODE INTERPOLATE
 
DEFINE SYMBOL fview = `UPCASE("($ferret_view)")`
 !-> DEFINE SYMBOL fview = XZ
 
! Define symbols associated with the regign and data and perform any
! initialization needed for this dataset.
 
GO LAS_initialize_region 0
! Enter_GO LAS_initialize_region 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_region.jnl,v $
! $Revision: 1.1 $
!
! $Author: ansley $
! $Date: 2006/07/06 17:54:11 $
!
! The LAS_initialize_region.jnl script defines the following symbols
! based on the region associated with data_#:
!
! region_~_lo/hi   -- lo and hi points on a given axis
! region_~_range   -- numeric range on a given axis
! region_~         -- domain in 'lo:hi' notation
! region_full      -- synonym for 'region_xyzt'
!
! Incoming argument determines which region to use
! The default number is 0, and the default region is region_0.
! If we are making only a map, then there are no data_ symbols
! defined, so data_0_region is not set, but we can define region
! as region_0.
!
! ACM trac 267: Do not cancel any previously set limits or region symbols;
! The previous v6 UI as to how it worked in the old product server expects
! to inherit some or all region info from the first dataset for use by the
! second in comparisons etc. Keep this behavior.
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
DEFINE SYMBOL region_name data_($num)_region
 !-> DEFINE SYMBOL region_name data_0_region
DEFINE SYMBOL region ($($region_name)"region_0")
 !-> DEFINE SYMBOL region region_0
 
! Dont use the data_n_region symbol coming in. The info for the region of each
! variable matches the variable number so that region_0_t_lo is the region for
! data_0_var, etc.
 
DEFINE SYMBOL region region_($num)
 !-> DEFINE SYMBOL region region_0
 
! NOTE:  Occasionally the LAS applet will send in a longitude or latitude
! NOTE:  that looks like "24.400000000000002".  Such long, numerically
! NOTE:  irrelevant numbers can overflow Ferret's maximum symbol length.
! NOTE:  Rounding longitudes and latitudes to the nearest .00001 seems
! NOTE:  reasonable for all but the most detailed datasets.
 
! NOTE:  'region_x_m360' and 'region_x_p360' are used for those visualizations
! NOTE:  where Ferret doesn't auomatically deal with the modulo nature of
! NOTE:  longitude and allow the script writer to deal with this manually.
 
IF ($($region)_x_lo"0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL region_x_lo = `INT(100000 * ($($region)_x_lo)) / 100000`
 !-> DEFINE SYMBOL region_x_lo = 0
  DEFINE SYMBOL region_x_hi = `INT(100000 * ($($region)_x_hi)) / 100000`
 !-> DEFINE SYMBOL region_x_hi = 360
  DEFINE SYMBOL limits_x = ($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL limits_x = 0:360
  DEFINE SYMBOL limits_x_m360 = `($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL limits_x_m360 = -360:0
  DEFINE SYMBOL limits_x_p360 = `($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL limits_x_p360 = 360:720
  DEFINE SYMBOL region_x = X=($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL region_x = X=0:360
  DEFINE SYMBOL region_x_m360 X=`($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL region_x_m360 X=-360:0
  DEFINE SYMBOL region_x_p360 X=`($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL region_x_p360 X=360:720
  IF `($region_x_hi) GE ($region_x_lo)` THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_x_range = `($region_x_hi) - ($region_x_lo)`
 !-> DEFINE SYMBOL region_x_range = 360
  ELSE
  ENDIF
ENDIF
 
IF ($($region)_y_lo"0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL region_y_lo = `INT(1000 * ($($region)_y_lo)) / 1000`
 !-> DEFINE SYMBOL region_y_lo = 0
  DEFINE SYMBOL region_y_hi = `INT(1000 * ($($region)_y_hi)) / 1000`
 !-> DEFINE SYMBOL region_y_hi = 0
  DEFINE SYMBOL limits_y = ($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL limits_y = 0:0
  DEFINE SYMBOL region_y = Y=($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL region_y = Y=0:0
  IF `($region_y_hi) GE ($region_y_lo)` THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_y_range = `($region_y_hi) - ($region_y_lo)`
 !-> DEFINE SYMBOL region_y_range = 0
  ELSE
  ENDIF
ENDIF
 
IF ($($region)_z_lo"0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL region_z_lo = ($($region)_z_lo)
 !-> DEFINE SYMBOL region_z_lo = 0
  DEFINE SYMBOL region_z_hi = ($($region)_z_hi)
 !-> DEFINE SYMBOL region_z_hi = 5000
  DEFINE SYMBOL limits_z = ($region_z_lo):($region_z_hi)
 !-> DEFINE SYMBOL limits_z = 0:5000
  DEFINE SYMBOL region_z = Z=($region_z_lo):($region_z_hi)
 !-> DEFINE SYMBOL region_z = Z=0:5000
  IF `($region_z_hi) GE ($region_z_lo)` THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_z_range = `($region_z_hi) - ($region_z_lo)`
 !-> DEFINE SYMBOL region_z_range = 5000
  ELSE
  ENDIF
ENDIF
IF ($add_region_z"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! NOTE:  Normally we use 'DEFINE SYMBOL ~ = ...'
! NOTE:  For the time axis we use 'DEFINE SYMBOL ~ ...' because the Ferret
! NOTE:  parser complains about unmatched quotes if we do it the other way.
 
IF ($($region)_t_lo"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($add_region_t"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($($region)_e_lo"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($add_region_e"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Now build up all possible multi-axis regions, being careful not to use
! commas when a region is missing
 
! region_xy
IF ($region_x"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_y"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xy = ($region_x),($region_y)
 !-> DEFINE SYMBOL region_xy = X=0:360,Y=0:0
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_xz
IF ($region_x"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_z"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xz = ($region_x),($region_z)
 !-> DEFINE SYMBOL region_xz = X=0:360,Z=0:5000
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_xt
IF ($region_x"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xt = ($region_x)
 !-> DEFINE SYMBOL region_xt = X=0:360
  ENDIF
ELSE
ENDIF
 
! region_yz
IF ($region_y"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_z"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_yz = ($region_y),($region_z)
 !-> DEFINE SYMBOL region_yz = Y=0:0,Z=0:5000
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_yt
IF ($region_y"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_yt = ($region_y)
 !-> DEFINE SYMBOL region_yt = Y=0:0
  ENDIF
ELSE
ENDIF
 
! region_zt
IF ($region_z"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_zt = ($region_z)
 !-> DEFINE SYMBOL region_zt = Z=0:5000
  ENDIF
ELSE
ENDIF
 
! region_xyz
IF ($region_xy"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_z"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xyz = ($region_xy),($region_z)
 !-> DEFINE SYMBOL region_xyz = X=0:360,Y=0:0,Z=0:5000
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_xyt
IF ($region_xy"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xyt = ($region_xy)
 !-> DEFINE SYMBOL region_xyt = X=0:360,Y=0:0
  ENDIF
ELSE
ENDIF
 
! region_xzt
IF ($region_xz"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xzt = ($region_xz)
 !-> DEFINE SYMBOL region_xzt = X=0:360,Z=0:5000
  ENDIF
ELSE
ENDIF
 
! region_yzt
IF ($region_yz"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_yzt = ($region_yz)
 !-> DEFINE SYMBOL region_yzt = Y=0:0,Z=0:5000
  ENDIF
ELSE
ENDIF
 
! region_xyzt
IF ($region_xyz"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xyzt = ($region_xyz)
 !-> DEFINE SYMBOL region_xyzt = X=0:360,Y=0:0,Z=0:5000
  ENDIF
ELSE
ENDIF
 
! There should be more of these but we will add as needed.
 
! region_xyzte
IF ($region_xyzt"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_e"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xyzte = ($region_xyzt)
 !-> DEFINE SYMBOL region_xyzte = X=0:360,Y=0:0,Z=0:5000
  ENDIF
ELSE
ENDIF
 
DEFINE SYMBOL region_full = ($region_xyzte)
 !-> DEFINE SYMBOL region_full = X=0:360,Y=0:0,Z=0:5000
 
 
! For sampling from a curvilinear variable, save the region definitions with
! the variable number.
IF ($region_x"0|*>1") THEN DEFINE SYMBOL region_($num)_x = ($region_x)
 !-> IF 1 THEN DEFINE SYMBOL region_0_x = X=0:360
 !-> DEFINE SYMBOL region_0_x = X=0:360
IF ($region_y"0|*>1") THEN DEFINE SYMBOL region_($num)_y = ($region_y)
 !-> IF 1 THEN DEFINE SYMBOL region_0_y = Y=0:0
 !-> DEFINE SYMBOL region_0_y = Y=0:0
IF ($region_z"0|*>1") THEN DEFINE SYMBOL region_($num)_z = ($region_z)
 !-> IF 1 THEN DEFINE SYMBOL region_0_z = Z=0:5000
 !-> DEFINE SYMBOL region_0_z = Z=0:5000
IF ($region_t"0|*>1") THEN DEFINE SYMBOL region_($num)_t = ($region_t)
 !-> IF 0 THEN DEFINE SYMBOL region_0_t =
IF ($region_xt"0|*>1") THEN DEFINE SYMBOL region_($num)_xt = ($region_xt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xt = X=0:360
 !-> DEFINE SYMBOL region_0_xt = X=0:360
IF ($region_xy"0|*>1") THEN DEFINE SYMBOL region_($num)_xy = ($region_xy)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xy = X=0:360,Y=0:0
 !-> DEFINE SYMBOL region_0_xy = X=0:360,Y=0:0
IF ($region_xz"0|*>1") THEN DEFINE SYMBOL region_($num)_xz = ($region_xz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xz = X=0:360,Z=0:5000
 !-> DEFINE SYMBOL region_0_xz = X=0:360,Z=0:5000
IF ($region_yt"0|*>1") THEN DEFINE SYMBOL region_($num)_yt = ($region_yt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yt = Y=0:0
 !-> DEFINE SYMBOL region_0_yt = Y=0:0
IF ($region_yz"0|*>1") THEN DEFINE SYMBOL region_($num)_yz = ($region_yz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yz = Y=0:0,Z=0:5000
 !-> DEFINE SYMBOL region_0_yz = Y=0:0,Z=0:5000
IF ($region_zt"0|*>1") THEN DEFINE SYMBOL region_($num)_zt = ($region_zt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_zt = Z=0:5000
 !-> DEFINE SYMBOL region_0_zt = Z=0:5000
 
! If time is in units of day, make time symbols w/o the trailing 00:00:00
 
IF ($region_0_t_lo"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($region_0_t_hi"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! If no regions have been defined then we have an error.
 
IF ($region_full"1|*>0")  THEN
 !-> IF 0  THEN
ENDIF
 
! End of LAS_initialize_region.jnl ------------------------------------------------------
! Exit_GO
GO LAS_initialize_data 0
! Enter_GO LAS_initialize_data 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_initialize_data.jnl
!
! Author: ansley manke
! 11/2011
!  4/2013 ACM Implement the Ferret property ferret_start_memory
!
! The LAS_initialize_data.jnl script takes care of everything having to
! do with initializing a datset for later use.
! It calls the specific initialize-data script for the product.
!
! The products that use a specialized data initialization, such as insitu
! data, have already defined this symbol.  If undefined, use the std one.
 
! Allow a Ferret property start_memory to come from the configuration. If
! an init script has a memory setting, then that will supersede the one
! in the Ferret property.
 
IF `($ferret_start_memory"0") GT 0` THEN SET MEM/SIZ=($ferret_start_memory)
 !-> IF 0 THEN SET MEM/SIZ=
 
IF `($data_initialization_script"0|*>1") EQ 0` THEN \
 DEFINE SYMBOL data_initialization_script LAS_initialize_data_std
 !-> IF 1 THEN  DEFINE SYMBOL data_initialization_script LAS_initialize_data_std
 !-> DEFINE SYMBOL data_initialization_script LAS_initialize_data_std
GO ($data_initialization_script) ($1)
 !-> GO LAS_initialize_data_std 0
! Enter_GO LAS_initialize_data_std 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_initialize_data_std.jnl
!
! Author: ansley
!
! The LAS_initialize_data.jnl script takes care of everything having to
! do with initializing a datset for later use.
!
! LAS_initialize_data.jnl takes an argument that specifies which data
! item [0|1|2|3|...] to create symbols for.
!
! 3/2007:
! split up previous version of LAS_initialize_data.jnl into two;
! initialize the dataset and define the plot (or output listing) variable.
! This allows the custom init scripts to call LAS_initialize_dataset, then
! issue commands for the customization, then call LAS_initialize_variable
!
! 8/2007:
! The custom init scripts now consist of only SET DATA and the custom commands.
! This lets F-TDS run first and call the init script to create the data set
! that will be used by the Ferret product script. When F-TDS is done it will
! not send the symbol ferret_init_script to the product scripts so we will just skip
! that step.
!
! 8/2007:
! Some of the custom init scripts previously contained commands like SET MEMORY
! or SET MODE which are intended to be executed by the product script These need
! to be separated from commands for fixing grids or regridding which are executed
! prior to the product script being run by F-TDS. These commands are to be specified
! in the dataset configuration as ferret_init_commands, whose the value is a set
! of Ferret commands separated by semicolons.
!
! 10/4/2016 fixes so init scripts still work
!
GO LAS_initialize_dataset ($1"0")
 !-> GO LAS_initialize_dataset 0
! Enter_GO LAS_initialize_dataset 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_dataset.jnl
 
! This is the first part of LAS_initialize_data.jnl used for standard and
! customized init scripts
 
! $Author: ansley, jing
! $Date: 2007/29/2007
 
! 6/29/2007
! Allow for data_0_units or data_1_units etc to be defined a null string or a
! string containing a single space. If data_0_units is either undefined or is
! one of these blank strings, then use the attnames syntax to see if the dataset
! variable has units defined, and if so define the data_units symbol from that.
 
 
! The LAS_initialize_data.jnl script takes care of everything having to
! do with initializing a datset for later use.
!
! LAS_initialize_data.jnl takes an argument that specifies which data
! item [0|1|2|3|...] to create symbols for.
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
 
 
! Check whether the source data was part of a 'chained' operation.
!ACM note: How does this jibe with what I do below changing data_url to data_num??
 
! Try opening the dataset before doing all the other setup.
 
IF ($data_($num)_chained"0|1|*>1) THEN
 !-> IF 0 THEN
ELSE
  DEFINE SYMBOL data_url \"($data_($num)_url)\"
 !-> DEFINE SYMBOL data_url \"levitus_climatology\"
ENDIF
 
SET DATA ($data_url)
 !-> SET DATA "levitus_climatology"
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! IF it is an F-TDS url, Check for mismatched curvilinear grids or one curvilienar and
! one rectilienar grid.
 
IF `STRINDEX(($data_url), "jnl_expr_") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($num) EQ 0 AND ($data_count) GT 1 and ($check_multi_regions_done"0|*>1) EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! TODO:  It would be nice if the java code removed this dependency upon
! TODO:  whether an operation was 'chained' or not.
 
 
IF ($data_($num)_var"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL data_var ($data_($num)_var)
 !-> DEFINE SYMBOL data_var salt
   DEFINE SYMBOL data_orig_var ($data_($num)_var)
 !-> DEFINE SYMBOL data_orig_var salt
   DEFINE SYMBOL data_var_nq ($data_($num)_var)
 !-> DEFINE SYMBOL data_var_nq salt
ENDIF
 
DEFINE SYMBOL data_name ($data_($num)_name)
 !-> DEFINE SYMBOL data_name SALINITY
IF `($data_($num)_name"0|*>1") EQ 0` THEN DEFINE SYMBOL data_name ($data_var)
 !-> IF 0 THEN DEFINE SYMBOL data_name salt
 
DEFINE SYM var_num ($num)
 !-> DEFINE SYM var_num 0
 
! Put quotes around variable name in case its a Ferret reserved name like Z
! (Apparently addXML now does this automatically, so check for it already being in ' ')
 
IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var = `UPCASE("($data_var)")`
 !-> IF 1 THEN DEFINE SYMBOL data_var = `UPCASE("salt")`
 !-> DEFINE SYMBOL data_var = `UPCASE("salt")`
 !-> DEFINE SYMBOL data_var = SALT
IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var_nq = `UPCASE("($data_var_nq)")`
 !-> IF 1 THEN DEFINE SYMBOL data_var_nq = `UPCASE("salt")`
 !-> DEFINE SYMBOL data_var_nq = `UPCASE("salt")`
 !-> DEFINE SYMBOL data_var_nq = SALT
IF ($data_($num)_var_nq"0|*>1") THEN DEFINE SYMBOL data_var_nq = `UPCASE("($data_var_nq)")`
 !-> IF 0 THEN DEFINE SYMBOL data_var_nq = `UPCASE("SALT")`
 
LET varlen = `STRLEN("($data_var)")`
 !-> DEFINE VARIABLE varlen = 4
IF `STRINDEX("($data_var)", "'") EQ 1 AND STRRINDEX("($data_var)", "'") EQ varlen` THEN
 !-> IF 0 THEN
ELSE
   IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var_nq = ($data_var)
 !-> IF 1 THEN DEFINE SYMBOL data_var_nq = SALT
 !-> DEFINE SYMBOL data_var_nq = SALT
   IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var = '($data_var)'
 !-> IF 1 THEN DEFINE SYMBOL data_var = 'SALT'
 !-> DEFINE SYMBOL data_var = 'SALT'
ENDIF
 
! Do the same for curvilinear coordinate variables if they are defined
IF ($ferret_curvi_coord_lon"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_curvi_coord_lat"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! If the grids werent the same but were reconciled with an add_var, add that.
! The variables must be the same size. Check and set up a nice message if not.
 
IF ($add_to_var($num)"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Use the units passed in from the XML unless they are null;
! in that case try to get from the dataset
 
! Do not define data_units with an empty string
IF `($data_($num)_units%1|"">1|*>0%) OR ($data_($num)_units%1|" ">1|*>0%)`  THEN
 !-> IF 0  THEN
ELIF ($data_($num)_units%1|" ">1|*>0%) THEN
 !-> ELIF 0 THEN
ELSE
   DEFINE SYMBOL data_units ($data_($num)_units)
 !-> DEFINE SYMBOL data_units PPT
ENDIF
 
! Check for single quotes and remove them. They are
! not needed on units strings
 
LET inquote = `STRINDEX("($data_($num)_units)", "'")`
 !-> DEFINE VARIABLE inquote = 0
IF `inquote GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF ($data_units"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL data_units (($data_($num)_units))
 !-> DEFINE SYMBOL data_units (PPT)
     DEFINE SYMBOL data_units ($data_($num)_units)
 !-> IF 0 THEN      DEFINE SYMBOL data_units PPT
ENDIF
 
IF ($data_($num)_name"0|1|*>1) THEN
 !-> IF 1 THEN
   IF ($data_($num)_title"0|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title)
 !-> IF 1 THEN DEFINE SYMBOL data_title SALINITY
 !-> DEFINE SYMBOL data_title SALINITY
ELSE
ENDIF
 
IF `($num) GT 0` THEN DEFINE SYMBOL variable_($num)_lab = ($data_title)
 !-> IF 0 THEN DEFINE SYMBOL variable_0_lab = SALINITY
IF ($data_units"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL units_lab = ($data_units)
 !-> DEFINE SYMBOL units_lab = (PPT)
   IF `($num) GT 0` THEN DEFINE SYMBOL units_($num)_lab = ($data_units)
 !-> IF 0 THEN DEFINE SYMBOL units_0_lab = (PPT)
ENDIF
 
DEFINE SYMBOL ferret_plot_title ($data_title) ($data_units)
 !-> DEFINE SYMBOL ferret_plot_title SALINITY (PPT)
 
! SET DATA and check for errors
 
SET DATA ($data_url)
 !-> SET DATA "levitus_climatology"
 
! Check for units sent in as ""
DEFINE SYMBOL ulen `STRLEN("(data_($num)_units)")`
 !-> DEFINE SYMBOL ulen 14
IF `($ulen) LE 2` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($units_double_quotes"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
   LET ulen = STRLEN ("($data_($num)_units)")
 !-> DEFINE VARIABLE ulen = STRLEN ("PPT")
      DEFINE SYMBOL data_units `SUBSTRING("($data_($num)_units)", 2, ulen-2)`
 !-> IF 0 THEN       DEFINE SYMBOL data_units `SUBSTRING("PPT", 2, ulen-2)`
ENDIF
 
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
SET DATA "($data_($num)_url)"
 !-> SET DATA "levitus_climatology"
DEFINE SYMBOL dset($num) = `($data_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL dset0 = 1
 
! Here do sanity checks on Ferret properties, such as dep_axis_scale
 
GO LAS_check_fer_properties
! Enter_GO LAS_check_fer_properties
! LAS_check_fer_properties.jnl
!
! Author: ansley
! $Date: 2010/10/13
!
! Sanity check on Ferret properties.
! Add to this as needed
!
 
IF ($ferret_dep_axis_scale"0|*>1") THEN
 !-> IF 0 THEN
ENDIF ! Checks on ferret_dep_axis_scale
 
! End of file ------------ LAS_check_fer_properties.jnl-------------------------------
 
! Exit_GO
 
! End of $RCSfile ------------LAS_initialize_dataset.jnl--------------------------
! Exit_GO
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Errors set in initialization of dataset ...
IF ($error_status"0|ERROR>1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_init_script"0|*>1") THEN GO ($ferret_init_script) ($dset($1"0"))
 !-> IF 0 THEN GO   1
 
IF ($ferret_init_commands"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF `($data_var"0|*>1") EQ 0` THEN DEFINE SYMBOL data_var = ($data_($num)_var)
 !-> IF 0 THEN DEFINE SYMBOL data_var = salt
IF `($data_orig_var"0|*>1") EQ 0` THEN DEFINE SYMBOL data_orig_var = ($data_($num)_var)
 !-> IF 0 THEN DEFINE SYMBOL data_orig_var = salt
 
GO LAS_initialize_variable
! Enter_GO LAS_initialize_variable
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_variable.jnl
! $Revision: 1.1
!
! $Author: Ansley, Jing $
! $Date: 2007/29/2007
! ACM 4/2007 apply ferret_expression2 to second plot of comparisons.
! ACM 8/2007 Call LAS_auto_levels to set up auto contour/fill levels.
! 3/2008 ACM Use SHADE/TRIM for shade underlays of FILL plots (Ferret v6.1),
!            so no need to call LAS_define_region_plus_1.jnl
! 10-Jul-2008 ACM Define ferret_x_var, needed for listing data to files
!  3-Jun-2011 ACM Allow configuration to send in ferret_factor and
!             ferret_factor_label to apply factor to variables and to add
!             a nice label to the title/units string.
 
! this is the second part of LAS_initialize_data.jnl
 
! Define the plot variable. For comparison plots, we want to save the dataset number
! for each dataset.
 
 
DEFINE SYMBOL data_num = `($data_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL data_num = 1
DEFINE SYMBOL data_($num)_num = `($data_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL data_0_num = 1
 
! If a factor has been passed in, apply it
IF ($ferret_factor"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! This syntax needs the variable without quotes even if its a reserved name.
LET attlist = ($data_($num)_var).attnames
 !-> DEFINE VARIABLE attlist = salt.attnames
 
IF ($data_var_nq"0|*>1") THEN LET attlist = ($data_var_nq).attnames
 !-> IF 1 THEN LET attlist = SALT.attnames
 !-> LET attlist = SALT.attnames
DEFINE SYMBOL data_var_only = `UPCASE("($data_var)")`
 !-> DEFINE SYMBOL data_var_only = 'SALT'
 
IF ($ferret_bad_flag"0|*>1") THEN SET VAR/BAD=($ferret_bad_flag) ($data_var)
 !-> IF 0 THEN SET VAR/BAD=  'SALT'
 
IF ($ferret_timelab_res"0|*>1") THEN SET MODE CALENDAR:($ferret_timelab_res)
 !-> IF 0 THEN SET MODE CALENDAR:
 
! setup for analysis ops on curvilinear grids
IF `IS_ELEMENT_OF_STR (attlist, "ferret_definition") GT 0 AND\
    ($ferret_curvi_coord_lon"0|*>1")` THEN
 !-> IF 0 THEN
ENDIF
 
! Be sure units and title are defined.
! If units are not defined, try to get units from the data variable.
! If the variable in the file has no units, leave data_units symbol undefined.
 
! data_units should have been defined in LAS_initialize_dataset
 
IF ($data_units"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL has_units = 1
ELSE
ENDIF
 
IF ($check_for_pseudonames"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_factor_label"0|*>1") THEN
 !-> IF 0 THEN
ELIF ($ferret_factor"0|*>1") THEN
 !-> ELIF 0 THEN
ENDIF
 
IF `($data_title"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL ferret_plot_var = ($data_var)[d=($data_num),($region_full)]
 !-> DEFINE SYMBOL ferret_plot_var = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
IF ($analysis_def"0|*>1") THEN  ! analysis_def from curvi data or transform
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL ferret_plot_var_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_var_noregion = 'SALT'[d=1]
IF ($data_var_nq"0|*>1") THEN DEFINE SYMBOL ferret_plot_var_nq_noregion = ($data_var_nq)[d=($data_num)]
 !-> IF 1 THEN DEFINE SYMBOL ferret_plot_var_nq_noregion = SALT[d=1]
 !-> DEFINE SYMBOL ferret_plot_var_nq_noregion = SALT[d=1]
DEFINE SYMBOL ferret_plot_var_($num)_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_var_0_noregion = 'SALT'[d=1]
 
DEFINE SYMBOL ferret_plot_base_var = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_plot_base_var = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
DEFINE SYMBOL ferret_plot_base_var_($num) = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_plot_base_var_0 = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
DEFINE SYMBOL ferret_plot_base_var_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_base_var_noregion = 'SALT'[d=1]
 
! Needed for transform_seasonal, save variable definition without any
! time-region information that may be added, and also with the time region only
 
DEFINE SYMBOL ferret_xyz_var = ($data_var)[d=($data_num),($region_xyz)]
 !-> DEFINE SYMBOL ferret_xyz_var = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
DEFINE SYMBOL ferret_t_var = ($data_var)[d=($data_num),($region_t)]
 !-> DEFINE SYMBOL ferret_t_var = 'SALT'[d=1, ]
 
! ferret_x_var needed for listing data to files
DEFINE SYMBOL ferret_x_var = ($data_var)[d=($data_num),($region_x)]
 !-> DEFINE SYMBOL ferret_x_var = 'SALT'[d=1,X=0:360]
IF `($region_x"0|*>1) EQ 0` THEN DEFINE SYMBOL ferret_x_var = ($data_var)[d=($data_num)]
 !-> IF 0 THEN DEFINE SYMBOL ferret_x_var = 'SALT'[d=1]
 
! Apply any transforms that may have been specified.
GO LAS_transforms ($num)
 !-> GO LAS_transforms 0
! Enter_GO LAS_transforms 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_transforms.jnl
!
! $Author: ansley $
! $Date: 2006/09/27  $
! 2007/3/13 ACM changes for all slices of curvilinear data.
! 4/2007    ACM Apply Ferret symbols for any expression that may have been defined
 
!
! LAS_transforms.jnl applies one or more transforms to $ferret_plot_var
 
! This script is called from LAS_initialize_data after the region and
! data have been initialized.
! Argument is the variable number (0 or 1 if this is a comparison)
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
 
!  Transform to 3-month seasonal averages, with desired centering
IF `($constraint_0_lhs"0|Seasonal_Regridding>1|*>0")` THEN
 !-> IF 0 THEN
ENDIF
 
! Transform to 1-season per year, centered on any month, with season being 1, 3, or 5 months long.
IF `STRINDEX("($constraint_0_lhs"0")", "Season_length") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
! See if the grid is curvilinear in XY, Hybrid Z or both
 
DEFINE SYMBOL do_curvi_xy = 0
DEFINE SYMBOL do_hybrid_z = 0
DEFINE SYMBOL do_curvi_xy_and_hybrid_z = 0
 
GO LAS_get_coords_att
! Enter_GO LAS_get_coords_att
! LAS_get_coords_att.jnl
! If there are no curvilinear coordinates properties for the variable,
! then check for a coordinates attribute. If one exits, check the
! coordinates listed for 2D coordinates having units of degrees
! longitude or latitude, and set the properties accordingly
 
! Fixing ticket 1732 and related issues: if there are coordinates
! attributes, use them.
 
 
! If the configuration has the properties already, use those.
 
IF ($ferret_curvi_coord_lon"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF ($ferret_curvi_coord_lat"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! Get the coordinates attribute for a variable. IF it exists
! then parse it up and see if there are 2D lon and lat coordinate
! variables in the dataset.  IF so, use them.
 
 
LET allvars = ..varnames
LET varatts = ($data_orig_var).attnames
 !-> DEFINE VARIABLE varatts = salt.attnames
 
! Check for a coordinates attribute.
LET has_coord = IS_ELEMENT_OF_STR(varatts, "coordinates")
IF `has_coord EQ 0` THEN exit/script
 !-> IF 1 THEN exit/script
 !-> exit/script
! Exit_GO
 
IF ($ferret_curvi_coord_lat"0|*>1") THEN DEFINE SYMBOL do_curvi_xy = 1
 !-> IF 0 THEN DEFINE SYMBOL do_curvi_xy = 1
IF ($ferret_curvi_coord_lat"0|*>1") THEN DEFINE SYMBOL native_curvilinear_xy = 1
 !-> IF 0 THEN DEFINE SYMBOL native_curvilinear_xy = 1
IF ($ferret_thk_var"0|*>1") THEN  DEFINE SYMBOL do_hybrid_z = 1
 !-> IF 0 THEN  DEFINE SYMBOL do_hybrid_z = 1
IF `($do_curvi_xy) + ($do_hybrid_z) EQ 2` THEN DEFINE SYMBOL do_curvi_xy_and_hybrid_z = 1
 !-> IF 0 THEN DEFINE SYMBOL do_curvi_xy_and_hybrid_z = 1
 
IF ($do_curvi_xy_and_hybrid_z) THEN GO transform_hybrid_z_curvi_xy
 !-> IF 0 THEN GO transform_hybrid_z_curvi_xy
 
! Set up to deal with hybrid-Z data.
IF `($do_hybrid_z) AND ($do_curvi_xy_and_hybrid_z"0") EQ 0` THEN \
   GO transform_hybrid_z.jnl
 !-> IF 0 THEN    GO transform_hybrid_z.jnl
 
! Set up to deal with curvilinear XY data
 
IF ($do_curvi_xy) THEN GO transform_curvi_xy.jnl
 !-> IF 0 THEN GO transform_curvi_xy.jnl
 
! End of $RCSfile ------------LAS_transforms.jnl-------------------------------
 
! Exit_GO
 
! Get any DEFINE VARIABLE analysis definitions
! This renames the data variable, and so redefines the symbol data_var
! and sets up the analysis: e.g. ,z=0:2000@ave
 
! unComment this for testing.
 
IF ($data_0_analysis_label"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
 
! (check for Google Earth plots is inside LAS_set_strides)
IF `($num)+1 EQ ($data_count)` THEN GO LAS_set_strides.jnl
 !-> IF 1 THEN GO LAS_set_strides.jnl
 !-> GO LAS_set_strides.jnl
! Enter_GO LAS_set_strides.jnl
! LAS_set_strides.jnl
! ACM
 
! From the region and the grid we can define striding. Compute strides
! based first on Ferret memory and then if it is a graphics product, on
! pixel size.
! ACM 8/312/2007 Do not issue the SET AXIS/STRIDE= command if the stride is 1
!                This partially works around TRAC #224.
! ACM 3/2008  If the transform-to-1-season per year has been set then do not
!             stride in t
! ACM 4/2008  For descriptor data or for data whose axes are replaced cant
!             do native strides. In these cases set up index strides with
!             a call to LAS_set_strides_nonative
! 10-Jul-2008 ACM  Fixes for Google Earth placemark strides
 
! TODO: When there's going to be a transformation or something, then these
! calculations may not be sufficient. Might be better done by the transform script.
 
 
! Ferret property subsample_t can be set to zero or false and
! prevent subsampling in time.
 
IF `($ferret_subsample_t"1|0|1|true>1|false>0|*>1") EQ 0 AND ($ferret_view"|t>1|T>1|*>0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! If the operation is writing a netCDF file, that is done in chunks. Do not use strides
 
IF `(STRINDEX( "($operation_ID)", "Data_Extract" ) NE 0) AND \
    (STRINDEX( "($result_ferret_listing_type)", "netcdf" ) NE 0)` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! If we are computing auto-levels for an animation, striding is done in that script.
! no need for it here.
 
IF ($its_autolev_animate"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! See LAS_set_strides_curvilinear for first cut on dealing with strides and curvi data.
! If it is a native curvilinear plot then LAS_set_strides_curvilinear has been called.
IF ($ferret_curvi_coord_lat"0|0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! Hybrid Z not dealt with here...
IF ($do_hybrid_z"0|0|1|*>1") THEN  EXIT/SCRIPT
 !-> IF 0 THEN  EXIT/SCRIPT
 
! Property-property plots have their own version of striding
IF ($its_prop_prop_plot"0|0|1|*>1") THEN  EXIT/SCRIPT
 !-> IF 0 THEN  EXIT/SCRIPT
 
 
! ---------------------------------------------------------------------
 
! May be reset later.
LET las_plotvar = ($ferret_plot_var)
 !-> DEFINE VARIABLE las_plotvar = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
 
 ! Determine striding based on the memory allocation
 
DEFINE SYMBOL memsize = ($FERRET_MEMORY"6.4")* 1.e6
 !-> DEFINE SYMBOL memsize = 25.6* 1.e6
 
! Cannot do native striding if this is a descriptor dataset, or if it is
! from a curvilienar dataset but working in the rectilinear portion. In
! this case set up index strides.
 
DEFINE SYMBOL no_native = 0
IF ($data_var_only"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL check_for_des =  `($data_var_only)[d=($data_num)],RETURN=dsetpath`
 !-> DEFINE SYMBOL check_for_des =  /usr/local/ferret/fer_dsets/data/levitus_climatology.cdf
ELSE
ENDIF
 
!IF `($analysis_def"0|*>1") EQ 0` THEN
IF `STRINDEX("($check_for_des)", ".des") GT 0 OR ($no_native_strides_xy"0|*>1")` THEN
 !-> IF 0 THEN
ENDIF
!ENDIF
DEFINE SYMBOL nvars = ($data_count)
 !-> DEFINE SYMBOL nvars = 1
 
! If ($data_count) larger than 1 add the size of the variables.
LET pvar = ($ferret_plot_var)
 !-> DEFINE VARIABLE pvar = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
DEFINE SYMBOL var_size = ($var_size"0") + `pvar,RETURN=size`
 !-> DEFINE SYMBOL var_size = 0 + 7200
 
! The exception to the above is side-by-side plots; each var loaded separately
IF `STRINDEX( "($operation_ID)", "Side" ) NE 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($num)+1 EQ ($nvars)` THEN
 !-> IF 1 THEN
   LET ndims = 0
   LET xsiz = `pvar,RETURN=isize`
 !-> DEFINE VARIABLE xsiz = 360
   IF `xsiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 1 THEN LET ndims = `ndims + 1`
 !-> LET ndims = `ndims + 1`
 !-> DEFINE VARIABLE ndims = 1
   LET ysiz = `pvar,RETURN=jsize`
 !-> DEFINE VARIABLE ysiz = 1
   IF `ysiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 0 THEN LET ndims = `ndims + 1`
   LET zsiz = `pvar,RETURN=ksize`
 !-> DEFINE VARIABLE zsiz = 20
   IF `zsiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 1 THEN LET ndims = `ndims + 1`
 !-> LET ndims = `ndims + 1`
 !-> DEFINE VARIABLE ndims = 2
   LET tsiz = `pvar,RETURN=lsize`
 !-> DEFINE VARIABLE tsiz = 1
   IF `tsiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 0 THEN LET ndims = `ndims + 1`
   LET varsiz = xsiz* ysiz* zsiz* tsiz
   DEFINE SYMBOL stride_for_mem = `INT( 1+ varsiz/(.5*($memsize)) )`
 !-> DEFINE SYMBOL stride_for_mem = 1
   IF `ndims EQ 2` THEN DEFINE SYMBOL stride_for_mem = `INT(($stride_for_mem)^0.5)`
 !-> IF 1 THEN DEFINE SYMBOL stride_for_mem = `INT(1^0.5)`
 !-> DEFINE SYMBOL stride_for_mem = `INT(1^0.5)`
 !-> DEFINE SYMBOL stride_for_mem = 1
   IF `ndims EQ 3` THEN DEFINE SYMBOL stride_for_mem = `INT(($stride_for_mem)^0.33)`
 !-> IF 0 THEN DEFINE SYMBOL stride_for_mem = `INT(1^0.33)`
   IF `ndims EQ 4` THEN DEFINE SYMBOL stride_for_mem = `INT(($stride_for_mem)^0.25)`
 !-> IF 0 THEN DEFINE SYMBOL stride_for_mem = `INT(1^0.25)`
ENDIF
 
! If not a graphics product, apply the strides
IF `STRINDEX( "($operation_ID)", "Grid_for_GE" ) NE 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
IF `STRINDEX( "($operation_ID)", "Plot" ) EQ 0 AND \
    STRINDEX( "($operation_ID)", "zoom" ) EQ 0 AND \
    STRINDEX( "($operation_ID)", "Anim" ) EQ 0 AND \
    STRINDEX( "($operation_ID)", "Grid_for_GE" ) EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! If its a vector plot, let Ferret or a user setting of xskip,yskip decimate the vectors
 
IF `STRINDEX( "($operation_ID)", "vector" ) NE 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
 
 
! ---------------------------------------------------------------------
! Now for graphics or GE products, do striding by pixel size, often larger stride than
! needed to fit in Ferret memory
 
LET maxpix = 600  ! default
IF ($ferret_size"0|0.06667>1|*>0") THEN LET maxpix = 300  ! small
 !-> IF 0 THEN LET maxpix = 300
IF ($ferret_size"0|0.25>1|*>0")    THEN LET maxpix = 500  ! medium
 !-> IF 0    THEN LET maxpix = 500
IF ($ferret_size"0|0.5>1|*>0")     THEN LET maxpix = 600  ! default
 !-> IF 0     THEN LET maxpix = 600
IF ($ferret_size"0|0.8333>1|*>0")  THEN LET maxpix = 700  ! large
 !-> IF 0  THEN LET maxpix = 700
 
IF `STRLEN("($ferret_view)") EQ 1` THEN
 !-> IF 0 THEN
ENDIF
 
!IF `STRINDEX("($operation_ID)", "Anim" ) GT 0` THEN LET maxpix = 50
 
IF `($region_x_range"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
IF `($region_y_range"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
CANCEL SYMBOL no*axis
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=xaxis`
 !-> DEFINE SYMBOL xaxname = XAXLEVITR
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL noxaxis = 1
 !-> IF 0 THEN DEFINE SYMBOL noxaxis = 1
IF `(STRINDEX("($ferret_view)","x") NE 0) AND \
    ($region_x_range"0|0|*>1") AND \
    ($no_native_strides_xy"0|*>1") NE 1 AND \
    ($region_x"0|0|*>1") AND \
    (($noxaxis"0|1|*>1") NE 1)` THEN
 !-> IF 1 THEN
   LET xx = x[gx=($data_var)[d=($data_num)]]
 !-> DEFINE VARIABLE xx = x[gx='SALT'[d=1]]
   LET pixsize = `xx[($region_x)@ngd]`
 !-> DEFINE VARIABLE pixsize = 360
   IF ($ferret_google_plot"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF `pixsize GT maxpix` THEN DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
 !-> IF 0 THEN DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
   DEFINE SYMBOL xstride = `MAX(($xstride"1"), ($stride_for_mem"1"))`
 !-> DEFINE SYMBOL xstride = 1
   GO check_modulo_factor x
! Enter_GO check_modulo_factor x
DEFINE SYMBOL dir = `UPCASE("$1")`
 !-> DEFINE SYMBOL dir = X
IF `($($dir)stride) LE 1` THEN EXIT/SCRIPT
 !-> IF 1 THEN EXIT/SCRIPT
 !-> EXIT/SCRIPT
! Exit_GO
   DEFINE SYMBOL axname = `($data_var)[d=($data_num)],RETURN=xaxis`
 !-> DEFINE SYMBOL axname = XAXLEVITR
   IF `STRINDEX("($axname)", "(") EQ 0` THEN
 !-> IF 1 THEN
      IF `($xstride) GT 1 AND ($axis_stride_($axname)"0") EQ 0` THEN
 !-> IF 0 THEN
      ENDIF
   ENDIF
   IF ($SYMBOL no_region_x_range"0|*>1") THEN CANCEL SYMBOL region_x_range
 !-> IF 0 THEN CANCEL SYMBOL region_x_range
ENDIF
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=yaxis`
 !-> DEFINE SYMBOL xaxname = YAXLEVITR
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL noyaxis = 1
 !-> IF 0 THEN DEFINE SYMBOL noyaxis = 1
IF `(STRINDEX("($ferret_view)","y") NE 0) AND \
    ($region_y_range"0|0|*>1") AND \
    ($no_native_strides_xy"0|*>1") NE 1 AND \
    ($region_y"0|0|*>1") AND \
    (($noyaxis"0|1|*>1") NE 1)` THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=zaxis`
 !-> DEFINE SYMBOL xaxname = ZAXLEVITR
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL nozaxis = 1
 !-> IF 0 THEN DEFINE SYMBOL nozaxis = 1
IF `(STRINDEX("($ferret_view)","z") NE 0) AND \
    ($region_z_range"0|0|*>1") AND \
    ($region_z"0|0|*>1") AND \
    (($nozaxis"0|1|*>1") NE 1)` THEN
 !-> IF 1 THEN
   LET zz = z[gz=($data_var)[d=($data_num)]]
 !-> DEFINE VARIABLE zz = z[gz='SALT'[d=1]]
   LET pixsize = `zz[($region_z)@ngd]`
 !-> DEFINE VARIABLE pixsize = 20
   IF `pixsize GT maxpix` THEN DEFINE SYMBOL zstride = `INT((pixsize/maxpix)+1)`
 !-> IF 0 THEN DEFINE SYMBOL zstride = `INT((pixsize/maxpix)+1)`
   DEFINE SYMBOL zstride = `MAX(($zstride"1"), ($stride_for_mem"1"))`
 !-> DEFINE SYMBOL zstride = 1
   DEFINE SYMBOL axname = `($data_var)[d=($data_num)],RETURN=zaxis`
 !-> DEFINE SYMBOL axname = ZAXLEVITR
   IF `STRINDEX("($axname)", "(") EQ 0` THEN
 !-> IF 1 THEN
      IF `($zstride) GT 1 AND ($axis_stride_($axname)"0") EQ 0` THEN
 !-> IF 0 THEN
      ENDIF
   ENDIF
ENDIF
 
! If this is an animation then the time step is controlled by that. Do not do
! striding in time.
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=taxis`
 !-> DEFINE SYMBOL xaxname = NORMAL
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL notaxis = 1
 !-> IF 1 THEN DEFINE SYMBOL notaxis = 1
 !-> DEFINE SYMBOL notaxis = 1
 
LET trange = STRCMP("($region_t_lo%0%)", "($region_t_hi%1%)")
 !-> DEFINE VARIABLE trange = STRCMP("0", "1")
IF `(STRINDEX("($ferret_view)","t") NE 0) AND \
    ($region_t"0|0|*>1") AND ( ($DO_TRANS_1_SEAS_PER_YEAR"0") EQ 0) AND \
    (trange NE 0 AND STRINDEX("($operation_ID)", "Animation_Frames") EQ 0) AND \
    (($notaxis"0|1|*>1") NE 1)` THEN
 !-> IF 0 THEN
ENDIF
 
! Add a label about the striding at the upper left.
 
LET need_comma = 0
IF `($xstride"0|1>0|*>1") + ($ystride"0|1>0|*>1") + ($zstride"0|1>0|*>1") + ($tstride"0|1>0|*>1") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
! End of $RCSfile ------------LAS_set_strides.jnl--------------------------
 
! Exit_GO
 
! to set non-native strides for dataset 1 on a difference plot.
IF `($no_native_strides_xy"0|*>1") AND ($set_ndx_strides"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! Set up color levels
GO LAS_initialize_var_levels
! Enter_GO LAS_initialize_var_levels
! LAS_initialize_var_levels.jnl
! called by 2D color plot scripts
 
! Mark whether there are contour levels set on first entry.
! Compute automatic open-ended levels.
 
! consolidate here so that all 2D plots use only ferret_fill_levels.
! Allow for config that may have used ferret_contour levels instead or also.
 
IF ($ferret_fill_levels"0|*>1") THEN
 !-> IF 0 THEN
ELSE
   IF ($ferret_contour_levels"0|*>1") THEN DEFINE SYMBOL ferret_fill_levels ($ferret_contour_levels)
 !-> IF 0 THEN DEFINE SYMBOL ferret_fill_levels
ENDIF
 
IF `($data_num) EQ 1` THEN
 !-> IF 1 THEN
   IF ($ferret_fill_levels"0|*>1") THEN DEFINE SYMBOL input_fill_levels = 1
 !-> IF 0 THEN DEFINE SYMBOL input_fill_levels = 1
   IF `STRLEN("($ferret_view)") GE 2` THEN
 !-> IF 1 THEN
      LET do_levels =  `(STRINDEX("($operation_ID)", "Plot") GT 0) OR (STRINDEX("($operation_ID)", "zoom") GT 0) OR  (STRINDEX("($operation_ID)", "poly") GT 0)`
 !-> DEFINE VARIABLE do_levels =  1
      IF `do_levels` THEN GO LAS_auto_levels
 !-> IF 1 THEN GO LAS_auto_levels
 !-> GO LAS_auto_levels
! Enter_GO LAS_auto_levels
LET memsize = 0.5* 1.e6
DEFINE SYMBOL op = `UPCASE("($operation_ID)")`
 !-> DEFINE SYMBOL op = PLOT_2D_ZOOM
IF `STRLEN("($ferret_view)") LT 2` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `STRINDEX("($op)", "VECTOR") GT 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
  STRINDEX ("($op)", "CRUISE_SUMMARY") EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `STRINDEX("($op)", "ANIMATION") GT 0`  THEN EXIT/SCRIPT
 !-> IF 0  THEN EXIT/SCRIPT
IF `($ferret_diff_var"1|*>0") AND STRINDEX("($op)", "COMPARE_PLOT") NE 0` THEN
 !-> IF 0 THEN
ENDIF
IF `($ferret_diff_var"1|*>0") AND ($its_gridded_scattered"0|*>1")` THEN
 !-> IF 0 THEN
ENDIF
IF ($ferret_fill_levels"0|posinteger>1|*>0" ) THEN
 !-> IF 0 THEN
ENDIF
DEFINE SYMBOL ferret_center_levels ($ferret_center_levels"0|1|TRUE>1|*>0")
 !-> DEFINE SYMBOL ferret_center_levels 0
IF ($ferret_fill_levels"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
DEFINE SYMBOL ferret_fill_levels = ($num_fine_levels)v
 !-> DEFINE SYMBOL ferret_fill_levels =  v
      DEFINE SYMBOL ferret_fill_levels = ($num_fine_levels)vc
 !-> IF  0 THEN       DEFINE SYMBOL ferret_fill_levels =  vc
! Exit_GO
   ENDIF
ENDIF
 
! End of file ------------ LAS_initialize_var_levels.jnl--------------------------
 
! Exit_GO
 
! End of $RCSfile ------------LAS_initialize_variable.jnl--------------------------
! Exit_GO
DEFINE SYMBOL variable_($1"0")_lab = ($data_title) ($data_units)
 !-> DEFINE SYMBOL variable_0_lab = SALINITY (PPT)
 
IF `STRINDEX("($variable_($1"0")_lab)", "e=") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($its_prop_prop_plot"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
   IF ($variable_lab"0|*>1") THEN
 !-> IF 0 THEN
   ELSE
      DEFINE SYMBOL variable_lab = ($data_title) ($data_units)
 !-> DEFINE SYMBOL variable_lab = SALINITY (PPT)
   ENDIF
ENDIF
IF `($its_prop_prop_plot"0|*>1")` THEN DEFINE SYMBOL variable_lab = ($data_title) ($data_units)
 !-> IF 0 THEN DEFINE SYMBOL variable_lab = SALINITY (PPT)
 
!sh sym variable_lab
!LET bracket = `STRINDEX("($variable_lab)", "[")`
!IF `bracket EQ 1` THEN DEFINE SYMBOL variable_lab = ($variable_($1"0")_lab)
 
IF `STRLEN("($ferret_view)") GT 1 AND ($its_prop_prop_plot"0|*>1") EQ 0 AND \
($itsa_vector_plot"0|*>1") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT
 !-> IF 1 THEN DEFINE SYMBOL qualifiers =  /KEY=CONT
 !-> DEFINE SYMBOL qualifiers =  /KEY=CONT
 
IF ($ferret_expression"0|*>1") THEN GO LAS_expression
 !-> IF 0 THEN GO LAS_expression
 
! End of $RCSfile ------------LAS_initialize_data.jnl--------------------------
! Exit_GO
 
! And if the configuration or initialization hasn't upped the memory,
! increase it somewhat.
 
IF `($ferret_memory"25.6") LT 100` THEN SET MEM/SIZ=100
 !-> IF 1 THEN SET MEM/SIZ=100
 !-> SET MEM/SIZ=100
 
! If a Ferret property ferret_add_a_note is set, define a note that will
! be added to the annotations box. The note may contain a URL.
 
GO LAS_note_from_property
! Enter_GO LAS_note_from_property
! LAS_note_from_property.jnl
! 2/2017 ACM
!
! Define a note in the annotations box using Ferret properties.
! Include a url if it is specified. IF the letters url are
! part of the note text, substitute the url for url. Otherwise,
! if a URL is given, just use the entire note text in the link.
!
! Call this as part of dataset initialization. If these Ferret properties
! are set, then the annotation is defined:
!
!   ferret_add_a_note   Contains text to be added to the notes in the annotation box.
!   ferret_url_for_note Contains a url, which can be a relative url, docs/Prawler_profiles.html
!                       If ferret_add_a_note is not defined, then ferret_url_for_note is ignored.
!                       The url will be shown in parentheses.
 
IF ($ferret_add_a_note"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
! Exit_GO
 
! End of ------------LAS_initialize_data.jnl--------------------------
! Exit_GO
 
! Check for errors (They often occur during dataset initialization.)
 
IF ($error_status"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Check whether the region is too small to make a 2D plot on this grid.
GO LAS_check_2d_region
! Enter_GO LAS_check_2d_region
! LAS_check_2d_region.jnl
!
! Author: ansley
! $Date: 2007/06/22
! ACM 8/7/2007 - Apply expressions here.
!              - Save symbols with information about too-small regions
!                for use by labels_above_plot.jnl
!              - If this is to be an overlay plot, and region is too small
!                then overlay cant be done. Reset number of datasets to 1.
!
! Check whether the region is too small to make a 2D plot on this grid.
! Call after region and dataset have been initialized for 2D plot.
! Note should be able to do a SHADE plot
 
 
! Change ($data_var)[d=($data_num)] to the_plot_var_noregion
 
CANCEL SYMBOL region_small*
 
LET/D=($data_num) the_plot_var_noregion = ($ferret_plot_var_noregion)
 !-> DEFINE VARIABLE/D=1 the_plot_var_noregion = 'SALT'[d=1]
 
IF ($data_analysis_expr"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! For curvilinear plots, check the Z and T regions
 
IF `($do_curvi_xy"0") OR ($native_curvilinear_xy"0")` THEN
 !-> IF 0 THEN
ENDIF   	
IF `($do_curvi_xy"0") AND ($native_curvilinear_xy"0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `($do_hybrid_z"0") AND ($native_Z_plot"0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `($do_curvi_xy_and_hybrid_z)` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
IF `($do_curvi_xy"0") OR ($do_hybrid_z"0") OR ($do_curvi_xy_and_hybrid_z"0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! If doing a slice of a curvilinear variable then note that RETURN=shape is not
! always correct for these variables
! IF `STRINDEX ("($ferret_plot_var)", "sampled_var") GT 0` THEN EXIT/SCRIPT !(dont exit, test works for some cases)
 
LET/D=($data_num) the_plot_var = ($ferret_plot_var)
 !-> DEFINE VARIABLE/D=1 the_plot_var = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
LOAD the_plot_var
 
DEFINE SYMBOL varshape = `the_plot_var,RETURN=shape`
 !-> DEFINE SYMBOL varshape = XZ
DEFINE SYMBOL viewshape =  `UPCASE("($ferret_view)")`
 !-> DEFINE SYMBOL viewshape =  XZ
 
IF `STRCMP("($varshape)", "POINT") EQ 0` THEN
 !-> IF 0 THEN
ENDIF   ! degenerated to a point.
 
! Requested regions that degenerate to a line.
 
IF `STRLEN("($varshape)") EQ 1` THEN
 !-> IF 0 THEN
ENDIF
 
! Issue error messages if the xyz ranges are 0. Note region_t_range is not defined.
 
IF `($degenerate_2d"0|*>1") EQ 1` THEN
 !-> IF 0 THEN
ENDIF
 
! End of file ------------LAS_check_2d_region.jnl-------------------------------
 
! Exit_GO
 
! Check for errors
IF ($error_status"0|ERROR>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Here is variable 0 and its title
 
DEFINE SYMBOL ferret_var_0 = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_var_0 = 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
DEFINE SYMBOL ferret_title_0 = ($ferret_plot_title"($data_var)")
 !-> DEFINE SYMBOL ferret_title_0 = SALINITY (PPT)
 
! Use Ferret properties to set up the plot qualifiers
 
IF ($ferret_view"0|te>1|*>0") THEN DEFINE SYMBOL ferret_contour_style = raster
 !-> IF 0 THEN DEFINE SYMBOL ferret_contour_style = raster
GO LAS_set_plot_qualifiers
! Enter_GO LAS_set_plot_qualifiers
! LAS_set_plot_qualifiers.jnl
! Use Ferret properties to set plot qualifiers for all plots.
 
! Get the category of the plot: 1D, 2D non-vector, and vector
! plots already have a symbol itsa_vector_plot.
 
! This script should be called BEFORE LAS_open_window.jnl because
! it sets LINECOLORS. The LINECOLORS setting needs a SET WIN to
! take effect.
 
! Do a /TRIM only for color contour plots, not raster plots.
 
IF `STRLEN("($ferret_view)") EQ 1` THEN  DEFINE SYMBOL oneDplot = 1
 !-> IF 0 THEN  DEFINE SYMBOL oneDplot = 1
IF `STRLEN("($ferret_view)") EQ 1 AND ($data_count"1") EQ 1` THEN  DEFINE SYMBOL oneD_1var = 1
 !-> IF 0 THEN  DEFINE SYMBOL oneD_1var = 1
 
IF `STRLEN("($ferret_view)") GT 1 AND ($itsa_vector_plot"0|*>1") EQ 0` THEN \
 DEFINE SYMBOL twoDplot = 1
 !-> IF 1 THEN  DEFINE SYMBOL twoDplot = 1
 !-> DEFINE SYMBOL twoDplot = 1
 
! -------- Options for all plots: key, graticules, axis labels
 
! Option to turn off the plot key
 
IF ($ferret_plot_key"0|0>1|nokey>1|*>0") THEN
 !-> IF 0 THEN
ENDIF
 
! Graticule lines. For 1D plots, make them gray.
 
! TODO:  For time plots, either the configurer or the script might want to turn on
! TODO:  graticules at the small tic marks.  /GRATICULE=(DASH)="small, large"
 
DEFINE SYMBOL nlinecolors = 8
SET MODE LINECOLORS:($nlinecolors)
 !-> SET MODE LINECOLORS:8
PPL COLOR,7,70,70,70     ! gray
PPL COLOR,8,100,100,100  ! white
 
! For time plots, turn on horizontal graticule lines, unless graticules
! have been turned off explicitly. Ignore choice of white - its in the menu
! but useless for line plots.
 
LET has_t = ($fview"0|T>1|*>0")
 !-> DEFINE VARIABLE has_t = 0
IF `STRLEN("($fview)") EQ 2 AND STRINDEX("($fview)", "T") GT 0` THEN LET has_t = 1
 !-> IF 0 THEN LET has_t = 1
 
IF `has_t AND ($ferret_use_graticules"1|none>0|notic>0|white>0|*>1)` THEN
 !-> IF 0 THEN
ENDIF
 
! Otherwise turn them on only if requested
 
! Either none or notic removes graticules from the plot
IF ($ferret_use_graticules"1|none>0|notic>0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL graticuleColor = black
  IF ($ferret_use_graticules"1|default>1|gray>1|*>0") THEN
 !-> IF 1 THEN
     DEFINE SYMBOL graticuleColor = 7
  ELIF ($ferret_use_graticules"0|white>1|*>0") THEN
 !-> ELIF 0 THEN
  ENDIF
  SET MODE GRATICULE:(DASH,COLOR=($graticuleColor))
 !-> SET MODE GRATICULE:(DASH,COLOR=7)
ENDIF
 
! Set up for degrees-minutes-seconds labels on independent variable axis
! If this was not requested, the script just returns.
 
IF ($ferret_deg_min_sec"0|false>0|*>1") THEN GO LAS_set_deg_min_sec.jnl
 !-> IF 0 THEN GO LAS_set_deg_min_sec.jnl
 
! -------- Options for 2D single-variable plots
 
IF ($twoDplot"0|*>1") THEN
 !-> IF 1 THEN
   IF `($FERRET_VERSION"0") GE 6.2` THEN KEYMARK 1  ! annotate plot keys with the min and max
 !-> IF 1 THEN KEYMARK 1
 !-> KEYMARK 1
   IF `($ferret_key_annotate"1") EQ 0` THEN KEYMARK 0  ! override annotation with Ferret property
 !-> IF 0 THEN KEYMARK 0
   IF ($ferret_contour_style"0|contour_lines>1|*>0") THEN
 !-> IF 0 THEN
   ELSE
       DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels)
 !-> IF 1 THEN        DEFINE SYMBOL qualifiers = /KEY=CONT/LEVELS=v
 !-> DEFINE SYMBOL qualifiers = /KEY=CONT/LEVELS=v
   ENDIF
   IF `($ferret_contour_style"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
      DEFINE SYMBOL ferret_contour_style = ($ferret_fill_type"default|raster>raster|shade>raster|fill>default|contour>contour_lines|color_filled_plus_lines|*>default")
 !-> IF 1 THEN      DEFINE SYMBOL ferret_contour_style = default
 !-> DEFINE SYMBOL ferret_contour_style = default
   ENDIF
color_filled_contours>FILL|color_filled_plus_lines>FILL|contour_lines>CONTOUR|raster_plus_lines>SHADE")
 !-> DEFINE SYMBOL plot_type =FILL
   DEFINE SYMBOL shade_underlay = 0
   IF ($plot_type"0|FILL>1|*>0) THEN DEFINE SYMBOL shade_underlay = 1
 !-> IF 1 THEN DEFINE SYMBOL shade_underlay = 1
 !-> DEFINE SYMBOL shade_underlay = 1
   IF `($ferret_google_plot"0") EQ 0` THEN
 !-> IF 1 THEN
           ($shade_underlay"0")` THEN DEFINE SYMBOL shade_qualifiers = ($shade_qualifiers)/TRIM
 !-> IF 1 THEN DEFINE SYMBOL shade_qualifiers =  /TRIM
 !-> DEFINE SYMBOL shade_qualifiers =  /TRIM
   ENDIF
   IF ($shade_underlay"0") THEN DEFINE SYMBOL shade_qualifiers = ($shade_qualifiers)/LEVELS=($ferret_fill_levels)
 !-> IF 1 THEN DEFINE SYMBOL shade_qualifiers = /TRIM/LEVELS=v
 !-> DEFINE SYMBOL shade_qualifiers = /TRIM/LEVELS=v
    ($qualifiers)/PALETTE=($ferret_palette"rainbow|default>rainbow|*>*)
 !-> IF 0 THEN DEFINE SYMBOL qualifiers =     /KEY=CONT/LEVELS=v/PALETTE=rainbow
   IF `($ferret_contour_style"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
   ENDIF
   IF `($ferret_contour_style"0|default>1|raster>1|shade>1|color_filled_contours>1|fill>1|color_filled_plus_lines>1|contour_lines>1|raster_plus_lines>1|*>0") EQ 0` THEN
 !-> IF 0 THEN
   ENDIF
   IF `($ferret_contour_style"0|default>0|raster>0|shade>0|color_filled_contours>0|fill>0|color_filled_plus_lines>1|raster_plus_lines>1|*>0")` THEN
 !-> IF 0 THEN
   ENDIF
   IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT
 !-> IF 0 THEN DEFINE SYMBOL qualifiers = /KEY=CONT/LEVELS=v/KEY=CONT,CENT
ENDIF ! end of options for twoDplot
 
! -------- Options for line styles (Note currently we dont allow setting
!          the color of contour lines, but we could.)
 
! ---------------- Line color for single-line, vector, or contour plots
!                  Do not set a /COLOR qualifier for multi-line plots
!                  Default is blue for line, vector, contour plots.
!                  Line-color is red for difference plots.
!
IF `($line_drawn"0|*>1") EQ 0` THEN \
DEFINE SYMBOL line_drawn = `($oneDplot"0|*>1") OR ($itsa_vector_plot"0|*>1") OR ($plot_type"0|CONTOUR>1|*>0")`
 !-> IF 1 THEN DEFINE SYMBOL line_drawn = `0 OR 0 OR 0`
 !-> DEFINE SYMBOL line_drawn = `0 OR 0 OR 0`
 !-> DEFINE SYMBOL line_drawn = 0
 
 
sh sym ferret_line_color
IF `($line_drawn"0") AND ($itsa_multi_lineplot"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF ! skipped color setting if its a multi-line plot
 
! ---------------- Thickness options for all 1D plots, Vector plots, and Contour plots
!                  Thicknum is used in the key for multi-line plots.
 
IF ($line_drawn) THEN
 !-> IF 0 THEN
ENDIF  ! end of options for plots drawn with lines
 
 
! ---------------- All oneD plots, settings for option to
!                  set dependent-axis scale.
 
IF ($oneDplot"0|*>1") THEN
 !-> IF 0 THEN
ENDIF   ! end of options for oneDplot, dependent axis scale setup
 
! ---------------- sanity check on ferret_trend_line.
 
IF `($ferret_trend_line"0|1|2|*>0") EQ 0` THEN \
   CANCEL SYMBOL ferret_trend_line
 !-> IF 1 THEN    CANCEL SYMBOL ferret_trend_line
 !-> CANCEL SYMBOL ferret_trend_line
 
! ---------------- Settings for XY vector and XY vector difference plots.
 
IF `($itsa_vector_plot"0|*>1") AND ($ferret_view"0|xy>1|*>0")` THEN
 !-> IF 0 THEN
ENDIF  ! end of XY vector plot settings.
 
!  ----------------- End of LAS_set_plot_qualifiers.jnl ------------------------------------
! Exit_GO
 
 
! Open the window, apply size, scale and WMS view options
GO LAS_open_window
! Enter_GO LAS_open_window
! LAS_open_window.jnl
!
! Author: ansley
! Date: 2007/02/12
! 7/2010    ACM updates for V7.2 multi-variable plots
!
! The LAS_open_windw.jnl script takes care of everything having to
! do with starting the window.
!
!  This script should be called AFTER LAS_set_plot_qualifiers.jnl,
!  if the set-qualifiers script is called.
!
! - Open the window with the desired size
! - Issue CANCEL MODE LOGO command
! - If an XY plot and if this has been requested, set the aspect
!   ratio to match the region
! - If no margins (WMS style plot) is requested, set that up,
!   including the /NOYADJUST plot qualifier.
 
 
IF `($set_window_quals"0|*>1") EQ 0` THEN \
 DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5")
 !-> IF 1 THEN  DEFINE SYMBOL set_window_quals =  /SIZE=.8333
 !-> DEFINE SYMBOL set_window_quals =  /SIZE=.8333
CANCEL MODE LOGO
 
 
IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/FONT=verdana
 !-> IF 0 THEN SET TEXT/FONT=verdana
 
IF `($win_aspect"0|*>1") EQ 0` THEN DEFINE SYMBOL win_aspect = 1
 !-> IF 1 THEN DEFINE SYMBOL win_aspect = 1
 !-> DEFINE SYMBOL win_aspect = 1
 
IF `($ferret_view"|xy>1|xyt>1|*>0") AND ($its_prop_prop_plot"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($win_aspect) LT 0.1` THEN DEFINE SYMBOL win_aspect = 0.1
 !-> IF 0 THEN DEFINE SYMBOL win_aspect = 0.1
IF `($win_aspect) GT 10` THEN DEFINE SYMBOL win_aspect = 10
 !-> IF 0 THEN DEFINE SYMBOL win_aspect = 10
IF ($ferret_set_aspect"1|default>1|no>0|yes>1|0|1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = `($win_aspect)`:axis
 !-> IF 0 THEN    DEFINE SYMBOL set_window_quals = /SIZE=.8333/ASPECT = `1`:axis
ENDIF
IF `($win_aspect) GT 100` THEN \
  DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = 1:axis
 !-> IF 0 THEN   DEFINE SYMBOL set_window_quals = /SIZE=.8333/ASPECT = 1:axis
IF `($win_aspect) LT 0.01` THEN \
  DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = 1:axis
 !-> IF 0 THEN   DEFINE SYMBOL set_window_quals = /SIZE=.8333/ASPECT = 1:axis
 
 
! Open the window. For PyFerret, use /OUTLINE to take care of the pesky white-line issue
IF ($program_name"0|PyFerret>1|*>0") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)/OUTLINE=0.7 1
 !-> IF 0 THEN DEFINE SYMBOL set_window_quals = /SIZE=.8333/OUTLINE=0.7 1
 
SET WINDOW($set_window_quals)
 !-> SET WINDOW/SIZE=.8333
 
IF `($ferret_margins"1|0|1|false>0|true>1") EQ 0` THEN
 !-> IF 0 THEN
ELSE
   IF `STRLEN("($ferret_view)") GE 2` THEN
 !-> IF 1 THEN
      DEFINE VIEW/X=0:0.95/Y=0:1 xspace
      SET VIEW xspace
   ELSE
   ENDIF
ENDIF
 
! If the annotations are going to be collected and sent back to LAS for presentation,
! set up the viewport for small margins around the edge.
IF ($ferret_annotations"0|*>1") THEN GO set_full_margins
 !-> IF 1 THEN GO set_full_margins
 !-> GO set_full_margins
! Enter_GO set_full_margins
! Set up for small margins, color key at the top
! full_view2 is for property-property plots to use.
! 10/13 change X=0.06 to X=0.07 throughout. When the vertical
! axis labels need more than 2 digits, we need more space.
! 9/16 Set Y spacing to 0.07 throughout, needed for Time labels using PPLUS
 
! Google Earth plots need no margins. This has already been set up.
IF ($its_GE"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL text_size = ($ferret_text_size"0.09")
 !-> DEFINE SYMBOL text_size = 0.09
 
CAN view
 
LET y_up = 0.92
IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN LET y_up = 0.9
 !-> IF 0 THEN LET y_up = 0.9
 
DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:`y_up` full_view
 !-> DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:0.92 full_view
DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:`y_up` full_view2
 !-> DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:0.92 full_view2
 
! Give prop-prop plots a little more space at the left for labels.
IF ($its_prop_prop_plot"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_thumb"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_view%0|yt>1|zt>1|t>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_view%0|xt>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_view%0|t>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
! Thumbnail plots need bigger axis labels. Make the margins bigger.
IF ($ferret_view%0|x>1|y>1|z>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
SET VIEW full_view
keymark 1
IF `($ferret_key_annotate"1") EQ 0` THEN KEYMARK 0  ! override annotation with Ferret property
 !-> IF 0 THEN KEYMARK 0
 
! Tic marks inside the plot box
PPL TICS,,,,,1,1
 
! Or, make short tics, on the outside of the axes
! PPL TICS,,,,,-1,-1
! PPL TICS .6,.125,.6,.125
 
! No tics as an option
IF ($ferret_use_graticules"0|notic>1|*>0) THEN
 !-> IF 0 THEN
ENDIF
 
PPL AXLSZE ($text_size),($text_size)
 !-> PPL AXLSZE 0.09,0.09
 
!  ----------------- End of set_full_margins.jnl ------------------------------------
! Exit_GO
! Exit_GO
 
! Set the URL label for the first dataset.
GO LAS_url_label 0
! Enter_GO LAS_url_label 0
! LAS_url_label.jnl
 
! Define upper-right labels with the url; the URL is not plotted automatically when the var is
! (the same thing may be done in transform scripts or in differencing setup; that is ok
! 1/2010 fix ticket 745 - immediate-mode expressions where the string contains an = sign
!        trip up the command parsing. Break these definitions into two steps.
 
IF `($n_right_labels"0") EQ 0` THEN DEFINE SYMBOL n_right_labels = 0
 !-> IF 1 THEN DEFINE SYMBOL n_right_labels = 0
 !-> DEFINE SYMBOL n_right_labels = 0
!IF `($data_$1_url"0|*>1") EQ 0` THEN EXIT/SCRIPT
 
 
! Instead of the URL use the dataset name or ID passed in to the
! (addXML gets this from the title attribute from the original dataset
! dataset if that attrib exists)
 
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
 
LET got_dataset_label = 0
 
IF `got_dataset_label EQ 0` THEN
 !-> IF 1 THEN
      DEFINE SYMBOL n_right_labels = `($n_right_labels)+1`
 !-> IF 1 THEN       DEFINE SYMBOL n_right_labels = `0+1`
 !-> DEFINE SYMBOL n_right_labels = `0+1`
 !-> DEFINE SYMBOL n_right_labels = 1
   IF ($data_$1_dataset_id"0|*>1") THEN
 !-> IF 1 THEN
     DEFINE SYMBOL upper_right_($n_right_labels) = DATA SET: ($data_$1_dataset_id)
 !-> DEFINE SYMBOL upper_right_1 = DATA SET: levitus_climatology_cdf
     DEFINE SYMBOL upper_right_text_($n_right_labels) = DATA SET: ($data_$1_dataset_id)
 !-> DEFINE SYMBOL upper_right_text_1 = DATA SET: levitus_climatology_cdf
     LET got_dataset_label = 1
     DEFINE SYMBOL dataset_title_($num)_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_0_lab = DATA SET: levitus_climatology_cdf
     DEFINE SYMBOL dataset_title_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_lab = DATA SET: levitus_climatology_cdf
   ENDIF
   IF ($data_$1_dataset_name"0|*>1") THEN
 !-> IF 1 THEN
     DEFINE SYMBOL upper_right_($n_right_labels) = DATA SET: ($data_$1_dataset_name)
 !-> DEFINE SYMBOL upper_right_1 = DATA SET: Levitus Climatology
     DEFINE SYMBOL upper_right_text_($n_right_labels) = DATA SET: ($data_$1_dataset_name)
 !-> DEFINE SYMBOL upper_right_text_1 = DATA SET: Levitus Climatology
     LET got_dataset_label = 1
     DEFINE SYMBOL dataset_title_($num)_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_0_lab = DATA SET: Levitus Climatology
     DEFINE SYMBOL dataset_title_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_lab = DATA SET: Levitus Climatology
   ENDIF
ENDIF
 
! If we didnt get a label from the above, use the URL
 
IF `got_dataset_label EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! If labels are not going to be on the plots, save the url
 
IF `STRINDEX("($data_$1_dataset_url)","http") NE 0` THEN
 !-> IF 0 THEN
ELSE
   DEFINE SYMBOL dataset_url_($num)_lab = DATA SET: ($data_$1_dataset_url)
 !-> DEFINE SYMBOL dataset_url_0_lab = DATA SET: file:levitus_climatology
ENDIF
 
IF `($num) EQ 0` THEN
 !-> IF 1 THEN
   DEFINE SYMBOL dataset_url_lab = ($dataset_url_($num)_lab)
 !-> DEFINE SYMBOL dataset_url_lab = DATA SET: file:levitus_climatology
   IF `STRINDEX("($dataset_url_lab)", "http") EQ 0` THEN
 !-> IF 1 THEN
     IF ($data_0_ftds_url"0|*>1") THEN DEFINE SYMBOL dataset_url_lab = ($data_0_ftds_url)
 !-> IF 1 THEN DEFINE SYMBOL dataset_url_lab = http://test.nio.org/thredds/dodsC/las/levitus_climatology_cdf/data_levitus_climatology.jnl
 !-> DEFINE SYMBOL dataset_url_lab = http://test.nio.org/thredds/dodsC/las/levitus_climatology_cdf/data_levitus_climatology.jnl
   ENDIF
ENDIF
 
IF `($num) GT 0` THEN
 !-> IF 0 THEN
ELSE
   IF `($dataset_url_0_lab"0|*>1")` THEN DEFINE SYMBOL dataset_url_lab ($dataset_url_0_lab)
 !-> IF 1 THEN DEFINE SYMBOL dataset_url_lab DATA SET: file:levitus_climatology
 !-> DEFINE SYMBOL dataset_url_lab DATA SET: file:levitus_climatology
ENDIF
 
 
 
IF ($data_0_dataset_institution"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
 
! End of $RCSfile ------------LAS_url_label.jnl--------------------------
! Exit_GO
 
 
! If the optional property ferret_points_zt has been set, draw a custom
! plot. That script includes a call to LAS_results, so just exit.
 
IF ($ferret_points_zt"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Make a plot,needed to get the number of levels (SHADE/SET doesnt do it.)
IF `($plot_type"0|CONTOUR>0|*>1") AND ($degenerate_2d"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
IF ($ferret_annotations"0|*>1") THEN
 !-> IF 1 THEN
   SHADE($qualifiers)($shade_qualifiers)/TITLE="($ferret_plot_title)" ($ferret_var_0)
 !-> SHADE/KEY=CONT/LEVELS=v/TRIM/LEVELS=v/TITLE="SALINITY (PPT)" 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
   CANCEL VIEW
   SET VIEW full_view
ENDIF
ENDIF
 
 
! For an ensemble-z plot, make the Z axis in the vertical direction
IF ($ferret_view"0|ze>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/TRANS
 !-> IF 0 THEN DEFINE SYMBOL qualifiers = /KEY=CONT/LEVELS=v/TRANS
 
 
 
! Draw the plot and we are done
 
IF `($data_count"0") EQ 1` THEN
 !-> IF 1 THEN
   DEFINE SYMBOL split_title = ($ferret_plot_title)
 !-> DEFINE SYMBOL split_title = SALINITY (PPT)
   GO LAS_split_title
! Enter_GO LAS_split_title
IF ($ferret_annotations"0|*>1") THEN  EXIT/SCRIPT
 !-> IF 1 THEN  EXIT/SCRIPT
 !-> EXIT/SCRIPT
! Exit_GO
   DEFINE SYMBOL ferret_plot_title = ($split_title)
 !-> DEFINE SYMBOL ferret_plot_title = SALINITY (PPT)
   IF ($shade_underlay) THEN
 !-> IF 1 THEN
      SHADE($qualifiers)($shade_qualifiers)/TITLE="($ferret_plot_title)"/SET ($ferret_var_0)
 !-> SHADE/KEY=CONT/LEVELS=v/TRIM/LEVELS=v/TITLE="SALINITY (PPT)"/SET 'SALT'[d=1,X=0:360,Y=0:0,Z=0:5000]
      GO reset_labels
! Enter_GO reset_labels
IF ($xform_dms"0|*>1") THEN PPL XFOR (($xform_dms))
 !-> IF 0 THEN PPL XFOR ( )
IF ($yform_dms"0|*>1") THEN PPL YFOR (($yform_dms))
 !-> IF 0 THEN PPL YFOR ( )
IF ($axlab_command"0|*>1") THEN PPL ($axlab_command)
 !-> IF 0 THEN PPL
IF ($tnmlab_command"0|*>1") THEN PPL ($tnmlab_command)
 !-> IF 0 THEN PPL
IF ($axtic_command"0|*>1") THEN PPL ($axtic_command)
 !-> IF 0 THEN PPL
IF ($axlen_command"0|*>1") THEN PPL ($axlen_command)
 !-> IF 0 THEN PPL
IF ($axtype_command"0|*>1") THEN PPL ($axtype_command)
 !-> IF 0 THEN PPL
if ($labnum_dset"0|*>1") THEN go unlabel ($labnum_dset)
 !-> if 1 THEN go unlabel 2
 !-> go unlabel 2
! Enter_GO unlabel 2
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 2
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 2,0,0 @AS
set mode/last verify
! Exit_GO
if ($labnum_datitl"0|*>1") THEN go unlabel ($labnum_datitl)
 !-> if 1 THEN go unlabel 3
 !-> go unlabel 3
! Enter_GO unlabel 3
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 3
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 3,0,0 @AS
set mode/last verify
! Exit_GO
if ($labnum_dods"0|*>1") THEN go unlabel ($labnum_dods)
 !-> if 0 THEN go unlabel
IF `STRLEN("($ferret_view)") EQ 2` THEN
 !-> IF 1 THEN
   IF `($ppl$zmin"0") GE 1.e35 AND ($ppl$zmax"0") LE -1.e35` THEN DEFINE SYMBOL nokey = 1
 !-> IF 0 THEN DEFINE SYMBOL nokey = 1
   IF `($nokey"0") EQ 0` THEN
 !-> IF 1 THEN
      PPL SHAKEY 1,,,,,,,,,,1
      IF `($ferret_key_annotate"1") EQ 0` THEN keymark 0
 !-> IF 0 THEN keymark 0
   ENDIF
ENDIF
IF `($data_count"1") EQ 1` THEN
 !-> IF 1 THEN
   IF ($labnum_x"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_y"0|*>1") THEN
 !-> IF 1 THEN
      DEFINE SYMBOL latitude_lab ($lab($labnum_y))
 !-> DEFINE SYMBOL latitude_lab LATITUDE : 0.5S
   ENDIF
   IF ($labnum_z"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_t"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_calend"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_year"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
 !-> REPEAT/RANGE=1:2/NAME=lnum (     DEFINE SYMBOL lnum = `lnum`;     SHOW SYMBOL lab($lnum);     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
!-> REPEAT: LNUM:1
 !-> (     DEFINE SYMBOL lnum = `lnum`;     SHOW SYMBOL lab($lnum);     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
 !-> DEFINE SYMBOL lnum = `lnum`
 !-> DEFINE SYMBOL lnum = 1
 !->      SHOW SYMBOL lab($lnum)
 !-> SHOW SYMBOL lab1
LAB1 = "LATITUDE : 0.5S"
 !->      IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum)
 !-> IF 0 THEN DEFINE SYMBOL labnum_e = 1
!-> REPEAT: LNUM:2
 !-> (     DEFINE SYMBOL lnum = `lnum`;     SHOW SYMBOL lab($lnum);     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
 !-> DEFINE SYMBOL lnum = `lnum`
 !-> DEFINE SYMBOL lnum = 2
 !->      SHOW SYMBOL lab($lnum)
 !-> SHOW SYMBOL lab2
LAB2 = "DATA SET: levitus_climatology"
 !->      IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum)
 !-> IF 0 THEN DEFINE SYMBOL labnum_e = 2
   IF ($labnum_e%0|*>1%) THEN
 !-> IF 0 THEN
   ENDIF
   IF ($ferret_view"0|e>1|*>0") THEN
 !-> IF 0 THEN
   ENDIF
ENDIF
IF ($ferret_annotations"0|*>1") THEN
 !-> IF 1 THEN
   PPL TITLE
   PPL XLAB
   PPL YLAB
   IF ($labnum_x"0|*>1") THEN GO unlabel ($labnum_x)
 !-> IF 0 THEN GO unlabel
   IF ($labnum_y"0|*>1") THEN GO unlabel ($labnum_y)
 !-> IF 1 THEN GO unlabel 1
 !-> GO unlabel 1
! Enter_GO unlabel 1
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 1
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 1,0,0 @AS
set mode/last verify
! Exit_GO
   IF ($labnum_z"0|*>1") THEN GO unlabel ($labnum_z)
 !-> IF 0 THEN GO unlabel
   IF ($labnum_t"0|*>1") THEN GO unlabel ($labnum_t)
 !-> IF 0 THEN GO unlabel
   IF ($labnum_calend"0|*>1") THEN GO unlabel ($labnum_calend)
 !-> IF 0 THEN GO unlabel
   GO unlabel 1  ! Just for good measure
! Enter_GO unlabel 1
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 1
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 1,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 2
! Enter_GO unlabel 2
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 2
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 2,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 3
! Enter_GO unlabel 3
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 3
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 3,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 4
! Enter_GO unlabel 4
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 4
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 4,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 5
! Enter_GO unlabel 5
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 5
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 5,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 6
! Enter_GO unlabel 6
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 6
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 6,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 7
! Enter_GO unlabel 7
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 7
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 7,0,0 @AS
set mode/last verify
! Exit_GO
ENDIF
IF ($ferret_annotations"0|*>1") THEN GO key_at_top
 !-> IF 1 THEN GO key_at_top
 !-> GO key_at_top
! Enter_GO key_at_top
IF ($its_GE"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `($ferret_plot_key"1|0|*>1") EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
DEFINE SYMBOL horizontal_key = 1
LET key_label_size = 0.08
ppl ylab
ppl xlab
let x1 = `($ppl$xorg)+0.8`
 !-> DEFINE VARIABLE x1 = 1.616
let x2 = `($ppl$xorg)+($ppl$xlen)-0.8`
 !-> DEFINE VARIABLE x2 = 9.298
let y1 = `($ppl$yorg)+($ppl$ylen)+0.025`
 !-> DEFINE VARIABLE y1 = 8.121
let y1 = `($ppl$yorg)+($ppl$ylen)+0.04`
 !-> DEFINE VARIABLE y1 = 8.136
let y2 = `y1+0.2`
 !-> DEFINE VARIABLE y2 = 8.336
IF ($custom_dataset"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($ferret_plot_key"0|date_key>1|*>0") THEN
 !-> IF 0 THEN
ELSE
   ppl shakey ,0,`-1*key_label_size`,,,,`x1`,`x2`,`y1`,`y2`
 !-> ppl shakey ,0,-0.08,,,,1.616,9.298,8.136,8.336
ENDIF
! Exit_GO
LET add_urls = 1
IF `STRCMP("($data_0_dataset_name)", "($data_0_dataset_url)") EQ 0` THEN LET add_urls = 0
 !-> IF 0 THEN LET add_urls = 0
DEFINE SYMBOL dataset_title_lab = DATASET: ($data_0_dataset_name)
 !-> DEFINE SYMBOL dataset_title_lab = DATASET: Levitus Climatology
! Exit_GO
      IF ($ferret_view"0|te>1|*>0") THEN
 !-> IF 0 THEN
      ENDIF
      IF ($ferret_view"0|ze>1|*>0") THEN
 !-> IF 0 THEN
      ENDIF
      PPL SHADE
      IF `($LEV_NUM"0") GT 245/2` THEN PPL SHASET RESET
 !-> IF 0 THEN PPL SHASET RESET
      ($plot_type)/NOKEY/($qualifiers)/OVER/NOLAB ($ferret_var_0)
! Exit_GO
! Exit_GO
! Exit_GO
! Exit_GO

 Cached data cleared from memory
Re-defining viewport FULL_VIEW
Re-defining viewport FULL_VIEW2
 **ERROR: command syntax: "/"
CONTOUR/FILL/NOKEY//KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v/OVER/NOLAB 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
Command file, command group, or REPEAT execution aborted
ERROR RUNNING SCRIPT

go "$1"
 !-> go "/usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/WEB-INF/classes/resources/ferret/temp/ferret_operation_359870_1497721597891.jnl"
! Symbols from the server
                        DEFINE SYMBOL data_0_ID = airt
                                 DEFINE SYMBOL data_0_dataset_ID = coads_climatology_cdf
                                 DEFINE SYMBOL data_0_dataset_name = COADS climatology
                                 DEFINE SYMBOL data_0_dataset_url = file:coads_climatology
                                 DEFINE SYMBOL data_0_dsid = coads_climatology_cdf
                                 DEFINE SYMBOL data_0_ftds_url = http://test.nio.org/thredds/dodsC/las/coads_climatology_cdf/data_coads_climatology.jnl
                                 DEFINE SYMBOL data_0_grid_type = regular
                                 DEFINE SYMBOL data_0_intervals = xyt
                                 DEFINE SYMBOL data_0_name = AIR TEMPERATURE
                                 DEFINE SYMBOL data_0_points = xyt
                                 DEFINE SYMBOL data_0_region = region_0
                                 DEFINE SYMBOL data_0_title = AIR TEMPERATURE
                                 DEFINE SYMBOL data_0_units = DEG C
                                 DEFINE SYMBOL data_0_url = coads_climatology
                                 DEFINE SYMBOL data_0_var = airt
                                 DEFINE SYMBOL data_0_xpath = /lasdata/datasets/coads_climatology_cdf/variables/airt
                                 DEFINE SYMBOL data_count = 1
                                 DEFINE SYMBOL ferret_annotations = file
                                 DEFINE SYMBOL ferret_fill_type = fill
                                 DEFINE SYMBOL ferret_image_format = gif
                                 DEFINE SYMBOL ferret_land_type = shade
                                 DEFINE SYMBOL ferret_service_action = Plot_2D
                                 DEFINE SYMBOL ferret_size = .8333
                                 DEFINE SYMBOL ferret_view = xt
                                 DEFINE SYMBOL las_debug = false
                                 DEFINE SYMBOL las_output_type = xml
                                 DEFINE SYMBOL operation_ID = Plot_2D
                                 DEFINE SYMBOL operation_key = E7268BE6C421A176495BB278C5D355EB
                                 DEFINE SYMBOL operation_name = Color plot
                                 DEFINE SYMBOL operation_service = ferret
                                 DEFINE SYMBOL operation_service_action = Plot_2D
                                 DEFINE SYMBOL product_server_clean_age = 168
                                 DEFINE SYMBOL product_server_clean_interval = 24
                                 DEFINE SYMBOL product_server_clean_time = 00:01
                                 DEFINE SYMBOL product_server_clean_units = hour
                                 DEFINE SYMBOL product_server_default_catid = ocean_atlas_subset
                                 DEFINE SYMBOL product_server_default_dsid = ocean_atlas_subset
                                 DEFINE SYMBOL product_server_default_operation = Plot_2D_XY_zoom
                                 DEFINE SYMBOL product_server_default_option = Options_2D_image_contour_xy_7
                                 DEFINE SYMBOL product_server_default_varid = TEMP-ocean_atlas_subset
                                 DEFINE SYMBOL product_server_default_view = xy
                                 DEFINE SYMBOL product_server_ps_timeout = 3600
                                 DEFINE SYMBOL product_server_ui_timeout = 10
                                 DEFINE SYMBOL product_server_use_cache = true
                                 DEFINE SYMBOL product_server_version = 8.4
                                 DEFINE SYMBOL region_0_t_hi = 15-Dec
                                 DEFINE SYMBOL region_0_t_lo = 15-Jan
                                 DEFINE SYMBOL region_0_x_hi = 360
                                 DEFINE SYMBOL region_0_x_lo = 0
                                 DEFINE SYMBOL region_0_y_hi = 0
                                 DEFINE SYMBOL region_0_y_lo = 0
                                 DEFINE SYMBOL result_annotations_ID = annotations
                                 DEFINE SYMBOL result_annotations_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_annotations.xml
                                 DEFINE SYMBOL result_annotations_type = annotations
                                 DEFINE SYMBOL result_cancel_ID = cancel
                                 DEFINE SYMBOL result_cancel_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_cancel.txt
                                 DEFINE SYMBOL result_cancel_type = cancel
                                 DEFINE SYMBOL result_count = 8
                                 DEFINE SYMBOL result_debug_ID = debug
                                 DEFINE SYMBOL result_debug_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_debug.txt
                                 DEFINE SYMBOL result_debug_type = debug
                                 DEFINE SYMBOL result_map_scale_ID = map_scale
                                 DEFINE SYMBOL result_map_scale_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_map_scale.xml
                                 DEFINE SYMBOL result_map_scale_type = map_scale
                                 DEFINE SYMBOL result_plot_image_ID = plot_image
                                 DEFINE SYMBOL result_plot_image_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_plot_image.png
                                 DEFINE SYMBOL result_plot_image_type = image
                                 DEFINE SYMBOL result_ref_map_ID = ref_map
                                 DEFINE SYMBOL result_ref_map_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_ref_map.png
                                 DEFINE SYMBOL result_ref_map_type = image
                                 DEFINE SYMBOL result_rss_ID = rss
                                 DEFINE SYMBOL result_rss_filename = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/9CE5F9256C95B63D290275CAC744D60C_rss.rss
                                 DEFINE SYMBOL result_rss_type = rss
         GO ($operation_service_action)
 !-> GO Plot_2D
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! $Author: rhs $
! 11/11  ACM consolidate scripts. XY plots needs unique product script;
!            the other 2D directions can all run from a single script
!
! Plot_2d.jnl decides which script to call to make a 2D plot.
!
! Set the gif filename, changing it from .gif to the name from this request
! Set up to write info to the debug log so that FshowGO can be used
GO LAS_initial_setup
! LAS_initial_setup.jnl
!
! Handle initial setup. Write output to the debug file so that FshowGO can be used
! to see the tree of script calls. Reset the name .gif that plot information
! is written to initially until the FRAME command is issued.
!
! IF the job is not going to produce an image, send in argument of 0,
! then this will exit after doing the FshowGO setup.
!
! 10/4/2016 fixes so init scripts still work
 
 
SET MODE VERIFY:ALWAYS
 
DEFINE SYMBOL initialize_script_arg = ($1"2")
 !-> DEFINE SYMBOL initialize_script_arg = 2
 
! Make sure to do the SET REDIRECT just once.
 
IF `($initial_setup_done"0|*>1") NE 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
DEFINE SYMBOL initial_setup_done = 1
 
! Put the output into the log file so that FshowGO will list
! the tree of GO script calls.
SET REDIRECT/APPEND/TEE/file="($result_debug_filename)" STDOUT,STDERR
 !-> SET REDIRECT/APPEND/TEE/file="/usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_debug.txt" STDOUT,STDERR
 
IF `($initialize_script_arg) EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
 
IF ($program_name"0|PyFerret>1|*>0") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! Reset the default gif filename used internally by Ferret.
! This must be done before PPLUS is opened.  Some of the scripts use PPL
! symbol editing, so even before any plot commands are issued, pplus is
! started.
!
! Define the gif filename (preventing collisions of file named ".gif" in multiple sessions)
 
! When a colorbar is also made, the colorbar image overwrites the main plot in
! V6.8. Add characters to the GIFFILE setting here, the correct images will
! be set when the image is saved with FRAME.
 
! Some google earth plots scripts come in without a result image filename.
! Just make up a name here. (A gif file with this name will be written in the
! temp directory.)
IF `($result_plot_image_filename%0|*>1%) EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL gifplot_name = ($result_plot_image_filename)
 !-> DEFINE SYMBOL gifplot_name = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_plot_image.png
IF ($result_colorbar_filename%0|*>1%) THEN \
DEFINE SYMBOL gifplot_name = ($result_plot_image_filename)_($session_pid)
 !-> IF 0 THEN DEFINE SYMBOL gifplot_name = /usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_plot_image.png_20587
 
IF `(($reset_gifname"0|*>1") EQ 0) AND ($FERRET_VERSION"0") GE 6.721` THEN
 !-> IF 1 THEN
   IF `STRINDEX("($gifplot_name)", "gif") GT 0` THEN
 !-> IF 0 THEN
   ENDIF
ENDIF
 
! Do this again looking for .png
 
IF `(($reset_gifname"0|*>1") EQ 0) AND ($FERRET_VERSION"0") GE 6.721` THEN
 !-> IF 1 THEN
   IF `STRINDEX("($gifplot_name)", "png") GT 0` THEN
 !-> IF 1 THEN
      SET GIFFILE "($gifplot_name).gif"
 !-> SET GIFFILE "/usr/local/www/html/TOMCAT_DEMO/tomcat/webapps/las/output/E7268BE6C421A176495BB278C5D355EB_plot_image.png.gif"
      DEFINE SYMBOL reset_gifname = 1
   ENDIF
ENDIF
 
! End of file ------------ LAS_initial_setup.jnl--------------------------
! Exit_GO
 
!! Make a 2d plot...
   go draw_plot_2D
! Enter_GO draw_plot_2D
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! draw_plot_2D.jnl
!
! Author: ansley
! Date: 2006/08/11 16:45:54
! 3/7/2007: ACM. Put code to check that the region was not too small, resulting
!           in degenerate plot into LAS_initialize_data.jnl rather than in the
!           individual plot scripts.
! 3/29/2007 ACM Fix logic interpreting contents of ferret_interpolate_data
! 7/15/2007 ACM Add lines to remove labels when a degenerate 2D plot is made
!               This happens when the region chosen is smaller than a grid cell.
! 3/2008 ACM Use SHADE/TRIM for shade underlays of FILL plots (Ferret v6.1)
!11/2011 ACM Consolidate all except XY plots into a single 2D plot script.
 
! draw_plot_2D.jnl creates a 2D plot for use with the Back End Server
! code that sits behind a Live Access Server (LAS).
 
! Set any Ferret modes
!
 
IF ($ferret_interpolate_data%0|false>0|true>1|1|0|*>1%) THEN SET MODE INTERPOLATE
 !-> IF 0 THEN SET MODE INTERPOLATE
 
DEFINE SYMBOL fview = `UPCASE("($ferret_view)")`
 !-> DEFINE SYMBOL fview = XT
 
! Define symbols associated with the regign and data and perform any
! initialization needed for this dataset.
 
GO LAS_initialize_region 0
! Enter_GO LAS_initialize_region 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_region.jnl,v $
! $Revision: 1.1 $
!
! $Author: ansley $
! $Date: 2006/07/06 17:54:11 $
!
! The LAS_initialize_region.jnl script defines the following symbols
! based on the region associated with data_#:
!
! region_~_lo/hi   -- lo and hi points on a given axis
! region_~_range   -- numeric range on a given axis
! region_~         -- domain in 'lo:hi' notation
! region_full      -- synonym for 'region_xyzt'
!
! Incoming argument determines which region to use
! The default number is 0, and the default region is region_0.
! If we are making only a map, then there are no data_ symbols
! defined, so data_0_region is not set, but we can define region
! as region_0.
!
! ACM trac 267: Do not cancel any previously set limits or region symbols;
! The previous v6 UI as to how it worked in the old product server expects
! to inherit some or all region info from the first dataset for use by the
! second in comparisons etc. Keep this behavior.
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
DEFINE SYMBOL region_name data_($num)_region
 !-> DEFINE SYMBOL region_name data_0_region
DEFINE SYMBOL region ($($region_name)"region_0")
 !-> DEFINE SYMBOL region region_0
 
! Dont use the data_n_region symbol coming in. The info for the region of each
! variable matches the variable number so that region_0_t_lo is the region for
! data_0_var, etc.
 
DEFINE SYMBOL region region_($num)
 !-> DEFINE SYMBOL region region_0
 
! NOTE:  Occasionally the LAS applet will send in a longitude or latitude
! NOTE:  that looks like "24.400000000000002".  Such long, numerically
! NOTE:  irrelevant numbers can overflow Ferret's maximum symbol length.
! NOTE:  Rounding longitudes and latitudes to the nearest .00001 seems
! NOTE:  reasonable for all but the most detailed datasets.
 
! NOTE:  'region_x_m360' and 'region_x_p360' are used for those visualizations
! NOTE:  where Ferret doesn't auomatically deal with the modulo nature of
! NOTE:  longitude and allow the script writer to deal with this manually.
 
IF ($($region)_x_lo"0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL region_x_lo = `INT(100000 * ($($region)_x_lo)) / 100000`
 !-> DEFINE SYMBOL region_x_lo = 0
  DEFINE SYMBOL region_x_hi = `INT(100000 * ($($region)_x_hi)) / 100000`
 !-> DEFINE SYMBOL region_x_hi = 360
  DEFINE SYMBOL limits_x = ($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL limits_x = 0:360
  DEFINE SYMBOL limits_x_m360 = `($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL limits_x_m360 = -360:0
  DEFINE SYMBOL limits_x_p360 = `($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL limits_x_p360 = 360:720
  DEFINE SYMBOL region_x = X=($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL region_x = X=0:360
  DEFINE SYMBOL region_x_m360 X=`($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL region_x_m360 X=-360:0
  DEFINE SYMBOL region_x_p360 X=`($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL region_x_p360 X=360:720
  IF `($region_x_hi) GE ($region_x_lo)` THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_x_range = `($region_x_hi) - ($region_x_lo)`
 !-> DEFINE SYMBOL region_x_range = 360
  ELSE
  ENDIF
ENDIF
 
IF ($($region)_y_lo"0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL region_y_lo = `INT(1000 * ($($region)_y_lo)) / 1000`
 !-> DEFINE SYMBOL region_y_lo = 0
  DEFINE SYMBOL region_y_hi = `INT(1000 * ($($region)_y_hi)) / 1000`
 !-> DEFINE SYMBOL region_y_hi = 0
  DEFINE SYMBOL limits_y = ($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL limits_y = 0:0
  DEFINE SYMBOL region_y = Y=($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL region_y = Y=0:0
  IF `($region_y_hi) GE ($region_y_lo)` THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_y_range = `($region_y_hi) - ($region_y_lo)`
 !-> DEFINE SYMBOL region_y_range = 0
  ELSE
  ENDIF
ENDIF
 
IF ($($region)_z_lo"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($add_region_z"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! NOTE:  Normally we use 'DEFINE SYMBOL ~ = ...'
! NOTE:  For the time axis we use 'DEFINE SYMBOL ~ ...' because the Ferret
! NOTE:  parser complains about unmatched quotes if we do it the other way.
 
IF ($($region)_t_lo"0|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL region_t_lo = ($($region)_t_lo)
 !-> DEFINE SYMBOL region_t_lo = 15-Jan
  DEFINE SYMBOL region_t_hi = ($($region)_t_hi)
 !-> DEFINE SYMBOL region_t_hi = 15-Dec
  DEFINE SYMBOL limits_t \"($region_t_lo)\":\"($region_t_hi)\"
 !-> DEFINE SYMBOL limits_t \"15-Jan\":\"15-Dec\"
  DEFINE SYMBOL region_t T=\"($region_t_lo)\":\"($region_t_hi)\"
 !-> DEFINE SYMBOL region_t T=\"15-Jan\":\"15-Dec\"
ENDIF
IF ($add_region_t"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($($region)_e_lo"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($add_region_e"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Now build up all possible multi-axis regions, being careful not to use
! commas when a region is missing
 
! region_xy
IF ($region_x"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_y"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xy = ($region_x),($region_y)
 !-> DEFINE SYMBOL region_xy = X=0:360,Y=0:0
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_xz
IF ($region_x"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_z"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xz = ($region_x)
 !-> DEFINE SYMBOL region_xz = X=0:360
  ENDIF
ELSE
ENDIF
 
! region_xt
IF ($region_x"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xt = ($region_x),($region_t)
 !-> DEFINE SYMBOL region_xt = X=0:360,T="15-Jan":"15-Dec"
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_yz
IF ($region_y"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_z"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_yz = ($region_y)
 !-> DEFINE SYMBOL region_yz = Y=0:0
  ENDIF
ELSE
ENDIF
 
! region_yt
IF ($region_y"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_yt = ($region_y),($region_t)
 !-> DEFINE SYMBOL region_yt = Y=0:0,T="15-Jan":"15-Dec"
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_zt
IF ($region_z"0|*>1") THEN
 !-> IF 0 THEN
ELSE
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_zt = ($region_t)
 !-> DEFINE SYMBOL region_zt = T="15-Jan":"15-Dec"
  ENDIF
ENDIF
 
! region_xyz
IF ($region_xy"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_z"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xyz = ($region_xy)
 !-> DEFINE SYMBOL region_xyz = X=0:360,Y=0:0
  ENDIF
ELSE
ENDIF
 
! region_xyt
IF ($region_xy"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xyt = ($region_xy),($region_t)
 !-> DEFINE SYMBOL region_xyt = X=0:360,Y=0:0,T="15-Jan":"15-Dec"
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_xzt
IF ($region_xz"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xzt = ($region_xz),($region_t)
 !-> DEFINE SYMBOL region_xzt = X=0:360,T="15-Jan":"15-Dec"
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_yzt
IF ($region_yz"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_yzt = ($region_yz),($region_t)
 !-> DEFINE SYMBOL region_yzt = Y=0:0,T="15-Jan":"15-Dec"
  ELSE
  ENDIF
ELSE
ENDIF
 
! region_xyzt
IF ($region_xyz"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_xyzt = ($region_xyz),($region_t)
 !-> DEFINE SYMBOL region_xyzt = X=0:360,Y=0:0,T="15-Jan":"15-Dec"
  ELSE
  ENDIF
ELSE
ENDIF
 
! There should be more of these but we will add as needed.
 
! region_xyzte
IF ($region_xyzt"0|*>1") THEN
 !-> IF 1 THEN
  IF ($region_e"0|*>1") THEN
 !-> IF 0 THEN
  ELSE
    DEFINE SYMBOL region_xyzte = ($region_xyzt)
 !-> DEFINE SYMBOL region_xyzte = X=0:360,Y=0:0,T="15-Jan":"15-Dec"
  ENDIF
ELSE
ENDIF
 
DEFINE SYMBOL region_full = ($region_xyzte)
 !-> DEFINE SYMBOL region_full = X=0:360,Y=0:0,T="15-Jan":"15-Dec"
 
 
! For sampling from a curvilinear variable, save the region definitions with
! the variable number.
IF ($region_x"0|*>1") THEN DEFINE SYMBOL region_($num)_x = ($region_x)
 !-> IF 1 THEN DEFINE SYMBOL region_0_x = X=0:360
 !-> DEFINE SYMBOL region_0_x = X=0:360
IF ($region_y"0|*>1") THEN DEFINE SYMBOL region_($num)_y = ($region_y)
 !-> IF 1 THEN DEFINE SYMBOL region_0_y = Y=0:0
 !-> DEFINE SYMBOL region_0_y = Y=0:0
IF ($region_z"0|*>1") THEN DEFINE SYMBOL region_($num)_z = ($region_z)
 !-> IF 0 THEN DEFINE SYMBOL region_0_z =
IF ($region_t"0|*>1") THEN DEFINE SYMBOL region_($num)_t = ($region_t)
 !-> IF 1 THEN DEFINE SYMBOL region_0_t = T="15-Jan":"15-Dec"
 !-> DEFINE SYMBOL region_0_t = T="15-Jan":"15-Dec"
IF ($region_xt"0|*>1") THEN DEFINE SYMBOL region_($num)_xt = ($region_xt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xt = X=0:360,T="15-Jan":"15-Dec"
 !-> DEFINE SYMBOL region_0_xt = X=0:360,T="15-Jan":"15-Dec"
IF ($region_xy"0|*>1") THEN DEFINE SYMBOL region_($num)_xy = ($region_xy)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xy = X=0:360,Y=0:0
 !-> DEFINE SYMBOL region_0_xy = X=0:360,Y=0:0
IF ($region_xz"0|*>1") THEN DEFINE SYMBOL region_($num)_xz = ($region_xz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xz = X=0:360
 !-> DEFINE SYMBOL region_0_xz = X=0:360
IF ($region_yt"0|*>1") THEN DEFINE SYMBOL region_($num)_yt = ($region_yt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yt = Y=0:0,T="15-Jan":"15-Dec"
 !-> DEFINE SYMBOL region_0_yt = Y=0:0,T="15-Jan":"15-Dec"
IF ($region_yz"0|*>1") THEN DEFINE SYMBOL region_($num)_yz = ($region_yz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yz = Y=0:0
 !-> DEFINE SYMBOL region_0_yz = Y=0:0
IF ($region_zt"0|*>1") THEN DEFINE SYMBOL region_($num)_zt = ($region_zt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_zt = T="15-Jan":"15-Dec"
 !-> DEFINE SYMBOL region_0_zt = T="15-Jan":"15-Dec"
 
! If time is in units of day, make time symbols w/o the trailing 00:00:00
 
IF ($region_0_t_lo"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL t_lab_lo = ($region_0_t_lo)
 !-> DEFINE SYMBOL t_lab_lo = 15-Jan
   LET iz = STRINDEX("($region_0_t_lo)", " 00:00:00")
 !-> DEFINE VARIABLE iz = STRINDEX("15-Jan", " 00:00:00")
   IF `iz GT 0` THEN
 !-> IF 0 THEN
   ELSE
      LET iz = STRINDEX("($region_0_t_lo)", ":00:00")
 !-> DEFINE VARIABLE iz = STRINDEX("15-Jan", ":00:00")
      IF `iz GT 0` THEN DEFINE SYMBOL t_lab_lo = `SUBSTRING("($region_0_t_lo)", 1, iz-1)`
 !-> IF 0 THEN DEFINE SYMBOL t_lab_lo = `SUBSTRING("15-Jan", 1, iz-1)`
   ENDIF
ENDIF
 
IF ($region_0_t_hi"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL t_lab_hi = ($region_0_t_hi)
 !-> DEFINE SYMBOL t_lab_hi = 15-Dec
   LET iz = STRINDEX("($region_0_t_hi)", " 00:00:00")
 !-> DEFINE VARIABLE iz = STRINDEX("15-Dec", " 00:00:00")
   IF `iz GT 0` THEN
 !-> IF 0 THEN
   ELSE
      LET iz = STRINDEX("($region_0_t_hi)", ":00:00")
 !-> DEFINE VARIABLE iz = STRINDEX("15-Dec", ":00:00")
      IF `iz GT 0` THEN DEFINE SYMBOL t_lab_hi = `SUBSTRING("($region_0_t_hi)", 1, iz-1)`
 !-> IF 0 THEN DEFINE SYMBOL t_lab_hi = `SUBSTRING("15-Dec", 1, iz-1)`
   ENDIF
ENDIF
 
! If no regions have been defined then we have an error.
 
IF ($region_full"1|*>0")  THEN
 !-> IF 0  THEN
ENDIF
 
! End of LAS_initialize_region.jnl ------------------------------------------------------
! Exit_GO
GO LAS_initialize_data 0
! Enter_GO LAS_initialize_data 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_initialize_data.jnl
!
! Author: ansley manke
! 11/2011
!  4/2013 ACM Implement the Ferret property ferret_start_memory
!
! The LAS_initialize_data.jnl script takes care of everything having to
! do with initializing a datset for later use.
! It calls the specific initialize-data script for the product.
!
! The products that use a specialized data initialization, such as insitu
! data, have already defined this symbol.  If undefined, use the std one.
 
! Allow a Ferret property start_memory to come from the configuration. If
! an init script has a memory setting, then that will supersede the one
! in the Ferret property.
 
IF `($ferret_start_memory"0") GT 0` THEN SET MEM/SIZ=($ferret_start_memory)
 !-> IF 0 THEN SET MEM/SIZ=
 
IF `($data_initialization_script"0|*>1") EQ 0` THEN \
 DEFINE SYMBOL data_initialization_script LAS_initialize_data_std
 !-> IF 1 THEN  DEFINE SYMBOL data_initialization_script LAS_initialize_data_std
 !-> DEFINE SYMBOL data_initialization_script LAS_initialize_data_std
GO ($data_initialization_script) ($1)
 !-> GO LAS_initialize_data_std 0
! Enter_GO LAS_initialize_data_std 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_initialize_data_std.jnl
!
! Author: ansley
!
! The LAS_initialize_data.jnl script takes care of everything having to
! do with initializing a datset for later use.
!
! LAS_initialize_data.jnl takes an argument that specifies which data
! item [0|1|2|3|...] to create symbols for.
!
! 3/2007:
! split up previous version of LAS_initialize_data.jnl into two;
! initialize the dataset and define the plot (or output listing) variable.
! This allows the custom init scripts to call LAS_initialize_dataset, then
! issue commands for the customization, then call LAS_initialize_variable
!
! 8/2007:
! The custom init scripts now consist of only SET DATA and the custom commands.
! This lets F-TDS run first and call the init script to create the data set
! that will be used by the Ferret product script. When F-TDS is done it will
! not send the symbol ferret_init_script to the product scripts so we will just skip
! that step.
!
! 8/2007:
! Some of the custom init scripts previously contained commands like SET MEMORY
! or SET MODE which are intended to be executed by the product script These need
! to be separated from commands for fixing grids or regridding which are executed
! prior to the product script being run by F-TDS. These commands are to be specified
! in the dataset configuration as ferret_init_commands, whose the value is a set
! of Ferret commands separated by semicolons.
!
! 10/4/2016 fixes so init scripts still work
!
GO LAS_initialize_dataset ($1"0")
 !-> GO LAS_initialize_dataset 0
! Enter_GO LAS_initialize_dataset 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_dataset.jnl
 
! This is the first part of LAS_initialize_data.jnl used for standard and
! customized init scripts
 
! $Author: ansley, jing
! $Date: 2007/29/2007
 
! 6/29/2007
! Allow for data_0_units or data_1_units etc to be defined a null string or a
! string containing a single space. If data_0_units is either undefined or is
! one of these blank strings, then use the attnames syntax to see if the dataset
! variable has units defined, and if so define the data_units symbol from that.
 
 
! The LAS_initialize_data.jnl script takes care of everything having to
! do with initializing a datset for later use.
!
! LAS_initialize_data.jnl takes an argument that specifies which data
! item [0|1|2|3|...] to create symbols for.
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
 
 
! Check whether the source data was part of a 'chained' operation.
!ACM note: How does this jibe with what I do below changing data_url to data_num??
 
! Try opening the dataset before doing all the other setup.
 
IF ($data_($num)_chained"0|1|*>1) THEN
 !-> IF 0 THEN
ELSE
  DEFINE SYMBOL data_url \"($data_($num)_url)\"
 !-> DEFINE SYMBOL data_url \"coads_climatology\"
ENDIF
 
SET DATA ($data_url)
 !-> SET DATA "coads_climatology"
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! IF it is an F-TDS url, Check for mismatched curvilinear grids or one curvilienar and
! one rectilienar grid.
 
IF `STRINDEX(($data_url), "jnl_expr_") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($num) EQ 0 AND ($data_count) GT 1 and ($check_multi_regions_done"0|*>1) EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! TODO:  It would be nice if the java code removed this dependency upon
! TODO:  whether an operation was 'chained' or not.
 
 
IF ($data_($num)_var"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL data_var ($data_($num)_var)
 !-> DEFINE SYMBOL data_var airt
   DEFINE SYMBOL data_orig_var ($data_($num)_var)
 !-> DEFINE SYMBOL data_orig_var airt
   DEFINE SYMBOL data_var_nq ($data_($num)_var)
 !-> DEFINE SYMBOL data_var_nq airt
ENDIF
 
DEFINE SYMBOL data_name ($data_($num)_name)
 !-> DEFINE SYMBOL data_name AIR TEMPERATURE
IF `($data_($num)_name"0|*>1") EQ 0` THEN DEFINE SYMBOL data_name ($data_var)
 !-> IF 0 THEN DEFINE SYMBOL data_name airt
 
DEFINE SYM var_num ($num)
 !-> DEFINE SYM var_num 0
 
! Put quotes around variable name in case its a Ferret reserved name like Z
! (Apparently addXML now does this automatically, so check for it already being in ' ')
 
IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var = `UPCASE("($data_var)")`
 !-> IF 1 THEN DEFINE SYMBOL data_var = `UPCASE("airt")`
 !-> DEFINE SYMBOL data_var = `UPCASE("airt")`
 !-> DEFINE SYMBOL data_var = AIRT
IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var_nq = `UPCASE("($data_var_nq)")`
 !-> IF 1 THEN DEFINE SYMBOL data_var_nq = `UPCASE("airt")`
 !-> DEFINE SYMBOL data_var_nq = `UPCASE("airt")`
 !-> DEFINE SYMBOL data_var_nq = AIRT
IF ($data_($num)_var_nq"0|*>1") THEN DEFINE SYMBOL data_var_nq = `UPCASE("($data_var_nq)")`
 !-> IF 0 THEN DEFINE SYMBOL data_var_nq = `UPCASE("AIRT")`
 
LET varlen = `STRLEN("($data_var)")`
 !-> DEFINE VARIABLE varlen = 4
IF `STRINDEX("($data_var)", "'") EQ 1 AND STRRINDEX("($data_var)", "'") EQ varlen` THEN
 !-> IF 0 THEN
ELSE
   IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var_nq = ($data_var)
 !-> IF 1 THEN DEFINE SYMBOL data_var_nq = AIRT
 !-> DEFINE SYMBOL data_var_nq = AIRT
   IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var = '($data_var)'
 !-> IF 1 THEN DEFINE SYMBOL data_var = 'AIRT'
 !-> DEFINE SYMBOL data_var = 'AIRT'
ENDIF
 
! Do the same for curvilinear coordinate variables if they are defined
IF ($ferret_curvi_coord_lon"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_curvi_coord_lat"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! If the grids werent the same but were reconciled with an add_var, add that.
! The variables must be the same size. Check and set up a nice message if not.
 
IF ($add_to_var($num)"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Use the units passed in from the XML unless they are null;
! in that case try to get from the dataset
 
! Do not define data_units with an empty string
IF `($data_($num)_units%1|"">1|*>0%) OR ($data_($num)_units%1|" ">1|*>0%)`  THEN
 !-> IF 0  THEN
ELIF ($data_($num)_units%1|" ">1|*>0%) THEN
 !-> ELIF 0 THEN
ELSE
   DEFINE SYMBOL data_units ($data_($num)_units)
 !-> DEFINE SYMBOL data_units DEG C
ENDIF
 
! Check for single quotes and remove them. They are
! not needed on units strings
 
LET inquote = `STRINDEX("($data_($num)_units)", "'")`
 !-> DEFINE VARIABLE inquote = 0
IF `inquote GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF ($data_units"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL data_units (($data_($num)_units))
 !-> DEFINE SYMBOL data_units (DEG C)
     DEFINE SYMBOL data_units ($data_($num)_units)
 !-> IF 0 THEN      DEFINE SYMBOL data_units DEG C
ENDIF
 
IF ($data_($num)_name"0|1|*>1) THEN
 !-> IF 1 THEN
   IF ($data_($num)_title"0|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title)
 !-> IF 1 THEN DEFINE SYMBOL data_title AIR TEMPERATURE
 !-> DEFINE SYMBOL data_title AIR TEMPERATURE
ELSE
ENDIF
 
IF `($num) GT 0` THEN DEFINE SYMBOL variable_($num)_lab = ($data_title)
 !-> IF 0 THEN DEFINE SYMBOL variable_0_lab = AIR TEMPERATURE
IF ($data_units"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL units_lab = ($data_units)
 !-> DEFINE SYMBOL units_lab = (DEG C)
   IF `($num) GT 0` THEN DEFINE SYMBOL units_($num)_lab = ($data_units)
 !-> IF 0 THEN DEFINE SYMBOL units_0_lab = (DEG C)
ENDIF
 
DEFINE SYMBOL ferret_plot_title ($data_title) ($data_units)
 !-> DEFINE SYMBOL ferret_plot_title AIR TEMPERATURE (DEG C)
 
! SET DATA and check for errors
 
SET DATA ($data_url)
 !-> SET DATA "coads_climatology"
 
! Check for units sent in as ""
DEFINE SYMBOL ulen `STRLEN("(data_($num)_units)")`
 !-> DEFINE SYMBOL ulen 14
IF `($ulen) LE 2` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($units_double_quotes"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
   LET ulen = STRLEN ("($data_($num)_units)")
 !-> DEFINE VARIABLE ulen = STRLEN ("DEG C")
      DEFINE SYMBOL data_units `SUBSTRING("($data_($num)_units)", 2, ulen-2)`
 !-> IF 0 THEN       DEFINE SYMBOL data_units `SUBSTRING("DEG C", 2, ulen-2)`
ENDIF
 
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
SET DATA "($data_($num)_url)"
 !-> SET DATA "coads_climatology"
DEFINE SYMBOL dset($num) = `($data_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL dset0 = 1
 
! Here do sanity checks on Ferret properties, such as dep_axis_scale
 
GO LAS_check_fer_properties
! Enter_GO LAS_check_fer_properties
! LAS_check_fer_properties.jnl
!
! Author: ansley
! $Date: 2010/10/13
!
! Sanity check on Ferret properties.
! Add to this as needed
!
 
IF ($ferret_dep_axis_scale"0|*>1") THEN
 !-> IF 0 THEN
ENDIF ! Checks on ferret_dep_axis_scale
 
! End of file ------------ LAS_check_fer_properties.jnl-------------------------------
 
! Exit_GO
 
! End of $RCSfile ------------LAS_initialize_dataset.jnl--------------------------
! Exit_GO
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Errors set in initialization of dataset ...
IF ($error_status"0|ERROR>1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_init_script"0|*>1") THEN GO ($ferret_init_script) ($dset($1"0"))
 !-> IF 0 THEN GO   1
 
IF ($ferret_init_commands"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF `($data_var"0|*>1") EQ 0` THEN DEFINE SYMBOL data_var = ($data_($num)_var)
 !-> IF 0 THEN DEFINE SYMBOL data_var = airt
IF `($data_orig_var"0|*>1") EQ 0` THEN DEFINE SYMBOL data_orig_var = ($data_($num)_var)
 !-> IF 0 THEN DEFINE SYMBOL data_orig_var = airt
 
GO LAS_initialize_variable
! Enter_GO LAS_initialize_variable
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_variable.jnl
! $Revision: 1.1
!
! $Author: Ansley, Jing $
! $Date: 2007/29/2007
! ACM 4/2007 apply ferret_expression2 to second plot of comparisons.
! ACM 8/2007 Call LAS_auto_levels to set up auto contour/fill levels.
! 3/2008 ACM Use SHADE/TRIM for shade underlays of FILL plots (Ferret v6.1),
!            so no need to call LAS_define_region_plus_1.jnl
! 10-Jul-2008 ACM Define ferret_x_var, needed for listing data to files
!  3-Jun-2011 ACM Allow configuration to send in ferret_factor and
!             ferret_factor_label to apply factor to variables and to add
!             a nice label to the title/units string.
 
! this is the second part of LAS_initialize_data.jnl
 
! Define the plot variable. For comparison plots, we want to save the dataset number
! for each dataset.
 
 
DEFINE SYMBOL data_num = `($data_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL data_num = 1
DEFINE SYMBOL data_($num)_num = `($data_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL data_0_num = 1
 
! If a factor has been passed in, apply it
IF ($ferret_factor"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! This syntax needs the variable without quotes even if its a reserved name.
LET attlist = ($data_($num)_var).attnames
 !-> DEFINE VARIABLE attlist = airt.attnames
 
IF ($data_var_nq"0|*>1") THEN LET attlist = ($data_var_nq).attnames
 !-> IF 1 THEN LET attlist = AIRT.attnames
 !-> LET attlist = AIRT.attnames
DEFINE SYMBOL data_var_only = `UPCASE("($data_var)")`
 !-> DEFINE SYMBOL data_var_only = 'AIRT'
 
IF ($ferret_bad_flag"0|*>1") THEN SET VAR/BAD=($ferret_bad_flag) ($data_var)
 !-> IF 0 THEN SET VAR/BAD=  'AIRT'
 
IF ($ferret_timelab_res"0|*>1") THEN SET MODE CALENDAR:($ferret_timelab_res)
 !-> IF 0 THEN SET MODE CALENDAR:
 
! setup for analysis ops on curvilinear grids
IF `IS_ELEMENT_OF_STR (attlist, "ferret_definition") GT 0 AND\
    ($ferret_curvi_coord_lon"0|*>1")` THEN
 !-> IF 0 THEN
ENDIF
 
! Be sure units and title are defined.
! If units are not defined, try to get units from the data variable.
! If the variable in the file has no units, leave data_units symbol undefined.
 
! data_units should have been defined in LAS_initialize_dataset
 
IF ($data_units"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL has_units = 1
ELSE
ENDIF
 
IF ($check_for_pseudonames"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_factor_label"0|*>1") THEN
 !-> IF 0 THEN
ELIF ($ferret_factor"0|*>1") THEN
 !-> ELIF 0 THEN
ENDIF
 
IF `($data_title"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL ferret_plot_var = ($data_var)[d=($data_num),($region_full)]
 !-> DEFINE SYMBOL ferret_plot_var = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
IF ($analysis_def"0|*>1") THEN  ! analysis_def from curvi data or transform
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL ferret_plot_var_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_var_noregion = 'AIRT'[d=1]
IF ($data_var_nq"0|*>1") THEN DEFINE SYMBOL ferret_plot_var_nq_noregion = ($data_var_nq)[d=($data_num)]
 !-> IF 1 THEN DEFINE SYMBOL ferret_plot_var_nq_noregion = AIRT[d=1]
 !-> DEFINE SYMBOL ferret_plot_var_nq_noregion = AIRT[d=1]
DEFINE SYMBOL ferret_plot_var_($num)_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_var_0_noregion = 'AIRT'[d=1]
 
DEFINE SYMBOL ferret_plot_base_var = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_plot_base_var = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
DEFINE SYMBOL ferret_plot_base_var_($num) = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_plot_base_var_0 = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
DEFINE SYMBOL ferret_plot_base_var_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_base_var_noregion = 'AIRT'[d=1]
 
! Needed for transform_seasonal, save variable definition without any
! time-region information that may be added, and also with the time region only
 
DEFINE SYMBOL ferret_xyz_var = ($data_var)[d=($data_num),($region_xyz)]
 !-> DEFINE SYMBOL ferret_xyz_var = 'AIRT'[d=1,X=0:360,Y=0:0]
DEFINE SYMBOL ferret_t_var = ($data_var)[d=($data_num),($region_t)]
 !-> DEFINE SYMBOL ferret_t_var = 'AIRT'[d=1,T="15-Jan":"15-Dec"]
 
! ferret_x_var needed for listing data to files
DEFINE SYMBOL ferret_x_var = ($data_var)[d=($data_num),($region_x)]
 !-> DEFINE SYMBOL ferret_x_var = 'AIRT'[d=1,X=0:360]
IF `($region_x"0|*>1) EQ 0` THEN DEFINE SYMBOL ferret_x_var = ($data_var)[d=($data_num)]
 !-> IF 0 THEN DEFINE SYMBOL ferret_x_var = 'AIRT'[d=1]
 
! Apply any transforms that may have been specified.
GO LAS_transforms ($num)
 !-> GO LAS_transforms 0
! Enter_GO LAS_transforms 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_transforms.jnl
!
! $Author: ansley $
! $Date: 2006/09/27  $
! 2007/3/13 ACM changes for all slices of curvilinear data.
! 4/2007    ACM Apply Ferret symbols for any expression that may have been defined
 
!
! LAS_transforms.jnl applies one or more transforms to $ferret_plot_var
 
! This script is called from LAS_initialize_data after the region and
! data have been initialized.
! Argument is the variable number (0 or 1 if this is a comparison)
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
 
!  Transform to 3-month seasonal averages, with desired centering
IF `($constraint_0_lhs"0|Seasonal_Regridding>1|*>0")` THEN
 !-> IF 0 THEN
ENDIF
 
! Transform to 1-season per year, centered on any month, with season being 1, 3, or 5 months long.
IF `STRINDEX("($constraint_0_lhs"0")", "Season_length") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
! See if the grid is curvilinear in XY, Hybrid Z or both
 
DEFINE SYMBOL do_curvi_xy = 0
DEFINE SYMBOL do_hybrid_z = 0
DEFINE SYMBOL do_curvi_xy_and_hybrid_z = 0
 
GO LAS_get_coords_att
! Enter_GO LAS_get_coords_att
! LAS_get_coords_att.jnl
! If there are no curvilinear coordinates properties for the variable,
! then check for a coordinates attribute. If one exits, check the
! coordinates listed for 2D coordinates having units of degrees
! longitude or latitude, and set the properties accordingly
 
! Fixing ticket 1732 and related issues: if there are coordinates
! attributes, use them.
 
 
! If the configuration has the properties already, use those.
 
IF ($ferret_curvi_coord_lon"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF ($ferret_curvi_coord_lat"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! Get the coordinates attribute for a variable. IF it exists
! then parse it up and see if there are 2D lon and lat coordinate
! variables in the dataset.  IF so, use them.
 
 
LET allvars = ..varnames
LET varatts = ($data_orig_var).attnames
 !-> DEFINE VARIABLE varatts = airt.attnames
 
! Check for a coordinates attribute.
LET has_coord = IS_ELEMENT_OF_STR(varatts, "coordinates")
IF `has_coord EQ 0` THEN exit/script
 !-> IF 1 THEN exit/script
 !-> exit/script
! Exit_GO
 
IF ($ferret_curvi_coord_lat"0|*>1") THEN DEFINE SYMBOL do_curvi_xy = 1
 !-> IF 0 THEN DEFINE SYMBOL do_curvi_xy = 1
IF ($ferret_curvi_coord_lat"0|*>1") THEN DEFINE SYMBOL native_curvilinear_xy = 1
 !-> IF 0 THEN DEFINE SYMBOL native_curvilinear_xy = 1
IF ($ferret_thk_var"0|*>1") THEN  DEFINE SYMBOL do_hybrid_z = 1
 !-> IF 0 THEN  DEFINE SYMBOL do_hybrid_z = 1
IF `($do_curvi_xy) + ($do_hybrid_z) EQ 2` THEN DEFINE SYMBOL do_curvi_xy_and_hybrid_z = 1
 !-> IF 0 THEN DEFINE SYMBOL do_curvi_xy_and_hybrid_z = 1
 
IF ($do_curvi_xy_and_hybrid_z) THEN GO transform_hybrid_z_curvi_xy
 !-> IF 0 THEN GO transform_hybrid_z_curvi_xy
 
! Set up to deal with hybrid-Z data.
IF `($do_hybrid_z) AND ($do_curvi_xy_and_hybrid_z"0") EQ 0` THEN \
   GO transform_hybrid_z.jnl
 !-> IF 0 THEN    GO transform_hybrid_z.jnl
 
! Set up to deal with curvilinear XY data
 
IF ($do_curvi_xy) THEN GO transform_curvi_xy.jnl
 !-> IF 0 THEN GO transform_curvi_xy.jnl
 
! End of $RCSfile ------------LAS_transforms.jnl-------------------------------
 
! Exit_GO
 
! Get any DEFINE VARIABLE analysis definitions
! This renames the data variable, and so redefines the symbol data_var
! and sets up the analysis: e.g. ,z=0:2000@ave
 
! unComment this for testing.
 
IF ($data_0_analysis_label"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
 
! (check for Google Earth plots is inside LAS_set_strides)
IF `($num)+1 EQ ($data_count)` THEN GO LAS_set_strides.jnl
 !-> IF 1 THEN GO LAS_set_strides.jnl
 !-> GO LAS_set_strides.jnl
! Enter_GO LAS_set_strides.jnl
! LAS_set_strides.jnl
! ACM
 
! From the region and the grid we can define striding. Compute strides
! based first on Ferret memory and then if it is a graphics product, on
! pixel size.
! ACM 8/312/2007 Do not issue the SET AXIS/STRIDE= command if the stride is 1
!                This partially works around TRAC #224.
! ACM 3/2008  If the transform-to-1-season per year has been set then do not
!             stride in t
! ACM 4/2008  For descriptor data or for data whose axes are replaced cant
!             do native strides. In these cases set up index strides with
!             a call to LAS_set_strides_nonative
! 10-Jul-2008 ACM  Fixes for Google Earth placemark strides
 
! TODO: When there's going to be a transformation or something, then these
! calculations may not be sufficient. Might be better done by the transform script.
 
 
! Ferret property subsample_t can be set to zero or false and
! prevent subsampling in time.
 
IF `($ferret_subsample_t"1|0|1|true>1|false>0|*>1") EQ 0 AND ($ferret_view"|t>1|T>1|*>0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! If the operation is writing a netCDF file, that is done in chunks. Do not use strides
 
IF `(STRINDEX( "($operation_ID)", "Data_Extract" ) NE 0) AND \
    (STRINDEX( "($result_ferret_listing_type)", "netcdf" ) NE 0)` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! If we are computing auto-levels for an animation, striding is done in that script.
! no need for it here.
 
IF ($its_autolev_animate"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! See LAS_set_strides_curvilinear for first cut on dealing with strides and curvi data.
! If it is a native curvilinear plot then LAS_set_strides_curvilinear has been called.
IF ($ferret_curvi_coord_lat"0|0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! Hybrid Z not dealt with here...
IF ($do_hybrid_z"0|0|1|*>1") THEN  EXIT/SCRIPT
 !-> IF 0 THEN  EXIT/SCRIPT
 
! Property-property plots have their own version of striding
IF ($its_prop_prop_plot"0|0|1|*>1") THEN  EXIT/SCRIPT
 !-> IF 0 THEN  EXIT/SCRIPT
 
 
! ---------------------------------------------------------------------
 
! May be reset later.
LET las_plotvar = ($ferret_plot_var)
 !-> DEFINE VARIABLE las_plotvar = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
 
 ! Determine striding based on the memory allocation
 
DEFINE SYMBOL memsize = ($FERRET_MEMORY"6.4")* 1.e6
 !-> DEFINE SYMBOL memsize = 25.6* 1.e6
 
! Cannot do native striding if this is a descriptor dataset, or if it is
! from a curvilienar dataset but working in the rectilinear portion. In
! this case set up index strides.
 
DEFINE SYMBOL no_native = 0
IF ($data_var_only"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL check_for_des =  `($data_var_only)[d=($data_num)],RETURN=dsetpath`
 !-> DEFINE SYMBOL check_for_des =  /usr/local/ferret/fer_dsets/data/coads_climatology.cdf
ELSE
ENDIF
 
!IF `($analysis_def"0|*>1") EQ 0` THEN
IF `STRINDEX("($check_for_des)", ".des") GT 0 OR ($no_native_strides_xy"0|*>1")` THEN
 !-> IF 0 THEN
ENDIF
!ENDIF
DEFINE SYMBOL nvars = ($data_count)
 !-> DEFINE SYMBOL nvars = 1
 
! If ($data_count) larger than 1 add the size of the variables.
LET pvar = ($ferret_plot_var)
 !-> DEFINE VARIABLE pvar = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
DEFINE SYMBOL var_size = ($var_size"0") + `pvar,RETURN=size`
 !-> DEFINE SYMBOL var_size = 0 + 2160
 
! The exception to the above is side-by-side plots; each var loaded separately
IF `STRINDEX( "($operation_ID)", "Side" ) NE 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($num)+1 EQ ($nvars)` THEN
 !-> IF 1 THEN
   LET ndims = 0
   LET xsiz = `pvar,RETURN=isize`
 !-> DEFINE VARIABLE xsiz = 180
   IF `xsiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 1 THEN LET ndims = `ndims + 1`
 !-> LET ndims = `ndims + 1`
 !-> DEFINE VARIABLE ndims = 1
   LET ysiz = `pvar,RETURN=jsize`
 !-> DEFINE VARIABLE ysiz = 1
   IF `ysiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 0 THEN LET ndims = `ndims + 1`
   LET zsiz = `pvar,RETURN=ksize`
 !-> DEFINE VARIABLE zsiz = 1
   IF `zsiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 0 THEN LET ndims = `ndims + 1`
   LET tsiz = `pvar,RETURN=lsize`
 !-> DEFINE VARIABLE tsiz = 12
   IF `tsiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 1 THEN LET ndims = `ndims + 1`
 !-> LET ndims = `ndims + 1`
 !-> DEFINE VARIABLE ndims = 2
   LET varsiz = xsiz* ysiz* zsiz* tsiz
   DEFINE SYMBOL stride_for_mem = `INT( 1+ varsiz/(.5*($memsize)) )`
 !-> DEFINE SYMBOL stride_for_mem = 1
   IF `ndims EQ 2` THEN DEFINE SYMBOL stride_for_mem = `INT(($stride_for_mem)^0.5)`
 !-> IF 1 THEN DEFINE SYMBOL stride_for_mem = `INT(1^0.5)`
 !-> DEFINE SYMBOL stride_for_mem = `INT(1^0.5)`
 !-> DEFINE SYMBOL stride_for_mem = 1
   IF `ndims EQ 3` THEN DEFINE SYMBOL stride_for_mem = `INT(($stride_for_mem)^0.33)`
 !-> IF 0 THEN DEFINE SYMBOL stride_for_mem = `INT(1^0.33)`
   IF `ndims EQ 4` THEN DEFINE SYMBOL stride_for_mem = `INT(($stride_for_mem)^0.25)`
 !-> IF 0 THEN DEFINE SYMBOL stride_for_mem = `INT(1^0.25)`
ENDIF
 
! If not a graphics product, apply the strides
IF `STRINDEX( "($operation_ID)", "Grid_for_GE" ) NE 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
IF `STRINDEX( "($operation_ID)", "Plot" ) EQ 0 AND \
    STRINDEX( "($operation_ID)", "zoom" ) EQ 0 AND \
    STRINDEX( "($operation_ID)", "Anim" ) EQ 0 AND \
    STRINDEX( "($operation_ID)", "Grid_for_GE" ) EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! If its a vector plot, let Ferret or a user setting of xskip,yskip decimate the vectors
 
IF `STRINDEX( "($operation_ID)", "vector" ) NE 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
 
 
! ---------------------------------------------------------------------
! Now for graphics or GE products, do striding by pixel size, often larger stride than
! needed to fit in Ferret memory
 
LET maxpix = 600  ! default
IF ($ferret_size"0|0.06667>1|*>0") THEN LET maxpix = 300  ! small
 !-> IF 0 THEN LET maxpix = 300
IF ($ferret_size"0|0.25>1|*>0")    THEN LET maxpix = 500  ! medium
 !-> IF 0    THEN LET maxpix = 500
IF ($ferret_size"0|0.5>1|*>0")     THEN LET maxpix = 600  ! default
 !-> IF 0     THEN LET maxpix = 600
IF ($ferret_size"0|0.8333>1|*>0")  THEN LET maxpix = 700  ! large
 !-> IF 0  THEN LET maxpix = 700
 
IF `STRLEN("($ferret_view)") EQ 1` THEN
 !-> IF 0 THEN
ENDIF
 
!IF `STRINDEX("($operation_ID)", "Anim" ) GT 0` THEN LET maxpix = 50
 
IF `($region_x_range"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
IF `($region_y_range"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
CANCEL SYMBOL no*axis
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=xaxis`
 !-> DEFINE SYMBOL xaxname = COADSX
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL noxaxis = 1
 !-> IF 0 THEN DEFINE SYMBOL noxaxis = 1
IF `(STRINDEX("($ferret_view)","x") NE 0) AND \
    ($region_x_range"0|0|*>1") AND \
    ($no_native_strides_xy"0|*>1") NE 1 AND \
    ($region_x"0|0|*>1") AND \
    (($noxaxis"0|1|*>1") NE 1)` THEN
 !-> IF 1 THEN
   LET xx = x[gx=($data_var)[d=($data_num)]]
 !-> DEFINE VARIABLE xx = x[gx='AIRT'[d=1]]
   LET pixsize = `xx[($region_x)@ngd]`
 !-> DEFINE VARIABLE pixsize = 180
   IF ($ferret_google_plot"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF `pixsize GT maxpix` THEN DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
 !-> IF 0 THEN DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
   DEFINE SYMBOL xstride = `MAX(($xstride"1"), ($stride_for_mem"1"))`
 !-> DEFINE SYMBOL xstride = 1
   GO check_modulo_factor x
! Enter_GO check_modulo_factor x
DEFINE SYMBOL dir = `UPCASE("$1")`
 !-> DEFINE SYMBOL dir = X
IF `($($dir)stride) LE 1` THEN EXIT/SCRIPT
 !-> IF 1 THEN EXIT/SCRIPT
 !-> EXIT/SCRIPT
! Exit_GO
   DEFINE SYMBOL axname = `($data_var)[d=($data_num)],RETURN=xaxis`
 !-> DEFINE SYMBOL axname = COADSX
   IF `STRINDEX("($axname)", "(") EQ 0` THEN
 !-> IF 1 THEN
      IF `($xstride) GT 1 AND ($axis_stride_($axname)"0") EQ 0` THEN
 !-> IF 0 THEN
      ENDIF
   ENDIF
   IF ($SYMBOL no_region_x_range"0|*>1") THEN CANCEL SYMBOL region_x_range
 !-> IF 0 THEN CANCEL SYMBOL region_x_range
ENDIF
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=yaxis`
 !-> DEFINE SYMBOL xaxname = COADSY
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL noyaxis = 1
 !-> IF 0 THEN DEFINE SYMBOL noyaxis = 1
IF `(STRINDEX("($ferret_view)","y") NE 0) AND \
    ($region_y_range"0|0|*>1") AND \
    ($no_native_strides_xy"0|*>1") NE 1 AND \
    ($region_y"0|0|*>1") AND \
    (($noyaxis"0|1|*>1") NE 1)` THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=zaxis`
 !-> DEFINE SYMBOL xaxname = NORMAL
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL nozaxis = 1
 !-> IF 1 THEN DEFINE SYMBOL nozaxis = 1
 !-> DEFINE SYMBOL nozaxis = 1
IF `(STRINDEX("($ferret_view)","z") NE 0) AND \
    ($region_z_range"0|0|*>1") AND \
    ($region_z"0|0|*>1") AND \
    (($nozaxis"0|1|*>1") NE 1)` THEN
 !-> IF 0 THEN
ENDIF
 
! If this is an animation then the time step is controlled by that. Do not do
! striding in time.
 
DEFINE SYMBOL xaxname = `($data_var),RETURN=taxis`
 !-> DEFINE SYMBOL xaxname = TIME
IF `STRCMP("($xaxname)", "NORMAL") EQ 0` THEN DEFINE SYMBOL notaxis = 1
 !-> IF 0 THEN DEFINE SYMBOL notaxis = 1
 
LET trange = STRCMP("($region_t_lo%0%)", "($region_t_hi%1%)")
 !-> DEFINE VARIABLE trange = STRCMP("15-Jan", "15-Dec")
IF `(STRINDEX("($ferret_view)","t") NE 0) AND \
    ($region_t"0|0|*>1") AND ( ($DO_TRANS_1_SEAS_PER_YEAR"0") EQ 0) AND \
    (trange NE 0 AND STRINDEX("($operation_ID)", "Animation_Frames") EQ 0) AND \
    (($notaxis"0|1|*>1") NE 1)` THEN
 !-> IF 1 THEN
   LET tt = t[gt=($data_var)[d=($data_num)]]
 !-> DEFINE VARIABLE tt = t[gt='AIRT'[d=1]]
   LET pixsize = `tt[($region_t)@ngd]`
 !-> DEFINE VARIABLE pixsize = 12
   DEFINE SYMBOL tstride = `INT((pixsize/maxpix)+1)`
 !-> DEFINE SYMBOL tstride = 1
   DEFINE SYMBOL tstride = `MAX(($tstride"1"), ($stride_for_mem"1"))`
 !-> DEFINE SYMBOL tstride = 1
   GO check_modulo_factor t
! Enter_GO check_modulo_factor t
DEFINE SYMBOL dir = `UPCASE("$1")`
 !-> DEFINE SYMBOL dir = T
IF `($($dir)stride) LE 1` THEN EXIT/SCRIPT
 !-> IF 1 THEN EXIT/SCRIPT
 !-> EXIT/SCRIPT
! Exit_GO
   DEFINE SYMBOL axname = `($data_var)[d=($data_num)],RETURN=taxis`
 !-> DEFINE SYMBOL axname = TIME
   IF `STRINDEX("($axname)", "(") EQ 0` THEN
 !-> IF 1 THEN
      IF `($tstride) GT 1 AND ($axis_stride_($axname)"0") EQ 0` THEN
 !-> IF 0 THEN
      ENDIF
   ENDIF
ENDIF
 
! Add a label about the striding at the upper left.
 
LET need_comma = 0
IF `($xstride"0|1>0|*>1") + ($ystride"0|1>0|*>1") + ($zstride"0|1>0|*>1") + ($tstride"0|1>0|*>1") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
! End of $RCSfile ------------LAS_set_strides.jnl--------------------------
 
! Exit_GO
 
! to set non-native strides for dataset 1 on a difference plot.
IF `($no_native_strides_xy"0|*>1") AND ($set_ndx_strides"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! Set up color levels
GO LAS_initialize_var_levels
! Enter_GO LAS_initialize_var_levels
! LAS_initialize_var_levels.jnl
! called by 2D color plot scripts
 
! Mark whether there are contour levels set on first entry.
! Compute automatic open-ended levels.
 
! consolidate here so that all 2D plots use only ferret_fill_levels.
! Allow for config that may have used ferret_contour levels instead or also.
 
IF ($ferret_fill_levels"0|*>1") THEN
 !-> IF 0 THEN
ELSE
   IF ($ferret_contour_levels"0|*>1") THEN DEFINE SYMBOL ferret_fill_levels ($ferret_contour_levels)
 !-> IF 0 THEN DEFINE SYMBOL ferret_fill_levels
ENDIF
 
IF `($data_num) EQ 1` THEN
 !-> IF 1 THEN
   IF ($ferret_fill_levels"0|*>1") THEN DEFINE SYMBOL input_fill_levels = 1
 !-> IF 0 THEN DEFINE SYMBOL input_fill_levels = 1
   IF `STRLEN("($ferret_view)") GE 2` THEN
 !-> IF 1 THEN
      LET do_levels =  `(STRINDEX("($operation_ID)", "Plot") GT 0) OR (STRINDEX("($operation_ID)", "zoom") GT 0) OR  (STRINDEX("($operation_ID)", "poly") GT 0)`
 !-> DEFINE VARIABLE do_levels =  1
      IF `do_levels` THEN GO LAS_auto_levels
 !-> IF 1 THEN GO LAS_auto_levels
 !-> GO LAS_auto_levels
! Enter_GO LAS_auto_levels
LET memsize = 0.5* 1.e6
DEFINE SYMBOL op = `UPCASE("($operation_ID)")`
 !-> DEFINE SYMBOL op = PLOT_2D
IF `STRLEN("($ferret_view)") LT 2` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `STRINDEX("($op)", "VECTOR") GT 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
  STRINDEX ("($op)", "CRUISE_SUMMARY") EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `STRINDEX("($op)", "ANIMATION") GT 0`  THEN EXIT/SCRIPT
 !-> IF 0  THEN EXIT/SCRIPT
IF `($ferret_diff_var"1|*>0") AND STRINDEX("($op)", "COMPARE_PLOT") NE 0` THEN
 !-> IF 0 THEN
ENDIF
IF `($ferret_diff_var"1|*>0") AND ($its_gridded_scattered"0|*>1")` THEN
 !-> IF 0 THEN
ENDIF
IF ($ferret_fill_levels"0|posinteger>1|*>0" ) THEN
 !-> IF 0 THEN
ENDIF
DEFINE SYMBOL ferret_center_levels ($ferret_center_levels"0|1|TRUE>1|*>0")
 !-> DEFINE SYMBOL ferret_center_levels 0
IF ($ferret_fill_levels"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
DEFINE SYMBOL ferret_fill_levels = ($num_fine_levels)v
 !-> DEFINE SYMBOL ferret_fill_levels =  v
      DEFINE SYMBOL ferret_fill_levels = ($num_fine_levels)vc
 !-> IF  0 THEN       DEFINE SYMBOL ferret_fill_levels =  vc
! Exit_GO
   ENDIF
ENDIF
 
! End of file ------------ LAS_initialize_var_levels.jnl--------------------------
 
! Exit_GO
 
! End of $RCSfile ------------LAS_initialize_variable.jnl--------------------------
! Exit_GO
DEFINE SYMBOL variable_($1"0")_lab = ($data_title) ($data_units)
 !-> DEFINE SYMBOL variable_0_lab = AIR TEMPERATURE (DEG C)
 
IF `STRINDEX("($variable_($1"0")_lab)", "e=") GT 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($its_prop_prop_plot"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
   IF ($variable_lab"0|*>1") THEN
 !-> IF 0 THEN
   ELSE
      DEFINE SYMBOL variable_lab = ($data_title) ($data_units)
 !-> DEFINE SYMBOL variable_lab = AIR TEMPERATURE (DEG C)
   ENDIF
ENDIF
IF `($its_prop_prop_plot"0|*>1")` THEN DEFINE SYMBOL variable_lab = ($data_title) ($data_units)
 !-> IF 0 THEN DEFINE SYMBOL variable_lab = AIR TEMPERATURE (DEG C)
 
!sh sym variable_lab
!LET bracket = `STRINDEX("($variable_lab)", "[")`
!IF `bracket EQ 1` THEN DEFINE SYMBOL variable_lab = ($variable_($1"0")_lab)
 
IF `STRLEN("($ferret_view)") GT 1 AND ($its_prop_prop_plot"0|*>1") EQ 0 AND \
($itsa_vector_plot"0|*>1") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT
 !-> IF 1 THEN DEFINE SYMBOL qualifiers =  /KEY=CONT
 !-> DEFINE SYMBOL qualifiers =  /KEY=CONT
 
IF ($ferret_expression"0|*>1") THEN GO LAS_expression
 !-> IF 0 THEN GO LAS_expression
 
! End of $RCSfile ------------LAS_initialize_data.jnl--------------------------
! Exit_GO
 
! And if the configuration or initialization hasn't upped the memory,
! increase it somewhat.
 
IF `($ferret_memory"25.6") LT 100` THEN SET MEM/SIZ=100
 !-> IF 1 THEN SET MEM/SIZ=100
 !-> SET MEM/SIZ=100
 
! If a Ferret property ferret_add_a_note is set, define a note that will
! be added to the annotations box. The note may contain a URL.
 
GO LAS_note_from_property
! Enter_GO LAS_note_from_property
! LAS_note_from_property.jnl
! 2/2017 ACM
!
! Define a note in the annotations box using Ferret properties.
! Include a url if it is specified. IF the letters url are
! part of the note text, substitute the url for url. Otherwise,
! if a URL is given, just use the entire note text in the link.
!
! Call this as part of dataset initialization. If these Ferret properties
! are set, then the annotation is defined:
!
!   ferret_add_a_note   Contains text to be added to the notes in the annotation box.
!   ferret_url_for_note Contains a url, which can be a relative url, docs/Prawler_profiles.html
!                       If ferret_add_a_note is not defined, then ferret_url_for_note is ignored.
!                       The url will be shown in parentheses.
 
IF ($ferret_add_a_note"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
! Exit_GO
 
! End of ------------LAS_initialize_data.jnl--------------------------
! Exit_GO
 
! Check for errors (They often occur during dataset initialization.)
 
IF ($error_status"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Check whether the region is too small to make a 2D plot on this grid.
GO LAS_check_2d_region
! Enter_GO LAS_check_2d_region
! LAS_check_2d_region.jnl
!
! Author: ansley
! $Date: 2007/06/22
! ACM 8/7/2007 - Apply expressions here.
!              - Save symbols with information about too-small regions
!                for use by labels_above_plot.jnl
!              - If this is to be an overlay plot, and region is too small
!                then overlay cant be done. Reset number of datasets to 1.
!
! Check whether the region is too small to make a 2D plot on this grid.
! Call after region and dataset have been initialized for 2D plot.
! Note should be able to do a SHADE plot
 
 
! Change ($data_var)[d=($data_num)] to the_plot_var_noregion
 
CANCEL SYMBOL region_small*
 
LET/D=($data_num) the_plot_var_noregion = ($ferret_plot_var_noregion)
 !-> DEFINE VARIABLE/D=1 the_plot_var_noregion = 'AIRT'[d=1]
 
IF ($data_analysis_expr"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! For curvilinear plots, check the Z and T regions
 
IF `($do_curvi_xy"0") OR ($native_curvilinear_xy"0")` THEN
 !-> IF 0 THEN
ENDIF   	
IF `($do_curvi_xy"0") AND ($native_curvilinear_xy"0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `($do_hybrid_z"0") AND ($native_Z_plot"0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `($do_curvi_xy_and_hybrid_z)` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
IF `($do_curvi_xy"0") OR ($do_hybrid_z"0") OR ($do_curvi_xy_and_hybrid_z"0")` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! If doing a slice of a curvilinear variable then note that RETURN=shape is not
! always correct for these variables
! IF `STRINDEX ("($ferret_plot_var)", "sampled_var") GT 0` THEN EXIT/SCRIPT !(dont exit, test works for some cases)
 
LET/D=($data_num) the_plot_var = ($ferret_plot_var)
 !-> DEFINE VARIABLE/D=1 the_plot_var = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
LOAD the_plot_var
 
DEFINE SYMBOL varshape = `the_plot_var,RETURN=shape`
 !-> DEFINE SYMBOL varshape = XT
DEFINE SYMBOL viewshape =  `UPCASE("($ferret_view)")`
 !-> DEFINE SYMBOL viewshape =  XT
 
IF `STRCMP("($varshape)", "POINT") EQ 0` THEN
 !-> IF 0 THEN
ENDIF   ! degenerated to a point.
 
! Requested regions that degenerate to a line.
 
IF `STRLEN("($varshape)") EQ 1` THEN
 !-> IF 0 THEN
ENDIF
 
! Issue error messages if the xyz ranges are 0. Note region_t_range is not defined.
 
IF `($degenerate_2d"0|*>1") EQ 1` THEN
 !-> IF 0 THEN
ENDIF
 
! End of file ------------LAS_check_2d_region.jnl-------------------------------
 
! Exit_GO
 
! Check for errors
IF ($error_status"0|ERROR>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Here is variable 0 and its title
 
DEFINE SYMBOL ferret_var_0 = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_var_0 = 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
DEFINE SYMBOL ferret_title_0 = ($ferret_plot_title"($data_var)")
 !-> DEFINE SYMBOL ferret_title_0 = AIR TEMPERATURE (DEG C)
 
! Use Ferret properties to set up the plot qualifiers
 
IF ($ferret_view"0|te>1|*>0") THEN DEFINE SYMBOL ferret_contour_style = raster
 !-> IF 0 THEN DEFINE SYMBOL ferret_contour_style = raster
GO LAS_set_plot_qualifiers
! Enter_GO LAS_set_plot_qualifiers
! LAS_set_plot_qualifiers.jnl
! Use Ferret properties to set plot qualifiers for all plots.
 
! Get the category of the plot: 1D, 2D non-vector, and vector
! plots already have a symbol itsa_vector_plot.
 
! This script should be called BEFORE LAS_open_window.jnl because
! it sets LINECOLORS. The LINECOLORS setting needs a SET WIN to
! take effect.
 
! Do a /TRIM only for color contour plots, not raster plots.
 
IF `STRLEN("($ferret_view)") EQ 1` THEN  DEFINE SYMBOL oneDplot = 1
 !-> IF 0 THEN  DEFINE SYMBOL oneDplot = 1
IF `STRLEN("($ferret_view)") EQ 1 AND ($data_count"1") EQ 1` THEN  DEFINE SYMBOL oneD_1var = 1
 !-> IF 0 THEN  DEFINE SYMBOL oneD_1var = 1
 
IF `STRLEN("($ferret_view)") GT 1 AND ($itsa_vector_plot"0|*>1") EQ 0` THEN \
 DEFINE SYMBOL twoDplot = 1
 !-> IF 1 THEN  DEFINE SYMBOL twoDplot = 1
 !-> DEFINE SYMBOL twoDplot = 1
 
! -------- Options for all plots: key, graticules, axis labels
 
! Option to turn off the plot key
 
IF ($ferret_plot_key"0|0>1|nokey>1|*>0") THEN
 !-> IF 0 THEN
ENDIF
 
! Graticule lines. For 1D plots, make them gray.
 
! TODO:  For time plots, either the configurer or the script might want to turn on
! TODO:  graticules at the small tic marks.  /GRATICULE=(DASH)="small, large"
 
DEFINE SYMBOL nlinecolors = 8
SET MODE LINECOLORS:($nlinecolors)
 !-> SET MODE LINECOLORS:8
PPL COLOR,7,70,70,70     ! gray
PPL COLOR,8,100,100,100  ! white
 
! For time plots, turn on horizontal graticule lines, unless graticules
! have been turned off explicitly. Ignore choice of white - its in the menu
! but useless for line plots.
 
LET has_t = ($fview"0|T>1|*>0")
 !-> DEFINE VARIABLE has_t = 0
IF `STRLEN("($fview)") EQ 2 AND STRINDEX("($fview)", "T") GT 0` THEN LET has_t = 1
 !-> IF 1 THEN LET has_t = 1
 !-> LET has_t = 1
 
IF `has_t AND ($ferret_use_graticules"1|none>0|notic>0|white>0|*>1)` THEN
 !-> IF 1 THEN
  DEFINE SYMBOL onegrat = HGRAT
  IF `STRLEN("($fview)") EQ 2 AND STRINDEX("($fview)", "X") GT 0` THEN DEFINE SYMBOL onegrat = VGRAT
 !-> IF 1 THEN DEFINE SYMBOL onegrat = VGRAT
 !-> DEFINE SYMBOL onegrat = VGRAT
     DEFINE SYMBOL qualifiers = ($qualifiers)/($onegrat)=(DASH,COLOR=black)
 !-> IF 0 THEN      DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=black)
     DEFINE SYMBOL qualifiers = ($qualifiers)/($onegrat)=(DASH,COLOR=7)
 !-> IF 1 THEN      DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=7)
 !-> DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=7)
  DEFINE SYMBOL ferret_use_graticules = none  ! done, so skip the next IF block
ENDIF
 
! Otherwise turn them on only if requested
 
! Either none or notic removes graticules from the plot
IF ($ferret_use_graticules"1|none>0|notic>0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Set up for degrees-minutes-seconds labels on independent variable axis
! If this was not requested, the script just returns.
 
IF ($ferret_deg_min_sec"0|false>0|*>1") THEN GO LAS_set_deg_min_sec.jnl
 !-> IF 0 THEN GO LAS_set_deg_min_sec.jnl
 
! -------- Options for 2D single-variable plots
 
IF ($twoDplot"0|*>1") THEN
 !-> IF 1 THEN
   IF `($FERRET_VERSION"0") GE 6.2` THEN KEYMARK 1  ! annotate plot keys with the min and max
 !-> IF 1 THEN KEYMARK 1
 !-> KEYMARK 1
   IF `($ferret_key_annotate"1") EQ 0` THEN KEYMARK 0  ! override annotation with Ferret property
 !-> IF 0 THEN KEYMARK 0
   IF ($ferret_contour_style"0|contour_lines>1|*>0") THEN
 !-> IF 0 THEN
   ELSE
       DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels)
 !-> IF 1 THEN        DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v
 !-> DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v
   ENDIF
   IF `($ferret_contour_style"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
      DEFINE SYMBOL ferret_contour_style = ($ferret_fill_type"default|raster>raster|shade>raster|fill>default|contour>contour_lines|color_filled_plus_lines|*>default")
 !-> IF 1 THEN      DEFINE SYMBOL ferret_contour_style = default
 !-> DEFINE SYMBOL ferret_contour_style = default
   ENDIF
color_filled_contours>FILL|color_filled_plus_lines>FILL|contour_lines>CONTOUR|raster_plus_lines>SHADE")
 !-> DEFINE SYMBOL plot_type =FILL
   DEFINE SYMBOL shade_underlay = 0
   IF ($plot_type"0|FILL>1|*>0) THEN DEFINE SYMBOL shade_underlay = 1
 !-> IF 1 THEN DEFINE SYMBOL shade_underlay = 1
 !-> DEFINE SYMBOL shade_underlay = 1
   IF `($ferret_google_plot"0") EQ 0` THEN
 !-> IF 1 THEN
           ($shade_underlay"0")` THEN DEFINE SYMBOL shade_qualifiers = ($shade_qualifiers)/TRIM
 !-> IF 1 THEN DEFINE SYMBOL shade_qualifiers =  /TRIM
 !-> DEFINE SYMBOL shade_qualifiers =  /TRIM
   ENDIF
   IF ($shade_underlay"0") THEN DEFINE SYMBOL shade_qualifiers = ($shade_qualifiers)/LEVELS=($ferret_fill_levels)
 !-> IF 1 THEN DEFINE SYMBOL shade_qualifiers = /TRIM/LEVELS=v
 !-> DEFINE SYMBOL shade_qualifiers = /TRIM/LEVELS=v
    ($qualifiers)/PALETTE=($ferret_palette"rainbow|default>rainbow|*>*)
 !-> IF 0 THEN DEFINE SYMBOL qualifiers =     /KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v/PALETTE=rainbow
   IF `($ferret_contour_style"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
   ENDIF
   IF `($ferret_contour_style"0|default>1|raster>1|shade>1|color_filled_contours>1|fill>1|color_filled_plus_lines>1|contour_lines>1|raster_plus_lines>1|*>0") EQ 0` THEN
 !-> IF 0 THEN
   ENDIF
   IF `($ferret_contour_style"0|default>0|raster>0|shade>0|color_filled_contours>0|fill>0|color_filled_plus_lines>1|raster_plus_lines>1|*>0")` THEN
 !-> IF 0 THEN
   ENDIF
   IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT
 !-> IF 0 THEN DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v/KEY=CONT,CENT
ENDIF ! end of options for twoDplot
 
! -------- Options for line styles (Note currently we dont allow setting
!          the color of contour lines, but we could.)
 
! ---------------- Line color for single-line, vector, or contour plots
!                  Do not set a /COLOR qualifier for multi-line plots
!                  Default is blue for line, vector, contour plots.
!                  Line-color is red for difference plots.
!
IF `($line_drawn"0|*>1") EQ 0` THEN \
DEFINE SYMBOL line_drawn = `($oneDplot"0|*>1") OR ($itsa_vector_plot"0|*>1") OR ($plot_type"0|CONTOUR>1|*>0")`
 !-> IF 1 THEN DEFINE SYMBOL line_drawn = `0 OR 0 OR 0`
 !-> DEFINE SYMBOL line_drawn = `0 OR 0 OR 0`
 !-> DEFINE SYMBOL line_drawn = 0
 
 
sh sym ferret_line_color
IF `($line_drawn"0") AND ($itsa_multi_lineplot"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF ! skipped color setting if its a multi-line plot
 
! ---------------- Thickness options for all 1D plots, Vector plots, and Contour plots
!                  Thicknum is used in the key for multi-line plots.
 
IF ($line_drawn) THEN
 !-> IF 0 THEN
ENDIF  ! end of options for plots drawn with lines
 
 
! ---------------- All oneD plots, settings for option to
!                  set dependent-axis scale.
 
IF ($oneDplot"0|*>1") THEN
 !-> IF 0 THEN
ENDIF   ! end of options for oneDplot, dependent axis scale setup
 
! ---------------- sanity check on ferret_trend_line.
 
IF `($ferret_trend_line"0|1|2|*>0") EQ 0` THEN \
   CANCEL SYMBOL ferret_trend_line
 !-> IF 1 THEN    CANCEL SYMBOL ferret_trend_line
 !-> CANCEL SYMBOL ferret_trend_line
 
! ---------------- Settings for XY vector and XY vector difference plots.
 
IF `($itsa_vector_plot"0|*>1") AND ($ferret_view"0|xy>1|*>0")` THEN
 !-> IF 0 THEN
ENDIF  ! end of XY vector plot settings.
 
!  ----------------- End of LAS_set_plot_qualifiers.jnl ------------------------------------
! Exit_GO
 
 
! Open the window, apply size, scale and WMS view options
GO LAS_open_window
! Enter_GO LAS_open_window
! LAS_open_window.jnl
!
! Author: ansley
! Date: 2007/02/12
! 7/2010    ACM updates for V7.2 multi-variable plots
!
! The LAS_open_windw.jnl script takes care of everything having to
! do with starting the window.
!
!  This script should be called AFTER LAS_set_plot_qualifiers.jnl,
!  if the set-qualifiers script is called.
!
! - Open the window with the desired size
! - Issue CANCEL MODE LOGO command
! - If an XY plot and if this has been requested, set the aspect
!   ratio to match the region
! - If no margins (WMS style plot) is requested, set that up,
!   including the /NOYADJUST plot qualifier.
 
 
IF `($set_window_quals"0|*>1") EQ 0` THEN \
 DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5")
 !-> IF 1 THEN  DEFINE SYMBOL set_window_quals =  /SIZE=.8333
 !-> DEFINE SYMBOL set_window_quals =  /SIZE=.8333
CANCEL MODE LOGO
 
 
IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/FONT=verdana
 !-> IF 0 THEN SET TEXT/FONT=verdana
 
IF `($win_aspect"0|*>1") EQ 0` THEN DEFINE SYMBOL win_aspect = 1
 !-> IF 1 THEN DEFINE SYMBOL win_aspect = 1
 !-> DEFINE SYMBOL win_aspect = 1
 
IF `($ferret_view"|xy>1|xyt>1|*>0") AND ($its_prop_prop_plot"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
IF `($win_aspect) LT 0.1` THEN DEFINE SYMBOL win_aspect = 0.1
 !-> IF 0 THEN DEFINE SYMBOL win_aspect = 0.1
IF `($win_aspect) GT 10` THEN DEFINE SYMBOL win_aspect = 10
 !-> IF 0 THEN DEFINE SYMBOL win_aspect = 10
IF ($ferret_set_aspect"1|default>1|no>0|yes>1|0|1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = `($win_aspect)`:axis
 !-> IF 0 THEN    DEFINE SYMBOL set_window_quals = /SIZE=.8333/ASPECT = `1`:axis
ENDIF
IF `($win_aspect) GT 100` THEN \
  DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = 1:axis
 !-> IF 0 THEN   DEFINE SYMBOL set_window_quals = /SIZE=.8333/ASPECT = 1:axis
IF `($win_aspect) LT 0.01` THEN \
  DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = 1:axis
 !-> IF 0 THEN   DEFINE SYMBOL set_window_quals = /SIZE=.8333/ASPECT = 1:axis
 
 
! Open the window. For PyFerret, use /OUTLINE to take care of the pesky white-line issue
IF ($program_name"0|PyFerret>1|*>0") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)/OUTLINE=0.7 1
 !-> IF 0 THEN DEFINE SYMBOL set_window_quals = /SIZE=.8333/OUTLINE=0.7 1
 
SET WINDOW($set_window_quals)
 !-> SET WINDOW/SIZE=.8333
 
IF `($ferret_margins"1|0|1|false>0|true>1") EQ 0` THEN
 !-> IF 0 THEN
ELSE
   IF `STRLEN("($ferret_view)") GE 2` THEN
 !-> IF 1 THEN
      DEFINE VIEW/X=0:0.95/Y=0:1 xspace
      SET VIEW xspace
   ELSE
   ENDIF
ENDIF
 
! If the annotations are going to be collected and sent back to LAS for presentation,
! set up the viewport for small margins around the edge.
IF ($ferret_annotations"0|*>1") THEN GO set_full_margins
 !-> IF 1 THEN GO set_full_margins
 !-> GO set_full_margins
! Enter_GO set_full_margins
! Set up for small margins, color key at the top
! full_view2 is for property-property plots to use.
! 10/13 change X=0.06 to X=0.07 throughout. When the vertical
! axis labels need more than 2 digits, we need more space.
! 9/16 Set Y spacing to 0.07 throughout, needed for Time labels using PPLUS
 
! Google Earth plots need no margins. This has already been set up.
IF ($its_GE"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL text_size = ($ferret_text_size"0.09")
 !-> DEFINE SYMBOL text_size = 0.09
 
CAN view
 
LET y_up = 0.92
IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN LET y_up = 0.9
 !-> IF 0 THEN LET y_up = 0.9
 
DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:`y_up` full_view
 !-> DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:0.92 full_view
DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:`y_up` full_view2
 !-> DEFINE VIEW/AXES/X=0.08:0.99/y=0.07:0.92 full_view2
 
! Give prop-prop plots a little more space at the left for labels.
IF ($its_prop_prop_plot"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_thumb"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_view%0|yt>1|zt>1|t>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
IF ($ferret_view%0|xt>1|*>0%) THEN
 !-> IF 1 THEN
   DEFINE VIEW/AXES/X=0.08:0.98/y=0.07:`y_up`  full_view
 !-> DEFINE VIEW/AXES/X=0.08:0.98/y=0.07:0.92  full_view
   DEFINE VIEW/AXES/X=0.08:0.98/y=0.07:`y_up`  full_view2
 !-> DEFINE VIEW/AXES/X=0.08:0.98/y=0.07:0.92  full_view2
ENDIF
 
IF ($ferret_view%0|t>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
! Thumbnail plots need bigger axis labels. Make the margins bigger.
IF ($ferret_view%0|x>1|y>1|z>1|*>0%) THEN
 !-> IF 0 THEN
ENDIF
 
SET VIEW full_view
keymark 1
IF `($ferret_key_annotate"1") EQ 0` THEN KEYMARK 0  ! override annotation with Ferret property
 !-> IF 0 THEN KEYMARK 0
 
! Tic marks inside the plot box
PPL TICS,,,,,1,1
 
! Or, make short tics, on the outside of the axes
! PPL TICS,,,,,-1,-1
! PPL TICS .6,.125,.6,.125
 
! No tics as an option
IF ($ferret_use_graticules"0|notic>1|*>0) THEN
 !-> IF 0 THEN
ENDIF
 
PPL AXLSZE ($text_size),($text_size)
 !-> PPL AXLSZE 0.09,0.09
 
!  ----------------- End of set_full_margins.jnl ------------------------------------
! Exit_GO
! Exit_GO
 
! Set the URL label for the first dataset.
GO LAS_url_label 0
! Enter_GO LAS_url_label 0
! LAS_url_label.jnl
 
! Define upper-right labels with the url; the URL is not plotted automatically when the var is
! (the same thing may be done in transform scripts or in differencing setup; that is ok
! 1/2010 fix ticket 745 - immediate-mode expressions where the string contains an = sign
!        trip up the command parsing. Break these definitions into two steps.
 
IF `($n_right_labels"0") EQ 0` THEN DEFINE SYMBOL n_right_labels = 0
 !-> IF 1 THEN DEFINE SYMBOL n_right_labels = 0
 !-> DEFINE SYMBOL n_right_labels = 0
!IF `($data_$1_url"0|*>1") EQ 0` THEN EXIT/SCRIPT
 
 
! Instead of the URL use the dataset name or ID passed in to the
! (addXML gets this from the title attribute from the original dataset
! dataset if that attrib exists)
 
 
DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0
 
LET got_dataset_label = 0
 
IF `got_dataset_label EQ 0` THEN
 !-> IF 1 THEN
      DEFINE SYMBOL n_right_labels = `($n_right_labels)+1`
 !-> IF 1 THEN       DEFINE SYMBOL n_right_labels = `0+1`
 !-> DEFINE SYMBOL n_right_labels = `0+1`
 !-> DEFINE SYMBOL n_right_labels = 1
   IF ($data_$1_dataset_id"0|*>1") THEN
 !-> IF 1 THEN
     DEFINE SYMBOL upper_right_($n_right_labels) = DATA SET: ($data_$1_dataset_id)
 !-> DEFINE SYMBOL upper_right_1 = DATA SET: coads_climatology_cdf
     DEFINE SYMBOL upper_right_text_($n_right_labels) = DATA SET: ($data_$1_dataset_id)
 !-> DEFINE SYMBOL upper_right_text_1 = DATA SET: coads_climatology_cdf
     LET got_dataset_label = 1
     DEFINE SYMBOL dataset_title_($num)_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_0_lab = DATA SET: coads_climatology_cdf
     DEFINE SYMBOL dataset_title_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_lab = DATA SET: coads_climatology_cdf
   ENDIF
   IF ($data_$1_dataset_name"0|*>1") THEN
 !-> IF 1 THEN
     DEFINE SYMBOL upper_right_($n_right_labels) = DATA SET: ($data_$1_dataset_name)
 !-> DEFINE SYMBOL upper_right_1 = DATA SET: COADS climatology
     DEFINE SYMBOL upper_right_text_($n_right_labels) = DATA SET: ($data_$1_dataset_name)
 !-> DEFINE SYMBOL upper_right_text_1 = DATA SET: COADS climatology
     LET got_dataset_label = 1
     DEFINE SYMBOL dataset_title_($num)_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_0_lab = DATA SET: COADS climatology
     DEFINE SYMBOL dataset_title_lab = ($upper_right_text_($n_right_labels))
 !-> DEFINE SYMBOL dataset_title_lab = DATA SET: COADS climatology
   ENDIF
ENDIF
 
! If we didnt get a label from the above, use the URL
 
IF `got_dataset_label EQ 0` THEN
 !-> IF 0 THEN
ENDIF
 
! If labels are not going to be on the plots, save the url
 
IF `STRINDEX("($data_$1_dataset_url)","http") NE 0` THEN
 !-> IF 0 THEN
ELSE
   DEFINE SYMBOL dataset_url_($num)_lab = DATA SET: ($data_$1_dataset_url)
 !-> DEFINE SYMBOL dataset_url_0_lab = DATA SET: file:coads_climatology
ENDIF
 
IF `($num) EQ 0` THEN
 !-> IF 1 THEN
   DEFINE SYMBOL dataset_url_lab = ($dataset_url_($num)_lab)
 !-> DEFINE SYMBOL dataset_url_lab = DATA SET: file:coads_climatology
   IF `STRINDEX("($dataset_url_lab)", "http") EQ 0` THEN
 !-> IF 1 THEN
     IF ($data_0_ftds_url"0|*>1") THEN DEFINE SYMBOL dataset_url_lab = ($data_0_ftds_url)
 !-> IF 1 THEN DEFINE SYMBOL dataset_url_lab = http://test.nio.org/thredds/dodsC/las/coads_climatology_cdf/data_coads_climatology.jnl
 !-> DEFINE SYMBOL dataset_url_lab = http://test.nio.org/thredds/dodsC/las/coads_climatology_cdf/data_coads_climatology.jnl
   ENDIF
ENDIF
 
IF `($num) GT 0` THEN
 !-> IF 0 THEN
ELSE
   IF `($dataset_url_0_lab"0|*>1")` THEN DEFINE SYMBOL dataset_url_lab ($dataset_url_0_lab)
 !-> IF 1 THEN DEFINE SYMBOL dataset_url_lab DATA SET: file:coads_climatology
 !-> DEFINE SYMBOL dataset_url_lab DATA SET: file:coads_climatology
ENDIF
 
 
 
IF ($data_0_dataset_institution"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
 
! End of $RCSfile ------------LAS_url_label.jnl--------------------------
! Exit_GO
 
 
! If the optional property ferret_points_zt has been set, draw a custom
! plot. That script includes a call to LAS_results, so just exit.
 
IF ($ferret_points_zt"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! Make a plot,needed to get the number of levels (SHADE/SET doesnt do it.)
IF `($plot_type"0|CONTOUR>0|*>1") AND ($degenerate_2d"0|*>1") EQ 0` THEN
 !-> IF 1 THEN
IF ($ferret_annotations"0|*>1") THEN
 !-> IF 1 THEN
   SHADE($qualifiers)($shade_qualifiers)/TITLE="($ferret_plot_title)" ($ferret_var_0)
 !-> SHADE/KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v/TRIM/LEVELS=v/TITLE="AIR TEMPERATURE (DEG C)" 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
   CANCEL VIEW
   SET VIEW full_view
ENDIF
ENDIF
 
 
! For an ensemble-z plot, make the Z axis in the vertical direction
IF ($ferret_view"0|ze>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/TRANS
 !-> IF 0 THEN DEFINE SYMBOL qualifiers = /KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v/TRANS
 
 
 
! Draw the plot and we are done
 
IF `($data_count"0") EQ 1` THEN
 !-> IF 1 THEN
   DEFINE SYMBOL split_title = ($ferret_plot_title)
 !-> DEFINE SYMBOL split_title = AIR TEMPERATURE (DEG C)
   GO LAS_split_title
! Enter_GO LAS_split_title
IF ($ferret_annotations"0|*>1") THEN  EXIT/SCRIPT
 !-> IF 1 THEN  EXIT/SCRIPT
 !-> EXIT/SCRIPT
! Exit_GO
   DEFINE SYMBOL ferret_plot_title = ($split_title)
 !-> DEFINE SYMBOL ferret_plot_title = AIR TEMPERATURE (DEG C)
   IF ($shade_underlay) THEN
 !-> IF 1 THEN
      SHADE($qualifiers)($shade_qualifiers)/TITLE="($ferret_plot_title)"/SET ($ferret_var_0)
 !-> SHADE/KEY=CONT/VGRAT=(DASH,COLOR=7)/LEVELS=v/TRIM/LEVELS=v/TITLE="AIR TEMPERATURE (DEG C)"/SET 'AIRT'[d=1,X=0:360,Y=0:0,T="15-Jan":"15-Dec"]
      GO reset_labels
! Enter_GO reset_labels
IF ($xform_dms"0|*>1") THEN PPL XFOR (($xform_dms))
 !-> IF 0 THEN PPL XFOR ( )
IF ($yform_dms"0|*>1") THEN PPL YFOR (($yform_dms))
 !-> IF 0 THEN PPL YFOR ( )
IF ($axlab_command"0|*>1") THEN PPL ($axlab_command)
 !-> IF 0 THEN PPL
IF ($tnmlab_command"0|*>1") THEN PPL ($tnmlab_command)
 !-> IF 0 THEN PPL
IF ($axtic_command"0|*>1") THEN PPL ($axtic_command)
 !-> IF 0 THEN PPL
IF ($axlen_command"0|*>1") THEN PPL ($axlen_command)
 !-> IF 0 THEN PPL
IF ($axtype_command"0|*>1") THEN PPL ($axtype_command)
 !-> IF 0 THEN PPL
if ($labnum_dset"0|*>1") THEN go unlabel ($labnum_dset)
 !-> if 1 THEN go unlabel 2
 !-> go unlabel 2
! Enter_GO unlabel 2
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 2
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 2,0,0 @AS
set mode/last verify
! Exit_GO
if ($labnum_datitl"0|*>1") THEN go unlabel ($labnum_datitl)
 !-> if 1 THEN go unlabel 3
 !-> go unlabel 3
! Enter_GO unlabel 3
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 3
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 3,0,0 @AS
set mode/last verify
! Exit_GO
if ($labnum_dods"0|*>1") THEN go unlabel ($labnum_dods)
 !-> if 0 THEN go unlabel
IF `STRLEN("($ferret_view)") EQ 2` THEN
 !-> IF 1 THEN
   IF `($ppl$zmin"0") GE 1.e35 AND ($ppl$zmax"0") LE -1.e35` THEN DEFINE SYMBOL nokey = 1
 !-> IF 0 THEN DEFINE SYMBOL nokey = 1
   IF `($nokey"0") EQ 0` THEN
 !-> IF 1 THEN
      PPL SHAKEY 1,,,,,,,,,,1
      IF `($ferret_key_annotate"1") EQ 0` THEN keymark 0
 !-> IF 0 THEN keymark 0
   ENDIF
ENDIF
IF `($data_count"1") EQ 1` THEN
 !-> IF 1 THEN
   IF ($labnum_x"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_y"0|*>1") THEN
 !-> IF 1 THEN
      DEFINE SYMBOL latitude_lab ($lab($labnum_y))
 !-> DEFINE SYMBOL latitude_lab LATITUDE : 1S
   ENDIF
   IF ($labnum_z"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_t"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_calend"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   IF ($labnum_year"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
 !-> REPEAT/RANGE=1:2/NAME=lnum (     DEFINE SYMBOL lnum = `lnum`;     SHOW SYMBOL lab($lnum);     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
!-> REPEAT: LNUM:1
 !-> (     DEFINE SYMBOL lnum = `lnum`;     SHOW SYMBOL lab($lnum);     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
 !-> DEFINE SYMBOL lnum = `lnum`
 !-> DEFINE SYMBOL lnum = 1
 !->      SHOW SYMBOL lab($lnum)
 !-> SHOW SYMBOL lab1
LAB1 = "LATITUDE : 1S"
 !->      IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum)
 !-> IF 0 THEN DEFINE SYMBOL labnum_e = 1
!-> REPEAT: LNUM:2
 !-> (     DEFINE SYMBOL lnum = `lnum`;     SHOW SYMBOL lab($lnum);     IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum) )
 !-> DEFINE SYMBOL lnum = `lnum`
 !-> DEFINE SYMBOL lnum = 2
 !->      SHOW SYMBOL lab($lnum)
 !-> SHOW SYMBOL lab2
LAB2 = "DATA SET: coads_climatology"
 !->      IF `STRINDEX("($lab($lnum))", "E :") EQ 1` THEN DEFINE SYMBOL labnum_e = ($lnum)
 !-> IF 0 THEN DEFINE SYMBOL labnum_e = 2
   IF ($labnum_e%0|*>1%) THEN
 !-> IF 0 THEN
   ENDIF
   IF ($ferret_view"0|e>1|*>0") THEN
 !-> IF 0 THEN
   ENDIF
ENDIF
IF ($ferret_annotations"0|*>1") THEN
 !-> IF 1 THEN
   PPL TITLE
   PPL XLAB
   PPL YLAB
   IF ($labnum_x"0|*>1") THEN GO unlabel ($labnum_x)
 !-> IF 0 THEN GO unlabel
   IF ($labnum_y"0|*>1") THEN GO unlabel ($labnum_y)
 !-> IF 1 THEN GO unlabel 1
 !-> GO unlabel 1
! Enter_GO unlabel 1
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 1
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 1,0,0 @AS
set mode/last verify
! Exit_GO
   IF ($labnum_z"0|*>1") THEN GO unlabel ($labnum_z)
 !-> IF 0 THEN GO unlabel
   IF ($labnum_t"0|*>1") THEN GO unlabel ($labnum_t)
 !-> IF 0 THEN GO unlabel
   IF ($labnum_calend"0|*>1") THEN GO unlabel ($labnum_calend)
 !-> IF 0 THEN GO unlabel
   GO unlabel 1  ! Just for good measure
! Enter_GO unlabel 1
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 1
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 1,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 2
! Enter_GO unlabel 2
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 2
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 2,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 3
! Enter_GO unlabel 3
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 3
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 3,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 4
! Enter_GO unlabel 4
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 4
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 4,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 5
! Enter_GO unlabel 5
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 5
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 5,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 6
! Enter_GO unlabel 6
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 6
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 6,0,0 @AS
set mode/last verify
! Exit_GO
   GO unlabel 7
! Enter_GO unlabel 7
QUERY/IGNORE $1"<Usage: GO unlabel n,  where n is a PLOT+ movable label number"
 !-> QUERY/IGNORE 7
PPL LABS/NOUSER $1,0,0 @AS
 !-> PPL LABS/NOUSER 7,0,0 @AS
set mode/last verify
! Exit_GO
ENDIF
IF ($ferret_annotations"0|*>1") THEN GO key_at_top
 !-> IF 1 THEN GO key_at_top
 !-> GO key_at_top
! Enter_GO key_at_top
IF ($its_GE"0|*>1") THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `($ferret_plot_key"1|0|*>1") EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
DEFINE SYMBOL horizontal_key = 1
LET key_label_size = 0.08
ppl ylab
ppl xlab
let x1 = `($ppl$xorg)+0.8`
 !-> DEFINE VARIABLE x1 = 1.616
let x2 = `($ppl$xorg)+($ppl$xlen)-0.8`
 !-> DEFINE VARIABLE x2 = 9.196
let y1 = `($ppl$yorg)+($ppl$ylen)+0.025`
 !-> DEFINE VARIABLE y1 = 8.121
let y1 = `($ppl$yorg)+($ppl$ylen)+0.04`
 !-> DEFINE VARIABLE y1 = 8.136
let y2 = `y1+0.2`
 !-> DEFINE VARIABLE y2 = 8.336
IF ($custom_dataset"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($ferret_plot_key"0|date_key>1|*>0") THEN
 !-> IF 0 THEN
ELSE
   ppl shakey ,0,`-1*key_label_size`,,,,`x1`,`x2`,`y1`,`y2`
 !-> ppl shakey ,0,-0.08,,,,1.616,9.196,8.136,8.336
ENDIF
! Exit_GO
LET add_urls = 1
IF `STRCMP("($data_0_dataset_name)", "($data_0_dataset_url)") EQ 0` THEN LET add_urls = 0
 !-> IF 0 THEN LET add_urls = 0
DEFINE SYMBOL dataset_title_lab = DATASET: ($data_0_dataset_name)
 !-> DEFINE SYMBOL dataset_title_lab = DATASET: COADS climatology
! Exit_GO
      IF ($ferret_view"0|te>1|*>0") THEN
 !-> IF 0 THEN
      ENDIF
      IF ($ferret_view"0|ze>1|*>0") THEN
 !-> IF 0 THEN
      ENDIF
      PPL SHADE
      IF `($LEV_NUM"0") GT 245/2` THEN PPL SHASET RESET
 !-> IF 0 THEN PPL SHASET RESET
      ($plot_type)/NOKEY/($qualifiers)/OVER/NOLAB ($ferret_var_0)
! Exit_GO
! Exit_GO
! Exit_GO
! Exit_GO


[Thread Prev][Thread Next][Index]


Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement