NOAA-PMEL / LAS

Live Access Server
https://ferret.pmel.noaa.gov/LAS/
The Unlicense
13 stars 5 forks source link

Ferret returns out of range error for in situ data on the X-axis. #537

Closed karlmsmith closed 6 years ago

karlmsmith commented 6 years ago

Reported by jeremy.malczyk on 1 Jul 2008 23:34 UTC Near as I can tell, this is a Ferret error and not an LAS configuration error. There are only 2 places, AFAIK, where the Lat and Lon domains are specified, the database_access and axes blocked in the dataset configuration xml. Both of these are set correctly (-180 to 180) but I keep gettign out of range errors on the x axis (it usually tells me the grid spans 0.5 to something huge, like 5545).

Perhaps more telling is that this error only seems to happen on queries that return less than about 200 points (although it is hard to tell, the smallest I have been able to retrieve is about 200).

It is entirely possible that this has been fixed in a recent scripts update .. this server's Ferret scripts were current as of (at least) 6/11/2008.

For a request: http://porter.pmel.noaa.gov:8580/OCDMS/ProductServer.do?xml=%3C%3Fxml+version%3D%221.0%22%3F%3E%3ClasRequest+package%3D%22%22+href%3D%22file%3Alas.xml%22+%3E%3Clink+match%3D%22%2Flasdata%2Foperations%2Foperation%5B%40ID%3D%27OCDMS_interactive_plot%27%5D%22+%2F%3E%3Cproperties+%3E%3Cferret+%3E%3Cview+%3Exy%3C%2Fview%3E%3Cformat+%3Egif%3C%2Fformat%3E%3COCDMS_palette+%3Erainbow%3C%2FOCDMS_palette%3E%3Cdeg_min_sec+%3Edefault%3C%2Fdeg_min_sec%3E%3Cmargins+%3Edefault%3C%2Fmargins%3E%3Cpoly_levels+%3E%3C%2Fpoly_levels%3E%3Cset_aspect+%3Edefault%3C%2Fset_aspect%3E%3Csize+%3E0.5%3C%2Fsize%3E%3Cuse_graticules+%3Edefault%3C%2Fuse_graticules%3E%3C%2Fferret%3E%3C%2Fproperties%3E%3Cargs+%3E%3Cconstraint+type%3D%22text%22+%3E%3Cv+%3Esubsampling%3C%2Fv%3E%3Cv+%3E%3D%3C%2Fv%3E%3Cv+%3Edata_24hourly%3C%2Fv%3E%3C%2Fconstraint%3E%3Clink+match%3D%22%2Flasdata%2Fdatasets%2FSOfCO2%2Fvariables%2Fatm_press%22+%2F%3E%3Cregion+%3E%3Crange+low%3D%22-178.0%22+type%3D%22x%22+high%3D%22-130.0%22+%2F%3E%3Crange+low%3D%22-6.0%22+type%3D%22y%22+high%3D%2228.0%22+%2F%3E%3Crange+low%3D%2217-Nov-1968+00%3A00%3A00%22+type%3D%22t%22+high%3D%2206-Nov-2008+00%3A00%3A00%22+%2F%3E%3C%2Fregion%3E%3C%2Fargs%3E%3C%2FlasRequest%3E&JSESSIONID=2DFF7A8F790EF98A15573F4753E8A2F6

The full debug output is as follows:

**ERROR: illegal limits: ATM_PRESS does not exist at X=-178:-130
          Axis extremes are X=0.5:974.5
STAT atm_press[d=1,X=-178:-130]
Command file, command group, or REPEAT execution aborted
STOP -script mode, ERROR RUNNING SCRIPT statement executed

go "$1"
 !-> go "/var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/WEB-INF/classes/resources/ferret/temp/ferret_operation_1214954929167.jnl"
