[Thread Prev][Thread Next][Index]

[las_users] Animate error



Hi all,

I'm having trouble using the 'animate' functionality of LAS. My current LAS version is v7.2 revision: 11623M. I've attached the debug trace your kind review. Any advice or help is greatly appreciated.
--
Regards,
Anton Yoel Buenavista

STOP -script mode, ERROR RUNNING SCRIPT
 *** NOTE: If no missing_value or _FillValue attribute on variables, will use NaN
 Cached data cleared from memory
 **ERROR: illegal limits: J on grid (G005) does not exist at Y=0.2N
          Axis extremes are Y=0.2N:2N
DEFINE VARIABLE strd_lo = `j[gy=pvar,y=0.18]`
Command file, command group, or REPEAT execution aborted

go "$1"
 !-> go "/usr/local/noaa/Tomcat6/webapps/las/WEB-INF/classes/resources/ferret/temp/ferret_operation_1305280815410.jnl"
! Symbols from the server
                        DEFINE SYMBOL data_0_ID = va-id-forecast
                                 DEFINE SYMBOL data_0_dataset_ID = id-forecast
                                 DEFINE SYMBOL data_0_dataset_name = Forecast, 10-19 May 2011
                                 DEFINE SYMBOL data_0_dataset_url = http://localhost/thredds/dodsC/las/tmh_forecast.nc
                                 DEFINE SYMBOL data_0_dsid = id-forecast
                                 DEFINE SYMBOL data_0_ftds_url = http://localhost/thredds/dodsC/las/id-forecast/data_localhost_thredds_dodsC_las_tmh_forecast.nc_hydro_tmh_init_va.jnl
                                 DEFINE SYMBOL data_0_grid_type = regular
                                 DEFINE SYMBOL data_0_intervals = xyt
                                 DEFINE SYMBOL data_0_name = depth-averaged y-velocity of currents
                                 DEFINE SYMBOL data_0_points = xyt
                                 DEFINE SYMBOL data_0_region = region_0
                                 DEFINE SYMBOL data_0_title = depth-averaged y-velocity of currents
                                 DEFINE SYMBOL data_0_units = meter/second
                                 DEFINE SYMBOL data_0_url = http://localhost/thredds/dodsC/las/tmh_forecast.nc
                                 DEFINE SYMBOL data_0_var = va
                                 DEFINE SYMBOL data_0_xpath = /lasdata/datasets/id-forecast/variables/va-id-forecast
                                 DEFINE SYMBOL data_count = 1
                                 DEFINE SYMBOL ferret_contour_style = raster
                                 DEFINE SYMBOL ferret_fill_type = fill
                                 DEFINE SYMBOL ferret_init_script = hydro_tmh_init
                                 DEFINE SYMBOL ferret_interpolate_data = false
                                 DEFINE SYMBOL ferret_land_type = contour
                                 DEFINE SYMBOL ferret_line_color = blue
                                 DEFINE SYMBOL ferret_mark_grid = no
                                 DEFINE SYMBOL ferret_palette = rnb2
                                 DEFINE SYMBOL ferret_service_action = Data_Extract_Frames
                                 DEFINE SYMBOL ferret_size = 0.5
                                 DEFINE SYMBOL ferret_vector_length = 0.718
                                 DEFINE SYMBOL ferret_vector_u = ua
                                 DEFINE SYMBOL ferret_vector_v = va
                                 DEFINE SYMBOL ferret_vector_var = none
                                 DEFINE SYMBOL ferret_view = xy
                                 DEFINE SYMBOL las_debug = true
                                 DEFINE SYMBOL operation_ID = Animation_2D_XY
                                 DEFINE SYMBOL operation_key = 1755EDC8F0ACF6369D03CE79A10A82FF
                                 DEFINE SYMBOL operation_name = Animation
                                 DEFINE SYMBOL operation_service = ferret
                                 DEFINE SYMBOL operation_service_action = Data_Extract_Frames
                                 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 = 20
                                 DEFINE SYMBOL product_server_use_cache = false
                                 DEFINE SYMBOL region_0_t_hi = 10-May-2011 09:00
                                 DEFINE SYMBOL region_0_t_lo = 10-May-2011 09:00
                                 DEFINE SYMBOL region_0_x_hi = 104.5798279
                                 DEFINE SYMBOL region_0_x_lo = 102.7096
                                 DEFINE SYMBOL region_0_y_hi = 1.984924502
                                 DEFINE SYMBOL region_0_y_lo = 0.1809323
                                 DEFINE SYMBOL result_count = 3
                                 DEFINE SYMBOL result_debug_ID = debug
                                 DEFINE SYMBOL result_debug_filename = /usr/local/noaa/Tomcat6/webapps/las/output/1755EDC8F0ACF6369D03CE79A10A82FF_debug.txt
                                 DEFINE SYMBOL result_debug_type = debug
                                 DEFINE SYMBOL result_ferret_listing_ID = ferret_listing
                                 DEFINE SYMBOL result_ferret_listing_filename = /usr/local/noaa/Tomcat6/webapps/las/output/1755EDC8F0ACF6369D03CE79A10A82FF_ferret_listing.xml
                                 DEFINE SYMBOL result_ferret_listing_type = xml
                                 DEFINE SYMBOL result_rss_ID = rss
                                 DEFINE SYMBOL result_rss_filename = /usr/local/noaa/Tomcat6/webapps/las/output/CF47DE547D5712BA4E8019EF4F5394AC_rss.rss
                                 DEFINE SYMBOL result_rss_type = rss
         GO ($operation_service_action)
 !-> GO Data_Extract_Frames
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! $Author: rhs $
!
! Extracting to a netCDF file and some text and table files have different
! options in the UI.  Need to separate them at this level to keep the UI
! happy.  All the Data_Extract* scripts launch the same list_data.jnl script.
GO list_frames
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: list_frames.jnl,v $
!
! $Author: Jing Y. Li $
! $Date: 2007/08/22
! 2007/11/27 ACM If the variable is a native curvilinear data variable, operate
!                on the data field not the var,xcoord,ycoord which has been
!                defined as the *plot variable*". Specify the XY region for the
!                variable using the i,j box limits previously computed.
!                Question: should the longitude/ latitude coordinates or other
!                informatino about the curvilinear grid be listed in the xml file?
!
! 4/28/2008 ACM refer always to ($data_var)[d=($data_num)] as there
!           may be other datasets open, e.g. for transformed variables.
! 4/28/2008 ACM Define tvar, used for getting time axis information, as
!           just t[gt=var] so that it isn't a huge variable to load in tax_datestring.
! 6/2010    ACM If its a vector plot, call LAS_auto_veclen_animate instead of
!           LAS_auto_levels_animate.
!
! list_frames.jnl creates a listing in XML format for animation
! Assumes symbol ferret_listing is the output file.
! The listing file includes:
! - fill_levels      for 2D plots
! - contour_levels   for 2D plots
! - dep_axis_scale   for 1D plots
! - vector_length    for vector plots
! - hasT             used to determine if the dataset has time axis
! - units            units of the time axis
! - frames           list of each individual time points
 
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
 