! Symbols from the server
                        DEFINE SYMBOL constraint_0_lhs = subsampling
                                 DEFINE SYMBOL constraint_0_op = eq
                                 DEFINE SYMBOL constraint_0_rhs = data_24hourly
                                 DEFINE SYMBOL constraint_0_type = text
                                 DEFINE SYMBOL data_0_ID = atm_press
                                 DEFINE SYMBOL data_0_chained = true
                                 DEFINE SYMBOL data_0_dataset_ID = SOfCO2
                                 DEFINE SYMBOL data_0_dataset_name = Surface Ocean fCO2 Global Database (2008 Pfeil collection)
                                 DEFINE SYMBOL data_0_dataset_url = SOfCO2
                                 DEFINE SYMBOL data_0_file = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/E58E11D525CA6B614A3608604D4D7F93_netcdf.nc
                                 DEFINE SYMBOL data_0_grid_type = scattered
                                 DEFINE SYMBOL data_0_intervals = xyt
                                 DEFINE SYMBOL data_0_name = atm. pres. as reported
                                 DEFINE SYMBOL data_0_points = xyt
                                 DEFINE SYMBOL data_0_region = region_0
                                 DEFINE SYMBOL data_0_result = netcdf
                                 DEFINE SYMBOL data_0_title = atm. pres. as reported
                                 DEFINE SYMBOL data_0_units = hPa
                                 DEFINE SYMBOL data_0_url = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/E58E11D525CA6B614A3608604D4D7F93_netcdf.nc
                                 DEFINE SYMBOL data_0_var = atm_press
                                 DEFINE SYMBOL data_0_xpath = /lasdata/datasets/SOfCO2/variables/atm_press
                                 DEFINE SYMBOL data_count = 1
                                 DEFINE SYMBOL database_access_0_cruiseID = cruise_ID
                                 DEFINE SYMBOL database_access_0_db_host = localhost
                                 DEFINE SYMBOL database_access_0_db_login = las
                                 DEFINE SYMBOL database_access_0_db_name = SOfCO2gd_v1
                                 DEFINE SYMBOL database_access_0_db_passwd = lasrules
                                 DEFINE SYMBOL database_access_0_db_table = data
                                 DEFINE SYMBOL database_access_0_db_title = Surface Ocean fCO2 Global Database
                                 DEFINE SYMBOL database_access_0_db_type = mysql
                                 DEFINE SYMBOL database_access_0_latitude = Latitude
                                 DEFINE SYMBOL database_access_0_lon_domain = -180:180
                                 DEFINE SYMBOL database_access_0_longitude = Longitude
                                 DEFINE SYMBOL database_access_0_missing = -1E34
                                 DEFINE SYMBOL database_access_0_time = hours_1970
                                 DEFINE SYMBOL database_access_0_time_format = 1970-01-01 00:00:00
                                 DEFINE SYMBOL database_access_0_time_type = double
                                 DEFINE SYMBOL database_access_0_time_units = hours since 1970-01-01 00:00:00
                                 DEFINE SYMBOL database_access_0_timeout = 180
                                 DEFINE SYMBOL ferret_OCDMS_palette = rainbow
                                 DEFINE SYMBOL ferret_fill_type = fill
                                 DEFINE SYMBOL ferret_format = gif
                                 DEFINE SYMBOL ferret_land_type = contour
                                 DEFINE SYMBOL ferret_service_action = OCDMS_2D_poly
                                 DEFINE SYMBOL ferret_size = 0.5
                                 DEFINE SYMBOL ferret_view = xy
                                 DEFINE SYMBOL las_debug = debug
                                 DEFINE SYMBOL operation_ID = OCDMS_2D_poly
                                 DEFINE SYMBOL operation_key = 47680AEAB24DE6D5B29357ED5CEDB2C3
                                 DEFINE SYMBOL operation_name = OCDMS Map
                                 DEFINE SYMBOL operation_service = ferret
                                 DEFINE SYMBOL operation_service_action = OCDMS_2D_poly
                                 DEFINE SYMBOL product_server_0_ps_timeout = 3600
                                 DEFINE SYMBOL product_server_0_ui_timeout = 20
                                 DEFINE SYMBOL product_server_0_use_cache = true
                                 DEFINE SYMBOL region_0_t_hi = 06-Nov-2008 00:00:00
                                 DEFINE SYMBOL region_0_t_lo = 17-Nov-1968 00:00:00
                                 DEFINE SYMBOL region_0_x_hi = -130.0
                                 DEFINE SYMBOL region_0_x_lo = -178.0
                                 DEFINE SYMBOL region_0_y_hi = 28.0
                                 DEFINE SYMBOL region_0_y_lo = -6.0
                                 DEFINE SYMBOL result_count = 6
                                 DEFINE SYMBOL result_debug_ID = debug
                                 DEFINE SYMBOL result_debug_filename = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/47680AEAB24DE6D5B29357ED5CEDB2C3_debug.txt
                                 DEFINE SYMBOL result_debug_type = debug
                                 DEFINE SYMBOL result_map_scale_ID = map_scale
                                 DEFINE SYMBOL result_map_scale_filename = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/47680AEAB24DE6D5B29357ED5CEDB2C3_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 = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/47680AEAB24DE6D5B29357ED5CEDB2C3_plot_image.gif
                                 DEFINE SYMBOL result_plot_image_type = image
                                 DEFINE SYMBOL result_plot_postscript_ID = plot_postscript
                                 DEFINE SYMBOL result_plot_postscript_filename = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/47680AEAB24DE6D5B29357ED5CEDB2C3_plot_postscript.ps
                                 DEFINE SYMBOL result_plot_postscript_type = ps
                                 DEFINE SYMBOL result_ref_map_ID = ref_map
                                 DEFINE SYMBOL result_ref_map_filename = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/47680AEAB24DE6D5B29357ED5CEDB2C3_ref_map.gif
                                 DEFINE SYMBOL result_ref_map_type = image
                                 DEFINE SYMBOL result_rss_ID = rss
                                 DEFINE SYMBOL result_rss_filename = /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/B069BA09438C043E13F3AF3364A21971_rss.rss
                                 DEFINE SYMBOL result_rss_type = rss
                                 DEFINE SYMBOL ui_0_default = file:ui.xml#SOfCO2
         GO ($operation_service_action)
 !-> GO OCDMS_2D_poly
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! $Header$
!
! Creates a 2D plot with a blank 'basemap' and an overlay of points
! colored by the ($ferret_plot_var) defined in LAS_initialize_data_insitu.

! Initialize the region and data.
! Many useful symbols are defined by these two scripts.

DEFINE SYMBOL its_insitu = 1
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 = -178
  DEFINE SYMBOL region_x_hi = `INT(100000 * ($($region)_x_hi)) / 100000`
 !-> DEFINE SYMBOL region_x_hi = -130
  DEFINE SYMBOL limits_x = ($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL limits_x = -178:-130
  DEFINE SYMBOL limits_x_m360 = `($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL limits_x_m360 = -538:-490
  DEFINE SYMBOL limits_x_p360 = `($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL limits_x_p360 = 182:230
  DEFINE SYMBOL region_x = X=($region_x_lo):($region_x_hi)
 !-> DEFINE SYMBOL region_x = X=-178:-130
  DEFINE SYMBOL region_x_m360 X=`($region_x_lo)-360`:`($region_x_hi)-360`
 !-> DEFINE SYMBOL region_x_m360 X=-538:-490
  DEFINE SYMBOL region_x_p360 X=`($region_x_lo)+360`:`($region_x_hi)+360`
 !-> DEFINE SYMBOL region_x_p360 X=182:230
  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 = 48
  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 = -6
  DEFINE SYMBOL region_y_hi = `INT(1000 * ($($region)_y_hi)) / 1000`
 !-> DEFINE SYMBOL region_y_hi = 28
  DEFINE SYMBOL limits_y = ($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL limits_y = -6:28
  DEFINE SYMBOL region_y = Y=($region_y_lo):($region_y_hi)
 !-> DEFINE SYMBOL region_y = Y=-6:28
  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 = 34
  ELSE
  ENDIF
ENDIF

IF ($($region)_z_lo"0|*>1") THEN
 !-> IF 0 THEN
  ENDIF
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 = 17-Nov-1968 00:00:00
  DEFINE SYMBOL region_t_hi = ($($region)_t_hi)
 !-> DEFINE SYMBOL region_t_hi = 06-Nov-2008 00:00:00
  DEFINE SYMBOL limits_t \\"($region_t_lo)\\":\\"($region_t_hi)\\"
 !-> DEFINE SYMBOL limits_t \\"17-Nov-1968 00:00:00\\":\\"06-Nov-2008 00:00:00\\"
  DEFINE SYMBOL region_t T=\\"($region_t_lo)\\":\\"($region_t_hi)\\"
 !-> DEFINE SYMBOL region_t T=\\"17-Nov-1968 00:00:00\\":\\"06-Nov-2008 00:00:00\\"
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);
INSERT INTO "ticket" VALUES ($region_y)
 !-> DEFINE SYMBOL region_xy = X=-178:-130,Y=-6:28
  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=-178:-130
  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);
INSERT INTO "ticket" VALUES ($region_t)
 !-> DEFINE SYMBOL region_xt = X=-178:-130,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00: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=-6:28
  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);