! 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 = 102.7096
  DEFINE SYMBOL region_x_hi = `INT(100000 * ($($region)_x_hi)) / 100000`
 !-> DEFINE SYMBOL region_x_hi = 104.5798
  DEFINE SYMBOL limits_x = ($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL limits_x = 102.7096:104.5798
  DEFINE SYMBOL limits_x_m360 = `($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL limits_x_m360 = -257.2904:-255.4202
  DEFINE SYMBOL limits_x_p360 = `($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL limits_x_p360 = 462.7096:464.5798
  DEFINE SYMBOL region_x = X=($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL region_x = X=102.7096:104.5798
  DEFINE SYMBOL region_x_m360 X=`($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL region_x_m360 X=-257.2904:-255.4202
  DEFINE SYMBOL region_x_p360 X=`($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL region_x_p360 X=462.7096:464.5798
  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 = 1.870201
  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.18
  DEFINE SYMBOL region_y_hi = `INT(1000 * ($($region)_y_hi)) / 1000`
 !-> DEFINE SYMBOL region_y_hi = 1.984
  DEFINE SYMBOL limits_y = ($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL limits_y = 0.18:1.984
  DEFINE SYMBOL region_y = Y=($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL region_y = Y=0.18:1.984
  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 = 1.804
  ELSE
  ENDIF
ENDIF
 
IF ($($region)_z_lo"0|*>1") THEN
 !-> IF 0 THEN
  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 1 THEN
  DEFINE SYMBOL region_t_lo = ($($region)_t_lo)
 !-> DEFINE SYMBOL region_t_lo = 10-May-2011 09:00
  DEFINE SYMBOL region_t_hi = ($($region)_t_hi)
 !-> DEFINE SYMBOL region_t_hi = 10-May-2011 09:00
  DEFINE SYMBOL limits_t \"($region_t_lo)\":\"($region_t_hi)\"
 !-> DEFINE SYMBOL limits_t \"10-May-2011 09:00\":\"10-May-2011 09:00\"
  DEFINE SYMBOL region_t T=\"($region_t_lo)\":\"($region_t_hi)\"
 !-> DEFINE SYMBOL region_t T=\"10-May-2011 09:00\":\"10-May-2011 09:00\"
ENDIF
IF ($add_region_t"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=102.7096:104.5798,Y=0.18:1.984
  ELSE
  ENDIF
ELSE
  ENDIF
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=102.7096:104.5798
  ENDIF
ELSE
  ENDIF
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=102.7096:104.5798,T="10-May-2011 09:00":"10-May-2011 09:00"
  ELSE
  ENDIF
ELSE
  ENDIF
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.18:1.984
  ENDIF
ELSE
  ENDIF
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.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
  ELSE
  ENDIF
ELSE
  ENDIF
ENDIF
 
! region_zt
IF ($region_z"0|*>1") THEN
 !-> IF 0 THEN
  ENDIF
ELSE
  IF ($region_t"0|*>1") THEN
 !-> IF 1 THEN
    DEFINE SYMBOL region_zt = ($region_t)
 !-> DEFINE SYMBOL region_zt = T="10-May-2011 09:00":"10-May-2011 09:00"
  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=102.7096:104.5798,Y=0.18:1.984
  ENDIF
ELSE
  ENDIF
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=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
  ELSE
  ENDIF
ELSE
  ENDIF
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.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
  ELSE
  ENDIF
ELSE
  ENDIF
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=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
  ELSE
  ENDIF
ELSE
  ENDIF
ENDIF
 
DEFINE SYMBOL region_full = ($region_xyzt)
 !-> DEFINE SYMBOL region_full = X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
 
 
! 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=102.7096:104.5798
 !-> DEFINE SYMBOL region_0_x = X=102.7096:104.5798
IF ($region_y"0|*>1") THEN DEFINE SYMBOL region_($num)_y = ($region_y)
 !-> IF 1 THEN DEFINE SYMBOL region_0_y = Y=0.18:1.984
 !-> DEFINE SYMBOL region_0_y = Y=0.18:1.984
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="10-May-2011 09:00":"10-May-2011 09:00"
 !-> DEFINE SYMBOL region_0_t = T="10-May-2011 09:00":"10-May-2011 09:00"
IF ($region_xt"0|*>1") THEN DEFINE SYMBOL region_($num)_xt = ($region_xt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xt = X=102.7096:104.5798,T="10-May-2011 09:00":"10-May-2011 09:00"
 !-> DEFINE SYMBOL region_0_xt = X=102.7096:104.5798,T="10-May-2011 09:00":"10-May-2011 09:00"
IF ($region_xy"0|*>1") THEN DEFINE SYMBOL region_($num)_xy = ($region_xy)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xy = X=102.7096:104.5798,Y=0.18:1.984
 !-> DEFINE SYMBOL region_0_xy = X=102.7096:104.5798,Y=0.18:1.984
IF ($region_xz"0|*>1") THEN DEFINE SYMBOL region_($num)_xz = ($region_xz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xz = X=102.7096:104.5798
 !-> DEFINE SYMBOL region_0_xz = X=102.7096:104.5798
IF ($region_yt"0|*>1") THEN DEFINE SYMBOL region_($num)_yt = ($region_yt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yt = Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
 !-> DEFINE SYMBOL region_0_yt = Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"
IF ($region_yz"0|*>1") THEN DEFINE SYMBOL region_($num)_yz = ($region_yz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yz = Y=0.18:1.984
 !-> DEFINE SYMBOL region_0_yz = Y=0.18:1.984
IF ($region_zt"0|*>1") THEN DEFINE SYMBOL region_($num)_zt = ($region_zt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_zt = T="10-May-2011 09:00":"10-May-2011 09:00"
 !-> DEFINE SYMBOL region_0_zt = T="10-May-2011 09:00":"10-May-2011 09:00"
 
! For SOCAT server labels, 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 = 10-May-2011 09:00
   LET iz = STRINDEX("($region_0_t_lo)", " 00:00:00")
 !-> DEFINE VARIABLE iz = STRINDEX("10-May-2011 09:00", " 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("10-May-2011 09:00", ":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("10-May-2011 09:00", 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 = 10-May-2011 09:00
   LET iz = STRINDEX("($region_0_t_hi)", " 00:00:00")
 !-> DEFINE VARIABLE iz = STRINDEX("10-May-2011 09:00", " 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("10-May-2011 09:00", ":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("10-May-2011 09:00", 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 ------------------------------------------------------
GO LAS_initialize_data 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $RCSfile: LAS_initialize_data.jnl,v $
! $Revision: 1.2 $
!
! $Author: ansley $
! $Date: 2007/29/2007
!
! 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.
!
GO LAS_initialize_dataset ($1"0")
 !-> 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
 
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.
 
! 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??
 
IF ($data_($num)_chained"0|1|*>1) THEN
 !-> IF 0 THEN
ELSE
  DEFINE SYMBOL data_url \"($data_($num)_url)\"
 !-> DEFINE SYMBOL data_url \"http://localhost/thredds/dodsC/las/tmh_forecast.nc\";
ENDIF
 
IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var ($data_($num)_var)
 !-> IF 1 THEN DEFINE SYMBOL data_var va
 !-> DEFINE SYMBOL data_var va
DEFINE SYMBOL data_name ($data_($num)_name)
 !-> DEFINE SYMBOL data_name depth-averaged y-velocity of currents
IF `($data_($num)_name"0|*>1") EQ 0` THEN DEFINE SYMBOL data_name ($data_var)
 !-> IF 0 THEN DEFINE SYMBOL data_name va
 
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("va")`
 !-> DEFINE SYMBOL data_var = `UPCASE("va")`
 !-> DEFINE SYMBOL data_var = VA
LET varlen = `STRLEN("($data_var)")`
 !-> DEFINE VARIABLE varlen = 2
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 = VA
 !-> DEFINE SYMBOL data_var_nq = VA
   IF ($data_($num)_var"0|*>1") THEN DEFINE SYMBOL data_var = '($data_var)'
 !-> IF 1 THEN DEFINE SYMBOL data_var = 'VA'
 !-> DEFINE SYMBOL data_var = 'VA'
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%) 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 meter/second
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 (meter/second)
   IF `STRINDEX("($data_units)", "((") GT 0` THEN \
     DEFINE SYMBOL data_units ($data_($num)_units)
 !-> IF 0 THEN      DEFINE SYMBOL data_units meter/second
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 depth-averaged y-velocity of currents
 !-> DEFINE SYMBOL data_title depth-averaged y-velocity of currents
ELSE
ENDIF
 
DEFINE SYMBOL ferret_plot_title "($data_title) ($data_units)"
 !-> DEFINE SYMBOL ferret_plot_title "depth-averaged y-velocity of currents (meter/second)"
 
! SET DATA and check for errors
 
SET DATA ($data_url)
 !-> SET DATA "http://localhost/thredds/dodsC/las/tmh_forecast.nc";
 
! Use PPLUS symbol editing to check for units sent in as ""
PPL SET ulen $LENGTH(data_($num)_units)
 !-> PPL SET ulen $LENGTH(data_0_units)
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 ("meter/second")
   IF `(STRINDEX("($data_($num)_units)", "'") EQ 1) AND \
    (STRRINDEX("($data_($num)_units)", "'") EQ ulen)` THEN \
      DEFINE SYMBOL data_units `SUBSTRING("($data_($num)_units)", 2, ulen-2)`
 !-> IF 0 THEN       DEFINE SYMBOL data_units `SUBSTRING("meter/second", 2, ulen-2)`
ENDIF
 
 
IF ($fer_last_error"0|0|1|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
SET DATA "($data_($num)_url)"
 !-> SET DATA "http://localhost/thredds/dodsC/las/tmh_forecast.nc";
DEFINE SYMBOL dset($num) = `($data_($num)_var),RETURN=dsetnum`
 !-> DEFINE SYMBOL dset0 = 1
 
! Here do sanity checks on Ferret properties, such as dep_axis_scale
 
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
  ENDIF
  ENDIF
  ENDIF
     ENDIF
  ENDIF
ENDIF ! Checks on ferret_dep_axis_scale
 
! End of file ------------ LAS_check_fer_properties.jnl-------------------------------
 
 
! End of $RCSfile ------------LAS_initialize_dataset.jnl--------------------------
 
IF ($ferret_init_script"0|*>1") THEN GO ($ferret_init_script) ($1"0")
 !-> IF 1 THEN GO hydro_tmh_init 0
 !-> GO hydro_tmh_init 0
SET MEMORY/SIZE=10000
SHOW MEMORY
 Current size of FERRET memory cache: 1410 MegaWords  (1 word = 4 bytes)
 
DEFINE VARIABLE SPEEDCALC=(ua^2+va^2)^.5
!LET/TITLE="Speed (ua^2+va^2)^.5"/unites="m/s" speedcalc=(ua^2+va^2)^.5
 
 
 
IF ($ferret_init_commands"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
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
 
! 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
 
LET attlist = ($data_var).attnames
 !-> DEFINE VARIABLE attlist = 'VA'.attnames
IF ($data_var_nq"0|*>1") THEN LET attlist = ($data_var_nq).attnames
 !-> IF 1 THEN LET attlist = VA.attnames
 !-> LET attlist = VA.attnames
DEFINE SYMBOL data_var_only = `UPCASE("($data_var)")`
 !-> DEFINE SYMBOL data_var_only = 'VA'
 
IF ($ferret_bad_flag"0|*>1") THEN SET VAR/BAD=($ferret_bad_flag) ($data_var)
 !-> IF 0 THEN SET VAR/BAD=  'VA'
 
! 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
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
   ENDIF
ENDIF
 
IF ($check_for_pseudonames"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
ENDIF
 
DEFINE SYMBOL ferret_plot_title "($data_title) ($data_units)"
 !-> DEFINE SYMBOL ferret_plot_title "depth-averaged y-velocity of currents (meter/second)"
 
IF `($data_title"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
  ENDIF
ENDIF
 
 
DEFINE SYMBOL ferret_plot_var = ($data_var)[d=($data_num),($region_full)]
 !-> DEFINE SYMBOL ferret_plot_var = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"]
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 = 'VA'[d=1]
DEFINE SYMBOL ferret_plot_var_($num)_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_var_0_noregion = 'VA'[d=1]
 
DEFINE SYMBOL ferret_plot_base_var = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_plot_base_var = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"]
DEFINE SYMBOL ferret_plot_base_var_($num) = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_plot_base_var_0 = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"]
DEFINE SYMBOL ferret_plot_base_var_noregion = ($data_var)[d=($data_num)]
 !-> DEFINE SYMBOL ferret_plot_base_var_noregion = 'VA'[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 = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984]
DEFINE SYMBOL ferret_t_var = ($data_var)[d=($data_num),($region_t)]
 !-> DEFINE SYMBOL ferret_t_var = 'VA'[d=1,T="10-May-2011 09:00":"10-May-2011 09:00"]
 
! 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 = 'VA'[d=1,X=102.7096:104.5798]
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 = 'VA'[d=1]
 
! Apply any transforms that may have been specified.
GO LAS_transforms ($num)
 !-> 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
 
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_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-------------------------------
 
 
! 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
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
! 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.
 
! 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
 
! 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
 
! ---------------------------------------------------------------------
! Determine striding based on the memory allocation
 
DEFINE SYMBOL memsize = ($FERRET_MEMORY"6.4")* 1.e6
 !-> DEFINE SYMBOL memsize = 1410* 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 =  http://localhost/thredds/dodsC/las/tmh_forecast.nc
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
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 = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"]
DEFINE SYMBOL var_size = ($var_size"0") + `pvar,RETURN=size`
 !-> DEFINE SYMBOL var_size = 0 + 997002
 
! 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 = 999
   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 = 998
   IF `ysiz GT 1` THEN LET ndims = `ndims + 1`
 !-> IF 1 THEN LET ndims = `ndims + 1`
 !-> LET ndims = `ndims + 1`
 !-> DEFINE VARIABLE ndims = 2
   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 = 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)", "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
 
! ---------------------------------------------------------------------
! 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 1     THEN LET maxpix = 600
 !-> LET maxpix = 600
IF ($ferret_size"0|0.8333>1|*>0")  THEN LET maxpix = 700  ! large
 !-> IF 0  THEN LET maxpix = 700
 
IF `STRINDEX("($operation_ID)", "Anim" ) GT 0` THEN LET maxpix = 50
 !-> IF 1 THEN LET maxpix = 50
 !-> 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 = LON
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='VA'[d=1]]
   LET pixsize = `xx[($region_x)@ngd]`
 !-> DEFINE VARIABLE pixsize = 999
   IF ($ferret_google_plot"0|*>1") THEN
 !-> IF 0 THEN
     ENDIF
   ENDIF
 
   IF `pixsize GT maxpix` THEN DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
 !-> IF 1 THEN DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
 !-> DEFINE SYMBOL xstride = `INT((pixsize/maxpix)+1)`
 !-> DEFINE SYMBOL xstride = 20
   DEFINE SYMBOL xstride = `MAX(($xstride"1"), ($stride_for_mem"1"))`
 !-> DEFINE SYMBOL xstride = 20
 
! Check whether X axis is modulo. check_modulo_factor.jnl checks whether the
! axis is modulo and if so, whether the stride is a factor of the lentgh of
! the axis, resetting it if possible to retain the modulo character of the axis.
 
   GO check_modulo_factor x
! check_modulo_factor.jnl
! Check whether stride is an integer factor of the axis length
! and attempt to reset it if not.
 
! Argument is axis direction: x or t
 
DEFINE SYMBOL dir = `UPCASE("$1")`
 !-> DEFINE SYMBOL dir = X
IF `($($dir)stride) LE 1` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
DEFINE SYMBOL indx = i
IF `STRCMP("($dir)", "T") EQ 0` THEN  DEFINE SYMBOL indx = l
 !-> IF 0 THEN  DEFINE SYMBOL indx = l
 
! Check whether axis is modulo
DEFINE SYMBOL var_mod = "`($data_var)[d=($data_num)],RETURN=($dir)mod` "
 !-> DEFINE SYMBOL var_mod = "360 "
IF  `STRCMP (" ", ($var_mod)) EQ 0` THEN CANCEL SYMBOL var_mod
 !-> IF  0 THEN CANCEL SYMBOL var_mod
 
! See if an X axis is subspan modulo - if so we dont have to worry about losing
! modulo property with striding.
IF ($indx"|i>1|l>0") THEN
 !-> IF 1 THEN
   CANCEL MODE LONG_LABEL
   LET xaxlen = `($data_var),RETURN=xend` -  `($data_var),RETURN=xstart`
 !-> DEFINE VARIABLE xaxlen = 104.58166 -  102.70959
   SET MODE/LAST LONG_LABEL
   IF `xaxlen LT ($var_mod"0")` THEN DEFINE SYMBOL var_mod " "    ! its subspan modulo
 !-> IF bad THEN DEFINE SYMBOL var_mod " "
ENDIF
 
IF  `STRCMP (" ", ($var_mod)) EQ 0` THEN
 !-> IF  0 THEN
ELSE
! Reset the computed stride if necessary to make sure stride is an integer
! factor of axis length, else it loses its modulo property
 
   LET nn = `($data_var)[d=($data_num)],RETURN=($indx)size`
 !-> DEFINE VARIABLE nn = 1000
   LET del = INT(($($dir)stride)/2)
 !-> DEFINE VARIABLE del = INT(20/2)
   REPEAT/RANGE=1:`($($dir)stride)+del`/NAME=m \
        (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP; \
         LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP; \
         IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
 !-> REPEAT/RANGE=1:30/NAME=m         (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP;          LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP;          IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
!-> REPEAT: M:1
 !-> (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP;          LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP;          IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
 !-> LET nstride = `($($dir)stride)+m`
 !-> DEFINE VARIABLE nstride = 21
 !->  IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           LET nstride = `($($dir)stride)-m`
 !-> DEFINE VARIABLE nstride = 19
 !->  IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
!-> REPEAT: M:2
 !-> (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP;          LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP;          IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
 !-> LET nstride = `($($dir)stride)+m`
 !-> DEFINE VARIABLE nstride = 22
 !->  IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           LET nstride = `($($dir)stride)-m`
 !-> DEFINE VARIABLE nstride = 18
 !->  IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
!-> REPEAT: M:3
 !-> (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP;          LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP;          IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
 !-> LET nstride = `($($dir)stride)+m`
 !-> DEFINE VARIABLE nstride = 23
 !->  IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           LET nstride = `($($dir)stride)-m`
 !-> DEFINE VARIABLE nstride = 17
 !->  IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
!-> REPEAT: M:4
 !-> (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP;          LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP;          IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
 !-> LET nstride = `($($dir)stride)+m`
 !-> DEFINE VARIABLE nstride = 24
 !->  IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           LET nstride = `($($dir)stride)-m`
 !-> DEFINE VARIABLE nstride = 16
 !->  IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
 !->           IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP
 !-> IF 0 THEN EXIT/LOOP
!-> REPEAT: M:5
 !-> (LET nstride = `($($dir)stride)+m`; IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP;          LET nstride = `($($dir)stride)-m`; IF `MOD(nn,nstride) EQ 0 AND m GT 2` THEN EXIT/LOOP;          IF `nstride LE ($stride_for_mem"1")` THEN EXIT/LOOP)
 !-> LET nstride = `($($dir)stride)+m`
 !-> DEFINE VARIABLE nstride = 25
 !->  IF `MOD(nn,nstride) EQ 0` THEN EXIT/LOOP
 !-> IF 1 THEN EXIT/LOOP
 !-> EXIT/LOOP
 
! If we found a stride value that is an integer factor of the axis length,
! redefine the stride value.
 
   IF `MOD(nn,nstride) EQ 0` THEN DEFINE SYMBOL ($dir)stride = `nstride`
 !-> IF 1 THEN DEFINE SYMBOL Xstride = `nstride`
 !-> DEFINE SYMBOL Xstride = `nstride`
 !-> DEFINE SYMBOL Xstride = 25
   IF `MOD(nn,nstride) EQ 0` THEN EXIT/SCRIPT
 !-> IF 1 THEN EXIT/SCRIPT
 !-> EXIT/SCRIPT
   DEFINE SYMBOL axname = `($data_var)[d=($data_num)],RETURN=xaxis`
 !-> DEFINE SYMBOL axname = LON
   IF `STRINDEX("($axname)", "(") EQ 0` THEN
 !-> IF 1 THEN
      IF `($xstride) GT 1 AND ($axis_stride_($axname)"0") EQ 0` THEN
 !-> IF 1 THEN
         SET AXIS/STRIDE=($xstride) ($axname)
 !-> SET AXIS/STRIDE=25 LON
	 LET x_strided_var = ($data_var)[d=($data_num)]
 !-> DEFINE VARIABLE x_strided_var = 'VA'[d=1]
         DEFINE SYMBOL axis_stride_($axname) = ($xstride)
 !-> DEFINE SYMBOL axis_stride_LON = 25
      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 = LAT
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 1 THEN
 
   LET yy = y[gy=($data_var)[d=($data_num)]]
 !-> DEFINE VARIABLE yy = y[gy='VA'[d=1]]
   LET pixsize = `yy[($region_y)@ngd]`
 !-> DEFINE VARIABLE pixsize = 998
   IF ($ferret_google_plot"0|*>1") THEN
 !-> IF 0 THEN
     ENDIF
   ENDIF
 
   IF `pixsize GT maxpix` THEN DEFINE SYMBOL ystride = `2*INT((pixsize/maxpix)+1)`
 !-> IF 1 THEN DEFINE SYMBOL ystride = `2*INT((pixsize/maxpix)+1)`
 !-> DEFINE SYMBOL ystride = `2*INT((pixsize/maxpix)+1)`
 !-> DEFINE SYMBOL ystride = 40
   DEFINE SYMBOL ystride = `MAX(($ystride"1"), ($stride_for_mem"1"))`
 !-> DEFINE SYMBOL ystride = 40
   DEFINE SYMBOL axname = `($data_var)[d=($data_num)],RETURN=yaxis`
 !-> DEFINE SYMBOL axname = LAT
   IF `STRINDEX("($axname)", "(") EQ 0` THEN
 !-> IF 1 THEN
      IF `($ystride) GT 1 AND ($axis_stride_($axname)"0") EQ 0` THEN
 !-> IF 1 THEN
         SET AXIS/STRIDE=($ystride) ($axname)
 !-> SET AXIS/STRIDE=40 LAT
	 LET y_strided_var = ($data_var)[d=($data_num)]
 !-> DEFINE VARIABLE y_strided_var = 'VA'[d=1]
         DEFINE SYMBOL axis_stride_($axname) = ($ystride)
 !-> DEFINE SYMBOL axis_stride_LAT = 40
      ENDIF
   ENDIF
   IF ($SYMBOL no_region_y_range"0|*>1") THEN CANCEL SYMBOL region_y_range
 !-> IF 0 THEN CANCEL SYMBOL region_y_range
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
   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 = 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("10-May-2011 09:00", "10-May-2011 09:00")
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
   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 1 THEN
 
   DEFINE SYMBOL n_left_labels = `($n_left_labels"0")+1`
 !-> DEFINE SYMBOL n_left_labels = 1
   DEFINE SYMBOL upper_left_($n_left_labels) = Subsampled
 !-> DEFINE SYMBOL upper_left_1 = Subsampled
 
   IF `($xstride"0|1>0|*>1")` THEN
 !-> IF 1 THEN
      DEFINE SYMBOL upper_left_($n_left_labels) =\
         ($upper_left_($n_left_labels)) ($xstride) in X
 !-> DEFINE SYMBOL upper_left_1 =         Subsampled 25 in X
      LET need_comma = 1
   ENDIF
 
   IF `($ystride"0|1>0|*>1")` THEN
 !-> IF 1 THEN
      IF `need_comma GT 0` THEN DEFINE SYMBOL upper_left_($n_left_labels) =\
         ($upper_left_($n_left_labels)),
 !-> IF 1 THEN DEFINE SYMBOL upper_left_1 =         Subsampled 25 in X,
 !-> DEFINE SYMBOL upper_left_1 =         Subsampled 25 in X,
      DEFINE SYMBOL upper_left_($n_left_labels) =\
         ($upper_left_($n_left_labels)) ($ystride) in Y
 !-> DEFINE SYMBOL upper_left_1 =         Subsampled 25 in X, 40 in Y
      LET need_comma = 1
   ENDIF
 
   IF `($zstride"0|1>0|*>1")` THEN
 !-> IF 0 THEN
   ENDIF
 
   IF `($tstride"0|1>0|*>1")` THEN
 !-> IF 0 THEN
   ENDIF
 
ENDIF
 
! End of $RCSfile ------------LAS_set_strides.jnl--------------------------
 
 
! 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
 
! 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)") EQ 2` THEN
 !-> IF 1 THEN
      IF `(STRINDEX("($operation_ID)", "Plot") GT 0) OR (STRINDEX("($operation_ID)", "zoom") GT 0)` \
       THEN GO LAS_auto_levels
 !-> IF 0        THEN GO LAS_auto_levels
   ENDIF
ENDIF
 
! End of $RCSfile ------------LAS_initialize_variable.jnl--------------------------
 
! End of $RCSfile ------------LAS_initialize_data.jnl--------------------------
 
 
! Here is the variable we will list out, with the region specified.
DEFINE SYMBOL ferret_list_var = ($ferret_plot_var)
 !-> DEFINE SYMBOL ferret_list_var = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"]
 
IF ($do_curvi_xy"0") THEN
 !-> IF 0 THEN
ELSE
   LET the_var = ($ferret_plot_var)
 !-> DEFINE VARIABLE the_var = 'VA'[d=1,X=102.7096:104.5798,Y=0.18:1.984,T="10-May-2011 09:00":"10-May-2011 09:00"]
   DEFINE SYMBOL imin `the_var,return=xstart`
 !-> DEFINE SYMBOL imin 102.70959E
   DEFINE SYMBOL imax `the_var,return=iend`
 !-> DEFINE SYMBOL imax 41
   DEFINE SYMBOL isize `the_var,return=isize`
 !-> DEFINE SYMBOL isize 41
   DEFINE SYMBOL jmin `the_var,return=jstart`
 !-> DEFINE SYMBOL jmin 1
   DEFINE SYMBOL jmax `the_var,return=jend`
 !-> DEFINE SYMBOL jmax 25
   DEFINE SYMBOL jsize `the_var,return=jsize`
 !-> DEFINE SYMBOL jsize 25
ENDIF
 
DEFINE SYMBOL kmin `the_var,return=kstart`
 !-> DEFINE SYMBOL kmin 0
DEFINE SYMBOL kmax `the_var,return=kend`
 !-> DEFINE SYMBOL kmax 0
DEFINE SYMBOL ksize `the_var,return=ksize`
 !-> DEFINE SYMBOL ksize 1
DEFINE SYMBOL lmin `the_var,return=lstart`
 !-> DEFINE SYMBOL lmin 19
DEFINE SYMBOL lmax `the_var,return=lend`
 !-> DEFINE SYMBOL lmax 19
DEFINE SYMBOL lsize `the_var,return=lsize`
 !-> DEFINE SYMBOL lsize 1
 
! For vector plots, compute consistent vector length for the
! animation.
 
! For color or contour plots, LAS_auto_levels_animate checks whether
! symbols for color levels have been set, and if not, sets them for
! the variable at all time steps.
 
IF `($data_count"1") EQ 2` THEN
 !-> IF 0 THEN
ELSE
   GO LAS_auto_levels_animate
! LAS_auto_levels_animate.jnl
! ACM 8/22/2007
!
! acm 9/11/07 If its a descriptor file Ferret wont allow striding.
!             check for that case and just set num levels.
! acm* 2/2010 Set up a few things and then Use Ferret-s open-ended levels
!             if the levs havent been set by the user or configuration.
!             Allow for old algorithm if older Ferret is in place.
 
! Based on a variables value over its entire range, set strides
! if needed to quickly get stats on the variable. Use this to set levels.
 
! Argument: the variable to use in setting the levels.
 
! The symbol ferret_center_levels, if set to 1, forces the levels
! to be 2 std above and below zero. Otherwise use 2 std above
! and below the data mean
 
! This script should be done BEFORE any other striding is done.
! It operates on the variable on its entire native unstrided grid.
 
! input_fill_levels and input_contour_levels are symbols that are defined in
! LAS_initialize_variable.jnl, telling whether settings for levels were
! made
 
! Determine striding for speed in operating the STAT command
LET memsize = 0.5* 1.e6
 
! Make sure its a 2D plot operation.
 
DEFINE SYMBOL op = `UPCASE("($operation_ID)")`
 !-> DEFINE SYMBOL op = ANIMATION_2D_XY
 
!IF `($ferret_view"|xy>1|*>0") NE 1` THEN EXIT/SCRIPT
IF `STRINDEX("($op)", "VECTOR") GT 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
IF `STRINDEX("($op)", "ANIMATION") EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
 
! NOTE: animations have not been implemented for difference plots.
! If its a compare plot, and if the ($ferret_diff_var) is not yet defined,
! just return.
 
IF `($ferret_diff_var"1|*>0") AND STRINDEX("($op)", "COMPARE_PLOT") NE 0` THEN
 !-> IF 0 THEN
ENDIF
 
! Remove any previous native striding
 
IF ($xstride"0|1>0|*>1") THEN
 !-> IF 1 THEN
   CANCEL AXIS/STRIDE `($data_var)[d=($data_num)],RETURN=xaxis`
 !-> CANCEL AXIS/STRIDE (AX006)
   CANCEL SYMBOL xstride
ENDIF
IF ($ystride"0|1>0|*>1") THEN
 !-> IF 1 THEN
   CANCEL AXIS/STRIDE `($data_var)[d=($data_num)],RETURN=yaxis`
 !-> CANCEL AXIS/STRIDE (AX007)
   CANCEL SYMBOL ystride
ENDIF
IF ($tstride"0|1>0|*>1") THEN
 !-> IF 0 THEN
ENDIF
IF ($zstride"0|1>0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
DEFINE SYMBOL ferret_center_levels ($ferret_center_levels"0|1|TRUE>1|*>0")
 !-> DEFINE SYMBOL ferret_center_levels 0
 
! See if centered levels were requested, either by setting the symbol ferret_center_levels
! or with a contour_levels or fill_levels that is centered.
 
! See if centered levels were requested, either by setting the symbol ferret_center_levels
! or with a contour_levels or fill_levels that is centered.
 
! If contour levels requested with levels of nC, e.g. 20C, then get the value to
! set num_fine_levels in the %RANGE command below
 
! In general if other levels spec is given, return. However if it is a simple number,
! use that to set the number of fine levels.
 
IF ($ferret_contour_levels"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   ENDIF
ENDIF
 
 
IF ($ferret_fill_levels"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   ENDIF
ENDIF
 
! Apply to the variable on the requested region in x, y, z and all time.
 
IF `($ferret_plot_var"0|*>1") EQ 0` THEN EXIT/SCRIPT  !e.g. for insitu plots may not have a plot_var
 !-> IF 0 THEN EXIT/SCRIPT
 
IF `($do_curvi_xy"0|*>1") EQ 0` THEN
 !-> IF 0 THEN
ELSE
   DEFINE SYMBOL ferret_plot_var = pvar
ENDIF
 
IF ($ferret_plot_var"0|sampled_var>1|*>0) THEN LET pvar = ($ferret_plot_var)
 !-> IF 0 THEN LET pvar = pvar
 
LET var_size = ABS( `pvar,RETURN=size`)
 !-> DEFINE VARIABLE var_size = ABS( 997002)
DEFINE SYMBOL var_dim = `pvar,RETURN=shape`
 !-> DEFINE SYMBOL var_dim = XY
LET ndims = STRLEN("($var_dim)")
 !-> DEFINE VARIABLE ndims = STRLEN("XY")
 
LET stride_for_speed = `INT( 1+ ((var_size/memsize))/ndims )`
 !-> DEFINE VARIABLE stride_for_speed = 1
LET stride_for_speed = `INT( 1+ ((var_size/memsize)) )`
 !-> DEFINE VARIABLE stride_for_speed = 2
 
! If axes are not already strided, apply simple striding which
! we will undo later.
 
LET sampled_in_x = 0
LET sampled_in_y = 0
 
IF `stride_for_speed GT 1` THEN
 !-> IF 1 THEN
   LET sampled_in_x = STRCMP("`pvar,RETURN=xaxis`", "SAMPLE_XLON") EQ 0 OR\
                     STRCMP("`pvar,RETURN=xaxis`", "SAMPLE_X") EQ 0
 !-> DEFINE VARIABLE sampled_in_x = STRCMP("lon", "SAMPLE_XLON") EQ 0 OR                     STRCMP("lon", "SAMPLE_X") EQ 0
   LET sampled_in_y = STRCMP("`pvar,RETURN=yaxis`", "SAMPLE_YLAT") EQ 0 OR\
                     STRCMP("`pvar,RETURN=yaxis`", "SAMPLE_Y") EQ 0
 !-> DEFINE VARIABLE sampled_in_y = STRCMP("lat", "SAMPLE_YLAT") EQ 0 OR                     STRCMP("lat", "SAMPLE_Y") EQ 0
ENDIF
IF ($regrid_fcn"0|*>1") THEN DEFINE SYMBOL no_native_strides_xy = 1
 !-> IF 0 THEN DEFINE SYMBOL no_native_strides_xy = 1
 
! If already strided, dont do index strides.
 
LET max_size = 50
DEFINE SYMBOL scat = 0
IF ($data_x_var"0|*>1") THEN
 !-> IF 0 THEN
ENDIF
 
! region syms dont apply to native curv grid directly
! region syms also dont apply to insitu data (they are just on an abstract axis)
 
LET indx_strd_used = 0
IF `($do_curvi_xy"0") EQ 0 AND ($its_insitu"0") NE 1` THEN
 !-> IF 1 THEN
 
IF `($xstride"1|1>0|*>0") OR ($no_native_strides_xy"0|*>1")` THEN
 !-> IF 1 THEN
   LET xsize  `pvar,RETURN=isize`
 !-> DEFINE VARIABLE xsize  999
   IF `xsize GT max_size` THEN
 !-> IF 1 THEN
     IF ($clon_imin"0|*>1") THEN
 !-> IF 0 THEN
     ELIF ($scat"0|0|1|*>1") THEN
 !-> ELIF 0 THEN
     ELSE
        LET strd_lo = `i[gx=pvar,x=($region_x_lo)]`
 !-> DEFINE VARIABLE strd_lo = 1
        LET strd_hi = `i[gx=pvar,x=($region_x_hi)]`
 !-> DEFINE VARIABLE strd_hi = 999
     ENDIF
     DEFINE SYMBOL index_strides = i=`strd_lo`:`strd_hi`:`INT(xsize/10)`
 !-> DEFINE SYMBOL index_strides = i=1:999:99
     DEFINE SYMBOL xstride = `INT(xsize/10)`
 !-> DEFINE SYMBOL xstride = 99
     LET indx_strd_used = 1
   ELSE
   ENDIF
ELSE
ENDIF
 
IF `($ystride"1|1>0|*>0") OR ($no_native_strides_xy"0|*>1")` THEN
 !-> IF 1 THEN
   LET ysize  `pvar,RETURN=jsize`
 !-> DEFINE VARIABLE ysize  998
   IF `ysize GT max_size` THEN
 !-> IF 1 THEN
     IF ($clat_jmin"0|*>1") THEN
 !-> IF 0 THEN
     ELIF ($scat"0|0|1|*>1") THEN
 !-> ELIF 0 THEN
     ELSE
        LET strd_lo = `j[gy=pvar,y=($region_y_lo)]`


[Thread Prev][Thread Next][Index]


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

Privacy Policy | Disclaimer | Accessibility Statement