INSERT INTO "ticket" VALUES ($region_t)
 !-> DEFINE SYMBOL region_yt = Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00: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="17-Nov-1968 00:00:00":"06-Nov-2008 00:00: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=-178:-130,Y=-6:28
  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);
INSERT INTO "ticket" VALUES ($region_t)
 !-> DEFINE SYMBOL region_xyt = X=-178:-130,Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00: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);
INSERT INTO "ticket" VALUES ($region_t)
 !-> DEFINE SYMBOL region_yzt = Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00: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);
INSERT INTO "ticket" VALUES ($region_t)
 !-> DEFINE SYMBOL region_xyzt = X=-178:-130,Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
  ELSE
  ENDIF
ELSE
  ENDIF
ENDIF

DEFINE SYMBOL region_full = ($region_xyzt)
 !-> DEFINE SYMBOL region_full = X=-178:-130,Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00: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=-178:-130
 !-> DEFINE SYMBOL region_0_x = X=-178:-130
IF ($region_y"0|*>1") THEN DEFINE SYMBOL region_($num)_y = ($region_y)
 !-> IF 1 THEN DEFINE SYMBOL region_0_y = Y=-6:28
 !-> DEFINE SYMBOL region_0_y = Y=-6:28
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="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
 !-> DEFINE SYMBOL region_0_t = T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
IF ($region_xt"0|*>1") THEN DEFINE SYMBOL region_($num)_xt = ($region_xt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xt = X=-178:-130,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
 !-> DEFINE SYMBOL region_0_xt = X=-178:-130,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
IF ($region_xy"0|*>1") THEN DEFINE SYMBOL region_($num)_xy = ($region_xy)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xy = X=-178:-130,Y=-6:28
 !-> DEFINE SYMBOL region_0_xy = X=-178:-130,Y=-6:28
IF ($region_xz"0|*>1") THEN DEFINE SYMBOL region_($num)_xz = ($region_xz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_xz = X=-178:-130
 !-> DEFINE SYMBOL region_0_xz = X=-178:-130
IF ($region_yt"0|*>1") THEN DEFINE SYMBOL region_($num)_yt = ($region_yt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yt = Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
 !-> DEFINE SYMBOL region_0_yt = Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
IF ($region_yz"0|*>1") THEN DEFINE SYMBOL region_($num)_yz = ($region_yz)
 !-> IF 1 THEN DEFINE SYMBOL region_0_yz = Y=-6:28
 !-> DEFINE SYMBOL region_0_yz = Y=-6:28
IF ($region_zt"0|*>1") THEN DEFINE SYMBOL region_($num)_zt = ($region_zt)
 !-> IF 1 THEN DEFINE SYMBOL region_0_zt = T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"
 !-> DEFINE SYMBOL region_0_zt = T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"

! 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 Jons_initialize_data_insitu 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! LAS_initialize_data_insitu.jnl
!
!
! Author: ansley
! Date: 2006/07/10 21:06:04
! 30-May-2008 ACM resolve #435 (and #336) if there is a query_result
!             attribute get that string and use it in the abort script
!
! The LAS_initialize_data_insitu.jnl script takes care of everything having to
! do with initializing a datset for later use.
!
! LAS_initialize_data_insitu.jnl takes an argument that specifies which data
! item [0|1|2|3|...] to create symbols for.

!ACM_note: if we use a loop in the plot routine, we are not
! limited to 9 data items
! DEFINE SYMBOL num ($1"0|0|1|2|3|4|5|6|7|8|9")

DEFINE SYMBOL num ($1"0")
 !-> DEFINE SYMBOL num 0

! 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.

IF ($data_($num)_chained"0|1|*>1") THEN
 !-> IF 1 THEN
  DEFINE SYMBOL data_url \\"($data_($num)_file)\\"
 !-> DEFINE SYMBOL data_url \\"/var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/E58E11D525CA6B614A3608604D4D7F93_netcdf.nc\\"
ELSE
ENDIF

! The x and y locations for insitu plots
! ACM note: These are assumed to be in the same dataset, along
!           with data_($num)_var if it exists, but we could
!           extend to different data sets with further symbols

DEFINE SYMBOL data_x_var = ($database_access_($num)_longitude)
 !-> DEFINE SYMBOL data_x_var = Longitude
DEFINE SYMBOL data_y_var = ($database_access_($num)_latitude)
 !-> DEFINE SYMBOL data_y_var = Latitude
DEFINE SYMBOL data_z_var = ($database_access_($num)_depth"undefined")
 !-> DEFINE SYMBOL data_z_var = undefined
DEFINE SYMBOL data_t_var = ($database_access_($num)_time"undefined")
 !-> DEFINE SYMBOL data_t_var = hours_1970

!!!DEFINE SYMBOL data_x_var ($data_($num)_x_var)
!!!DEFINE SYMBOL data_y_var ($data_($num)_y_var)

! The variable at the x and y locations

IF ($data_($num)_var"0|1|*>1") THEN DEFINE SYMBOL data_var ($data_($num)_var)
 !-> IF 1 THEN DEFINE SYMBOL data_var atm_press
 !-> DEFINE SYMBOL data_var atm_press
IF ($data_($num)_title"0|1|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title)
 !-> IF 1 THEN DEFINE SYMBOL data_title atm. pres. as reported
 !-> DEFINE SYMBOL data_title atm. pres. as reported

IF ($data_($num)_name"0|1|*>1") THEN DEFINE SYMBOL data_name ($data_($num)_name)
 !-> IF 1 THEN DEFINE SYMBOL data_name atm. pres. as reported
 !-> DEFINE SYMBOL data_name atm. pres. as reported
IF ($data_($num)_units"0|1|*>1") THEN DEFINE SYMBOL data_units ($data_($num)_units)
 !-> IF 1 THEN DEFINE SYMBOL data_units hPa
 !-> DEFINE SYMBOL data_units hPa

DEFINE SYMBOL ferret_plot_title ($data_title)
 !-> DEFINE SYMBOL ferret_plot_title atm. pres. as reported

! TODO:  Use new error features in Ferret to turn off STDERR and check
! TODO:  for Ferret error symbols to see if the SET DATA command actually worked.

! SET DATA and check for errors

!!!SET DATA ($data_url)
!!! Ferret 6.04 breaks with 'SET DATA' but not with 'USE' when the LAS extension '.netCDF' is encountered
USE ($data_url)
 !-> SET DAT/FORM=CDF "/var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/E58E11D525CA6B614A3608604D4D7F93_netcdf.nc"

sh sym fer_last_error
IF ($fer_last_error"0|*>1") THEN
 !-> IF 0 THEN
ENDIF

! LET nvars = ..nvars
! IF `nvars EQ 1` THEN
!   GO Jons_abort_no_data
! ENDIF

! Check for the global attribute query_result, and see if
! it contains a string No data found or other message

LET nglobal_atts = ..nattrs
LET global_attnames = ..attnames
IF `is_element_of_str(global_attnames, "query_result")` THEN
 !-> IF 0 THEN
ENDIF

LET data_num = `($data_x_var),return=dsetnum`
 !-> DEFINE VARIABLE data_num = 1
DEFINE SYMBOL data_num = `data_num`
 !-> DEFINE SYMBOL data_num = 1

! Define symbols rounding out the range of the data so points are
! not plotted on top of the axes.

STAT ($data_x_var)
 !-> STAT Longitude

             Longitude
             X: 0.5 to 974.5
             Y:  N/A
             Z:  N/A
             T:  N/A
             DATA SET: /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/E58E11D525CA6B614A3608604D4D7F93_netcdf.nc

 Total # of data points: 974 (974*1*1*1)
 # flagged as bad  data: 0
 Minimum value: -177.85
 Maximum value: -130.15
 Mean    value: -153.33 (unweighted average)
 Standard deviation: 12.419
PPL %RANGE `($stat_min)`, `($stat_max)`, 10
 !-> PPL %RANGE -177.85, -130.15, 10
DEFINE SYMBOL x_rounded_range = ($ppl$range_low):($ppl$range_high)
 !-> DEFINE SYMBOL x_rounded_range = -180.0:-130.0

STAT ($data_y_var)
 !-> STAT Latitude

             Latitude
             X: 0.5 to 974.5
             Y:  N/A
             Z:  N/A
             T:  N/A
             DATA SET: /var/www/html/tomcat_jeremy/tomcat/webapps/OCDMS/output/E58E11D525CA6B614A3608604D4D7F93_netcdf.nc

 Total # of data points: 974 (974*1*1*1)
 # flagged as bad  data: 0
 Minimum value: -6
 Maximum value: 27.91
 Mean    value: 7.4428 (unweighted average)
 Standard deviation: 9.5857
PPL %RANGE `($stat_min)`, `($stat_max)`, 10
 !-> PPL %RANGE -6, 27.91, 10
DEFINE SYMBOL y_rounded_range = ($ppl$range_low):($ppl$range_high)
 !-> DEFINE SYMBOL y_rounded_range = -10.00:30.00

IF ($ferret_init_script"0|*>1") THEN GO ($ferret_init_script) ($1"0")
 !-> IF 0 THEN GO   0

! There may be a variable representing measurements to use in coloring
! a track plot, etc.

IF ($data_var"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL ferret_plot_var = ($data_var)
 !-> DEFINE SYMBOL ferret_plot_var = atm_press
ENDIF

IF ($ferret_plot_title"0|*>1") THEN
 !-> IF 1 THEN
   SET VAR/TITLE="($ferret_plot_title)" ($data_var)[d=`data_num`]
 !-> SET VAR/TITLE="atm. pres. as reported" atm_press[d=1]
ELSE
ENDIF

! Mark whether there are contour levels set on first entry.
! Compute automatic open-ended levels.

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 ($ferret_poly_levels"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF

   LET its_plot = `STRINDEX(UPCASE("($operation_ID)"), "PLOT") GT 0`
 !-> DEFINE VARIABLE its_plot = 0
   IF `STRLEN("($ferret_view)") EQ 2 AND its_plot GT 0` THEN \\
     GO LAS_auto_levels
 !-> IF 0 THEN      GO LAS_auto_levels
   IF `STRLEN("($ferret_view)") EQ 2 AND STRINDEX("($operation_ID)", "poly") GT 0` THEN \\
     GO LAS_auto_levels
 !-> IF 1 THEN      GO LAS_auto_levels
 !-> GO LAS_auto_levels
! LAS_auto_levels.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.

! 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 = OCDMS_2D_POLY

IF `STRLEN("($ferret_view)") NE 2` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT
IF `STRINDEX("($op)", "VECTOR") GT 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT

IF `STRINDEX("($op)", "PLOT") EQ 0 AND \\
  STRINDEX ("($op)", "POLY") EQ 0 AND \\
  STRINDEX ("($op)", "ZOOM") EQ 0` THEN EXIT/SCRIPT
 !-> IF 0 THEN EXIT/SCRIPT

! Levels for animations set in LAS_auto_levels_animate,
! called in list_frames.jnl
IF `STRINDEX("($op)", "ANIMATION") GT 0`  THEN EXIT/SCRIPT
 !-> IF 0  THEN EXIT/SCRIPT

! 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

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.

! 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

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

! When its a curvi plot, base the levels on the variable using coordinates
! in the region. Use further striding to make this operation fast.

IF `($native_curvilinear_xy"0") OR ($region_sample"0|*>1")` THEN
 !-> IF 0 THEN
ELSE
   IF `($do_hybrid_z"0") + ($do_curvi_xy_and_hybrid_z"0") GT 0`  THEN
 !-> IF 0  THEN
   ELSE
!      LET pvar = ($ferret_xyz_var)
      LET pvar = ($ferret_plot_var)
 !-> DEFINE VARIABLE pvar = atm_press
      IF ($set_ndx_strides"0|*>1") THEN LET pvar = ($data_var)[d=($data_num);
INSERT INTO "ticket" VALUES ($region_xyzt)]
 !-> IF 0 THEN LET pvar = atm_press[d=1,X=-178:-130,Y=-6:28,T="17-Nov-1968 00:00:00":"06-Nov-2008 00:00:00"]
      IF ($auto_lev_var"0|*>1") THEN LET pvar = ($auto_lev_var)
 !-> IF 0 THEN LET pvar =
   ENDIF
ENDIF

!IF ($ferret_plot_var"0|sampled_var>1|*>0) THEN LET pvar = ($ferret_plot_var)

IF ($ferret_plot_var"0|sampled_var>1|*>0) THEN LET pvar = ($ferret_plot_var)
 !-> IF 0 THEN LET pvar = atm_press

! IF ($do_curvi_xy_and_hybrid_z"0") THEN LET pvar = plot_var

! If the ferret_diff_var has been defined, use it.
! When no levels are defined, use centered ones for a diff variable
IF ($ferret_diff_var"0|*>1") THEN
 !-> IF 0 THEN
   ENDIF
   ENDIF
   ENDIF
ENDIF

!IF ($do_trans_1_seas_per_year"0") THEN LET pvar = ($FERRET_PLOT_BASE_VAR)

LET var_size = ABS( `pvar,RETURN=size`)
 !-> DEFINE VARIABLE var_size = ABS( 974)
DEFINE SYMBOL var_dim = `pvar,RETURN=shape`
 !-> DEFINE SYMBOL var_dim = X

LET ndims = STRLEN("($var_dim)")
 !-> DEFINE VARIABLE ndims = STRLEN("X")

LET stride_for_speed = `INT( 1+ ((var_size/memsize))/ndims )`
 !-> DEFINE VARIABLE stride_for_speed = 1

! 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 0 THEN
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 1 THEN
   DEFINE SYMBOL scat = 1
   LET max_size = 10000  ! striding on in-situ data
ENDIF

IF `($native_curvilinear_xy"0") EQ 0` THEN  ! region syms dont apply to native curv grid directly
 !-> IF 1 THEN

!IF `($xstride"0|1>0|*>1") OR ($no_native_strides_xy"0|*>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  974
   IF `xsize GT max_size` THEN
 !-> IF 0 THEN
     ENDIF
   ELSE
      IF `($region_sample"0|*>1") EQ 0` THEN DEFINE SYMBOL  index_strides = ($region_x)
 !-> IF 1 THEN DEFINE SYMBOL  index_strides = X=-178:-130
 !-> DEFINE SYMBOL  index_strides = X=-178:-130
   ENDIF
ENDIF

!IF `($ystride"0|1>0|*>1") OR ($no_native_strides_xy"0|*>1")` THEN
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  1
   IF `ysize GT max_size` THEN
 !-> IF 0 THEN
     ENDIF
     ENDIF
   ELSE
      IF ($index_strides"0|*>1") THEN
 !-> IF 1 THEN
         IF `($region_y"0|*>1") AND ($scat) EQ 0` THEN \\
         DEFINE SYMBOL index_strides = ($index_strides);
INSERT INTO "ticket" VALUES ($region_y)
 !-> IF 0 THEN          DEFINE SYMBOL index_strides = X=-178:-130,Y=-6:28
      ELSE
      ENDIF
   ENDIF
ENDIF

IF `($zstride"0|1>0|*>1") OR ($no_native_strides_xy"0|*>1")` THEN
 !-> IF 0 THEN
     ENDIF
      ENDIF
   ENDIF
ENDIF

IF `($tstride"0|1>0|*>1") OR ($no_native_strides_xy"0|*>1")` THEN
 !-> IF 0 THEN
      ENDIF
      ENDIF
   ENDIF
ENDIF

ENDIF ! region syms dont apply to native curv grid directly

IF ($index_strides"0|*>1") THEN
 !-> IF 1 THEN
   DEFINE SYMBOL ppvar = ($data_var)[d=($data_num);
INSERT INTO "ticket" VALUES ($index_strides)]
 !-> DEFINE SYMBOL ppvar = atm_press[d=1,X=-178:-130]
ELSE
ENDIF

IF ($native_curvilinear_xy"0") THEN DEFINE SYMBOL ppvar = pvar
 !-> IF 0 THEN DEFINE SYMBOL ppvar = pvar

! IF ($ferret_var_autolevels_0"0|*>1") THEN DEFINE SYMBOL ppvar = ($ferret_var_autolevels_0)
! IF `($data_count"0") GT 1` THEN DEFINE SYMBOL ppvar = \\
!    ($ferret_var_autolevels_0) - ($ferret_var_autolevels_1)

! Execute the stat command to load symbols with the variables
! mean, max, min, std.

DEFINE SYMBOL stat_ngood= 0
STAT ($ppvar)
 !-> STAT atm_press[d=1,X=-178:-130]

Migrated-From: http://dunkel.pmel.noaa.gov/trac/las/ticket/531

karlmsmith commented 6 years ago

Modified by jeremy.malczyk on 1 Jul 2008 23:36 UTC

karlmsmith commented 6 years ago

Comment by steven.c.hankin on 1 Jul 2008 23:56 UTC There is definitely some kind of script error -- or an incorrect passing of symbols to the script. The carbon cruise variables returned from the database are ungridded, which means (I presume) that Ferret sees them on a 1D grid which is simply an X axis that runs from 1, ..., Npoints. The line of the Ferret script that gives the error is

   STAT atm_press[d=1,X=-178:-130]

In this command Ferret is being asked for atm_press based upon its longitude range -- as if it were a gridded variable. Wrong logic.

karlmsmith commented 6 years ago

Comment by @AnsleyManke on 8 Jul 2008 18:17 UTC I think this is fixed, it was a bug in the Ferret scripts, and the fix checked in June 16 [r3061] on the trunk and also checked in on the v7.0.beta branch. The comment in the script is: ''! region syms also dont apply to insitu data (they are just on an abstract axis)''

Jeremy's original request wont run right now, but below is one which I believe is similar.

To test this Jeremy, you can update only the Ferret scripts if you don't want to take the time to update everything on your test server. Update the ferret scripts, and copy them to these directories as set up in a CUSTOMIZATION directory, $(ARMSTRONG_HOME)/WebContent/WEB-INF/classes/resources/ferret/scripts/ $(CATALINA_HOME)/webapps/$(LAS_NAME)/WEB-INF/classes/resources/ferret/scripts/

http://porter.pmel.noaa.gov:8387/las/ProductServer.do?xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%3ClasRequest%20package%3D%22%22%20href%3D%22file%3Alas.xml%22%3E%3Clink%20match%3D%22/lasdata/operations/operation[@ID%3D%27OCDMS_interactive_plot%27]%22%3E%3C/link%3E%3Cproperties%3E%3Cferret%3E%3Cview%3Exy%3C/view%3E%3Cformat%3Egif%3C/format%3E%3COCDMS_palette%3Erainbow%3C/OCDMS_palette%3E%3Cdeg_min_sec%3Edefault%3C/deg_min_sec%3E%3Cmargins%3Edefault%3C/margins%3E%3Cpoly_levels%3E%3C/poly_levels%3E%3Cset_aspect%3Edefault%3C/set_aspect%3E%3Csize%3E0.5%3C/size%3E%3Cuse_graticules%3Edefault%3C/use_graticules%3E%3C/ferret%3E%3C/properties%3E%3Cargs%3E%3Cconstraint%20type%3D%22text%22%3E%3Cv%3Esubsampling%3C/v%3E%3Cv%3E%3D%3C/v%3E%3Cv%3Edata_24hourly%3C/v%3E%3C/constraint%3E%3Clink%20match%3D%22/lasdata/datasets/NDP_088/variables/pCO2_sw%22%3E%3C/link%3E%3Cregion%3E%3Crange%20type%3D%22t%22%20low%3D%2217-Nov-1968%2000%3A00%3A00%22%20high%3D%2206-Nov-2008%2000%3A00%3A00%22%3E%3C/range%3E%3Crange%20low%3D%22-170%22%20type%3D%22x%22%20high%3D%22-160%22%3E%3C/range%3E%3Crange%20low%3D%22-5%22%20type%3D%22y%22%20high%3D%225%22%3E%3C/range%3E%3C/region%3E%3C/args%3E%3C/lasRequest%3E