From 51a09bb47b35ff4b6768c0d3d0c08e5fc29de9b0 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Thu, 20 Aug 2020 09:10:13 -0700 Subject: [PATCH 01/15] Changes for LAS scripts using DSG-enabled PyFerret --- .../ferret/scripts/LAS_annotations_xml.jnl | 3 +- .../scripts/LAS_draw_multi_line_plot.jnl | 3 +- .../ferret/scripts/LAS_initial_setup.jnl | 11 +- .../ferret/scripts/LAS_initialize_data.jnl | 2 +- .../scripts/LAS_initialize_feature_id.jnl | 47 +- .../scripts/LAS_insitu_write_webrowset.jnl | 18 +- .../resources/ferret/scripts/LAS_is_range.jnl | 17 +- .../ferret/scripts/LAS_pp_colorby_feature.jnl | 302 +++------ .../scripts/LAS_pp_set_region_labels.jnl | 3 +- .../resources/ferret/scripts/LAS_regressx.jnl | 7 +- .../resources/ferret/scripts/LAS_results.jnl | 12 +- .../scripts/LAS_set_plot_qualifiers.jnl | 46 +- .../ferret/scripts/LAS_setup_dsg.jnl | 78 ++- .../ferret/scripts/LAS_xytvar_setup.jnl | 627 +++--------------- .../ferret/scripts/Plot_2D_Profile.jnl | 14 +- .../ferret/scripts/Profile_2D_poly.jnl | 66 +- .../scripts/Timeseries_station_plot.jnl | 626 +++++++---------- .../ferret/scripts/Trajectory_2D_poly.jnl | 213 ++---- .../scripts/Trajectory_Data_Convert_File.jnl | 5 +- .../ferret/scripts/Trajectory_corr_File.jnl | 21 +- .../ferret/scripts/dsg_find_roles.jnl | 128 +--- .../feature_initialize_data_insitu.jnl | 320 +-------- .../scripts/feature_initialize_vars.jnl | 2 +- .../resources/ferret/scripts/feature_key.jnl | 7 +- .../ferret/scripts/feature_labels.jnl | 158 +---- .../ferret/scripts/feature_list_mask.jnl | 107 ++- .../scripts/feature_lon_lat_time_depth.jnl | 110 +-- .../ferret/scripts/insitu_pie_xy.jnl | 2 +- .../ferret/scripts/insitu_waterfall_xz.jnl | 337 +--------- .../ferret/scripts/insitu_waterfall_yz.jnl | 327 +-------- .../ferret/scripts/insitu_waterfall_zt.jnl | 360 +--------- .../resources/ferret/scripts/key_at_top.jnl | 11 +- .../ferret/scripts/list_a_variable.jnl | 4 + .../resources/ferret/scripts/list_data.jnl | 55 +- .../ferret/scripts/list_prop_prop.jnl | 419 +----------- .../ferret/scripts/list_traj_data.jnl | 103 +-- .../resources/ferret/scripts/make_c_lab.jnl | 23 +- .../ferret/scripts/prop_prop_map_thumb.jnl | 39 +- .../ferret/scripts/prop_prop_plot.jnl | 405 ++++++----- .../ferret/scripts/set_constraint_labels.jnl | 2 + .../resources/ferret/scripts/set_linesym.jnl | 10 +- .../ferret/scripts/setup_dsg_variables.jnl | 188 +----- .../ferret/scripts/setup_prop_prop.jnl | 255 ++++--- .../ferret/scripts/setup_watch_circle.jnl | 21 +- 44 files changed, 1358 insertions(+), 4156 deletions(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl b/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl index 81bd0a79c..00399d6f6 100644 --- a/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl @@ -32,7 +32,8 @@ DEFINE SYMBOL out = GO write_to_xml ! orthogonal axis labels -IF `($longitude_lab%0|*>1%)+($latitude_lab%0|*>1%)+($depth_lab%0|*>1%)+($time_lab%0|*>1%)+($ens_lab%0|*>1%)+($forecast_lab%0|*>1%) GT 0` THEN \ + +IF `($longitude_lab%0|*>1%)+($latitude_lab%0|*>1%)+($depth_lab%0|*>1%)+($time_lab%0|*>1%)+($year_lab%0|*>1%)+($ens_lab%0|*>1%)+($forecast_lab%0|*>1%) GT 0` THEN \ GO annotation_orthogonal_axes ! variable and dataset labels diff --git a/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl b/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl index 182777ced..5307ea9d0 100644 --- a/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl @@ -69,8 +69,7 @@ IF `($have_multiline_defs"0|*>1") EQ 0` THEN LET title_len = `MAX(tlen, title_len)`;\ DEFINE SYMBOL units_($qdat) = `UPCASE("($data_($qdat)_units)")`;\ DEFINE SYMBOL all_units_same = `($all_units_same) AND (STRCMP("($units_0)", "($units_($qdat))") EQ 0)`;\ - GO LAS_pp_set_region_labels \ - ) + GO LAS_pp_set_region_labels ) DEFINE SYMBOL plot_vars_0 = ($plot_arg) ENDIF ! have_multiline_defs diff --git a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl index 00889852f..9d52e3064 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl @@ -12,10 +12,6 @@ SET MODE VERIFY:ALWAYS -! Put into the debug output what PyFerret/Ferret is running, and when. - -SHOW SYMBOL ferret_version, ferret_platform, program_name, current_date - DEFINE SYMBOL initialize_script_arg = ($1"2") ! Make sure to do the SET REDIRECT just once. @@ -25,7 +21,12 @@ DEFINE SYMBOL initial_setup_done = 1 ! Put the output into the log file so that FshowGO will list ! the tree of GO script calls. -SET REDIRECT/APPEND/TEE/file="($result_debug_filename)" STDOUT,STDERR +SET REDIRECT/CLOBBER/TEE/file="($result_debug_filename)" STDOUT,STDERR + +! Put into the debug output what PyFerret/Ferret is running, and when. + +SHOW SYMBOL ferret_version, ferret_platform, program_name, current_date +SHOW MEMORY IF `($initialize_script_arg) EQ 0` THEN EXIT/SCRIPT diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl index 3a4f3300d..c7857e566 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl @@ -40,6 +40,6 @@ IF `($ferret_memory"25.6") LT 100` THEN SET MEM/SIZ=300 ! If a Ferret property ferret_add_a_note is set, define a note that will ! be added to the annotations box. The note may contain a URL. -GO LAS_note_from_property +IF ($ferret_add_a_note"0|*>1") THEN GO LAS_note_from_property ! End of ------------LAS_initialize_data.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl index b3beb558d..65f291237 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl @@ -1,10 +1,15 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! LAS_initialize_feature_id.jnl +! ACM 8/2020 version for DSG datasets ! ! Define variables and symbols based on feature (trajecotory or profile) ! identification variables +! NOTE: For trajectory set, the calculation of individual features only works if the +! NOTE: intermediate netCDF files is ordered by feature_ID. Make sure that +! NOTE: the SQL query ends with: 'ORDER BY feature_ID'. + ! -! FEATURES - unique identifier for each cruise +! FEATURES - unique identifier for each feature ! FEATURE_COUNTS - number of points per trajectory Now use symbol rowvar IF ($nodata"0|*>1") THEN EXIT/SCRIPT @@ -12,70 +17,46 @@ IF `($ferret_memory"25.6") LT 200` THEN SET MEM/siz=200 ! Create the 'feature_evnt' variable which increments for each new trajectory. -! NOTE: The calculation of individual cruises only works if the -! NOTE: intermediate netCDF files is ordered by cruise_ID. Make sure that -! NOTE: the SQL query ends with: 'ORDER BY cruise_ID'. - DEFINE SYMBOL feature_max_labels = 200 -DEFINE SYMBOL numobs `($ferret_plot_var),return = isize` - LET featurevar = ($rowvar) -LET nfeatures = `featurevar,RETURN=($rind)size` -!If undefined, set up the feature_numbers variable -DEFINE AXIS/X=1:`nfeatures`:1 xfeature_axis - -IF `($have_feature_nums"0|*>1") EQ 0` THEN LET feature_numbers = x[gx=xfeature_axis] +IF `($have_feature_nums"0|*>1") EQ 0` THEN LET feature_numbers = _m[ge=featurevar] ! rind is direction of rowsize, defined in feature_initialize -LET longest = featurevar[($rind)=@max]+2 - -LET data_var_c = EXPNDI_BY_Z_COUNTS(longitude, xsequence(featurevar),`longest`) -LET id_by_c = EXPNDI_ID_BY_Z_COUNTS(xsequence(featurevar),`longest`) +LET longest = `rowsize[e=@max]` + 2 ! If dsg file then these symbols are set up. IF `($data_($num)_var"0|($feature_variable)>1|*>0") AND ($rowvar"0|*>1")` THEN - LET data_var_id = EXPND_BY_LEN(feature_numbers,($rowvar), `($rowvar)[M=@sum]`) - IF ($feature_type"0|*>1") THEN SET VAR/TITLE="($feature_type) ID" data_var_id - DEFINE SYMBOL data_var = data_var_id + DEFINE SYMBOL data_var = feature_numbers EXIT/SCRIPT ENDIF IF `($its_prop_prop_plot"0|*>1") EQ 0` THEN - LET data_var_id = EXPND_BY_LEN(feature_numbers,XSEQUENCE(featurevar), `featurevar[M=@sum]`) - IF ($feature_type"0|*>1") THEN SET VAR/TITLE="($feature_type) ID" data_var_id - DEFINE SYMBOL data_var = data_var_id - + DEFINE SYMBOL data_var = feature_numbers EXIT/SCRIPT ENDIF -! If a subset of cruise ids is given then only plot those on a Prop/Prop +! If a subset of feature ids is given then only plot those on a Prop/Prop ! plot, but using the symbols and colors as determined by the whole dataset. ! If given, traj_list is a list of numbers. IF ($ferret_traj_list"0|*>1") THEN LET subset_ids = {($ferret_traj_list)} - LET n_subset = `subset_ids,RETURN=isize` ! Define a mask to use on the entire list of values: plot or not to plot ! the polygons on the prop-prop plot. LET subm_ids = IF ELEMENT_INDEX(traj_numbers,subset_ids) THEN 1 IF `($subset_mask"0|*>1") EQ 0` THEN LET subset_mask = subm_ids + 0*x[x=1:`ntrajs`] ! put it on a non-abstract axis. - -! apply mask as data_var_c* subset_mask - - LET n_subset = `subset_mask[I=@NGD]` - DEFINE SYMBOL cruises_shown = `n_subset` - DEFINE SYMBOL prof_traj_shown = `n_subset` + SET DATA/FMASK=subset_mask ($num) ELSE -! There may be a subset already defined from ferret_cruise_list +! There may be a subset already defined from ferret_feature_list IF `($subset_mask"0|*>1") EQ 0` THEN LET subset_mask = 1 + 0*i[i=1:`nfeatures`] LET n_subset = `subset_mask[I=@NGD]` - DEFINE SYMBOL cruises_shown = `n_subset` + DEFINE SYMBOL features_shown = `n_subset` DEFINE SYMBOL prof_traj_shown = `n_subset` ENDIF diff --git a/JavaSource/resources/ferret/scripts/LAS_insitu_write_webrowset.jnl b/JavaSource/resources/ferret/scripts/LAS_insitu_write_webrowset.jnl index 0560282e6..5a49eb737 100644 --- a/JavaSource/resources/ferret/scripts/LAS_insitu_write_webrowset.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_insitu_write_webrowset.jnl @@ -2,7 +2,7 @@ ! LAS_insitu_write_webrowset.jnl ! ! -! Make a LIST/QUIET of the ID number and Cruise ID to go back +! Make a LIST/QUIET of the ID number and Feature ID to go back ! for possible subsets of this set of cruises. CANCEL MODE VERIFY @@ -12,21 +12,22 @@ IF `($result_icon_webrowset_filename"0|*>1") EQ 0` THEN EXIT/SCRIPT ENDIF -! Write all the counter numbers and the cruise IDs in the webrowset format. -! For SOCAT 3, cruise_id cruise_name are identical to cruise_expocode +IF ($subset_mask"0|*>1") THEN CANCEL DATA/FMASK 1 -IF ($feature_variable"0|*>1") THEN +! Write all the counter numbers and the cruise IDs in the webrowset format. +! For SOCAT 3, feature_id feature_name are identical to expocode - let imask = i[gx=xmask_axis] +IF ($feature_name"0|*>1") THEN - let webrow_mask = XSEQUENCE(feature_mask)* imask + define axis/x=1:`nfeatures`:1 xaxtest + let imask = x[gx=xaxtest] ! What do we want here? write_webrow with imask would put out the full key, ! or write_webrow_icon with webrow_mask would make a subset key, listing names and numbers 1, 3, 5, ... ! If writing the whole key, we can use write_webrow: - LOAD write_webrow_gwt(XSEQUENCE(($feature_variable)), XSEQUENCE(($feature_variable)), XSEQUENCE(imask), "($result_icon_webrowset_filename)") + LOAD write_webrow_gwt(XSEQUENCE(($feature_name)), XSEQUENCE(($feature_name)), imask, "($result_icon_webrowset_filename)") ENDIF @@ -39,7 +40,4 @@ IF ($debug_mode"0|*>1") THEN SAY ----- debug mode Webrowset xml ($secs) ----- ENDIF - -!!!! - ! End of file ------------ LAS_insitu_write_webrowset.jnl -------------------------- diff --git a/JavaSource/resources/ferret/scripts/LAS_is_range.jnl b/JavaSource/resources/ferret/scripts/LAS_is_range.jnl index 3a3d4467e..cf97d70e3 100644 --- a/JavaSource/resources/ferret/scripts/LAS_is_range.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_is_range.jnl @@ -4,6 +4,7 @@ ! Given a min and max variables defined, see if they are valid data ! and use them to define axis min,max, delta. If min and max are not ! valid then return nominal 0:100 and set an error flag. +! 8/19 *acm* more bad-value handling ! 2/25/2020 ACM robust method usin Ferret/PyFerret internal method ! to set range for constant-valued data @@ -11,20 +12,30 @@ LET baddat = 0 CANCEL SYMBOL dm_labels -LET ok = IFV ($1) THEN 1 ELSE 0 +IF ($1"0|bad>1|*>0") THEN + let ok = 0 +ELSE + LET ok = IFV (($1)) THEN 1 ELSE 0 +ENDIF + IF `ok` THEN DEFINE SYMBOL ax_lo = `($1)` ELSE DEFINE SYMBOl ax_lo = bad ENDIF -LET ok = IFV ($2) THEN 1 ELSE 0 + +IF ($2"0|bad>1|*>0") THEN + let ok = 0 +ELSE + LET ok = IFV (($2)) THEN 1 ELSE 0 +ENDIF + IF `ok` THEN DEFINE SYMBOL ax_hi = `($2)` ELSE DEFINE SYMBOl ax_hi = bad ENDIF - IF `($ax_lo"0|bad>1|*>0") OR ($ax_hi"0|bad>1|*>0")` THEN LET ax_lo = 0 LET amin = 0 diff --git a/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl b/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl index d3fe20a20..55e2b4e2f 100644 --- a/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl @@ -6,10 +6,9 @@ ! Create a new title that includes subsampling info ! Restart setting plot qualifiers for correlation plot. - -! 3/14/2018 Initial changes to take advantage of PyFerret symbols to replace -! use of slow outlined polygons. Currently only draws triangles, -! need to implelement a list of symbol names replacing /sym=triufill +! +! 4/2019 redo for DSG datasets. The feature-mask if any is already +! applied to the dataset. DEFINE SYMBOL qualifiers = /NOLAB @@ -20,206 +19,92 @@ IF `($data_1_var"0|*>1") EQ 0` THEN EXIT/PROGRAM ENDIF -LET n_in_mask = constraints_mask[i=@ngd] + +let nmasked_var = XSEQUENCE(constraints_mask) +LET n_in_mask = nmasked_var[i=@ngd] + IF `n_in_mask eq 0` THEN DEFINE SYMBOL put_label = 1 EXIT/SCRIPT ENDIF -DEFINE SYMBOL feature_max = `($rowvar),RETURN=size` - -! The mask is 1 for start of features - -LET feature_id = _M[GE=featurevar] -LET feature_len =($rowvar) - -IF ($subset_mask"0|*>1") THEN - LET feature_id = ESEQUENCE(subset_mask) * _M[GE=featurevar] - LET feature_len = ESEQUENCE(subset_mask) * ($rowvar) -ENDIF - -LET idvar = EXPND_BY_LEN(feature_id, ($rowvar), ($rowvar)[m=@sum]) - - - -! Masking for constraints may mean not all are shown. Recompute cruises_shown. - -LET idvar_masked = idvar * var_mask -LET count_nf = 0 -LET count_orig = 0 - -IF `($feature_max) LE ($feature_max_labels)` THEN - REPEAT/RANGE=1:`($rowvar),RETURN=msize`/NAME=ic (\ - DEFINE SYMBOL ic = `ic` ;\ - DEFINE SYMBOL nf = `idvar_masked[I=@LOC:($ic)]` ;\ - DEFINE SYMBOL cruise_is = ($nf"0|bad>0|*>($ic)") ;\ - LET count_nf = `count_nf + ($nf"0|bad>0|*>1")` ;\ - IF `($cruise_is) GT 0` THEN LET count_orig = `count_orig + ($rowvar)[m=($cruise_is)]`;\ - ) -ELSE - LET count_nf = `($rowvar),RETURN=msize` - LET count_orig = idvar_masked[i=@ngd] -ENDIF - -DEFINE SYMBOL cruises_shown = `count_nf` -DEFINE SYMBOL prof_traj_shown = `count_nf` - -LET decimate_size = count_orig - -! Now we have the full size of desired cruise selection. Do the decimation if any on -! the full set so as to keep placeholders for all the cruises (decimating cruises , -! that are all-blank, lose the start and end of cruises) - -LET feature_id = _M[GE=featurevar] -LET feature_len =($rowvar) -! This section setting up obs_mask, for non-lon-lat plots, which do not use decimation. -LET all_feature_id = _M[GE=featurevar] -LET all_idvar = EXPND_BY_LEN(all_feature_id, ($rowvar), ($rowvar)[m=@sum]) +LET idvar = constraints_mask* ($feature_variable) -LET tmask = IF all_idvar[i=@ddb] EQ 1 THEN 1 ELSE 0 -LET obs_mask1 = tmask[gx=($ferret_plot_var_0)@ASN] -LET obs_mask2 = IF i[gx=($ferret_plot_var_0)] EQ 1 THEN 1 ELSE 0 -LET obs_mask = IF (obs_mask1+obs_mask2) EQ 1 THEN 1 - - -LET pvar = constraints_mask* ($ferret_plot_var_0) -IF ($pvar_reset"0|*>1") THEN LET pvar = constraints_mask* ($pvar_reset) -LET qvar = constraints_mask* ($ferret_plot_var_1) -LET dvar = idvar - -LET pvar = constraints_mask* (xvar) -LET qvar = constraints_mask* (yvar) - -LET data_1_var_c = EXPNDI_BY_Z(pvar, obs_mask, `nfeatures`, `longest`) -LET data_var_c = EXPNDI_BY_Z(qvar, obs_mask, `nfeatures`, `longest`) - -! Decimation for longitude/latitude plots -! Dont decimate for prop-prop plots when we have a subset mask! - -LET num_decimate = 1000 -!LET num_decimate = 10000 -IF `($numobs) LT num_decimate` THEN LET num_decimate = -1 ! separate cruises but dont decimate - - -IF `($ferret_plot_var_0"0|longitude>1|*>0") AND ($ferret_plot_var_1"0|latitude>1|*>0") AND\ - (($numobs) GE num_decimate) AND (($subset_mask"0|*>1) EQ 0)` THEN - -! Decimation always? -! IF `(($numobs) GE num_decimate)` THEN - - DEFINE SYMBOL is_decimate = 1 - - LET pxvar = constraints_mask* ($ferret_plot_var_0) - IF ($pvar_reset"0|*>1") THEN LET pxvar = constraints_mask* ($pvar_reset) ! see LAS_xytvar_setup - LET qyvar = constraints_mask* ($ferret_plot_var_1) - - LET var_data = idvar - - DEFINE SYMBOL data_x_var = if idvar then pxvar - DEFINE SYMBOL data_y_var = if idvar then qyvar - - DEFINE SYMBOL data_x_var = pxvar - DEFINE SYMBOL data_y_var = qyvar - DEFINE SYMBOL data_var = idvar - - ! Arguments are - ! min # points for doing decimation - ! lon/lat tolerance for piecewise decimation - ! var tolerance (var at lon/lat) - - LET tol1 = `MAX(($region_x_range)/($ppl$xpixel), ($region_y_range)/($ppl$ypixel))` - LET tol1 = `MIN(($region_x_range)/($ppl$xpixel), ($region_y_range)/($ppl$ypixel))` - LET tol1 = MAX(`tol1`,0.001) - let tol2 = 0.01 - list tol1, tol2 - - DEFINE SYMBOL decimate_fraction = 0.1 - GO setup_dsg_variables `num_decimate` `tol1` `tol2` 0.1 - - LET pvar = ($data_x_var) - LET qvar = ($data_y_var) - LET dvar = ($data_var) - -! data_var is the feature index at each obs index i, with a gap between features. -! Find where the features start now that they are sampled. (Need to remove the gaps -! between features that the script introduces...) - - LET index_sampled = if ($data_var) then ($data_var) else ($data_var)[i=@shf:-1] - LET new_feature = index_sampled[i=@ddb] - LET decimated_mask1 = IF new_feature NE 0 THEN 1 ELSE 0 - LET decimated_mask2 = IF I[gx=($data_var)] EQ 1 THEN 1 ELSE 0 - LET ndmask = `pvar,return=isize` - LET decimated_mask = IF (decimated_mask1[i=1:`ndmask`] + decimated_mask2[i=1:`ndmask`]) EQ 1 THEN 1 - - ! This value of longest is now wrong, but it's too big so should be harmless. - - - LET data_1_var_c = EXPNDI_BY_Z(pvar, decimated_mask, `nfeatures`, `longest`) - LET data_var_c = EXPNDI_BY_Z(qvar, decimated_mask, `nfeatures`, `longest`) - LET data_var_d = EXPNDI_BY_Z(dvar, decimated_mask, `nfeatures`, `longest`) - - LET dmask = subset_mask * data_var_d - DEFINE SYMBOL have_dmask = 1 - - DEFINE SYMBOL ngood_data = `pvar[i=@ngd]` - -ENDIF ! Decimation for longitude/latitude plots - -! Set up to plot the data and the linear fit -LET pmask = subset_mask * data_1_var_c -LET qmask = subset_mask * data_var_c - -LET p = XSEQUENCE( subset_mask * data_1_var_c) -LET q = XSEQUENCE( subset_mask * data_var_c) +LET p = constraints_mask* (xvar) +LET q = constraints_mask* (yvar) ! Set up to make polygon plot. If there are not too many features ! color the data according to feature. -DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/NOAXES/NOKEY/NOLAB/ +DEFINE SYMBOL qualifiers = ($qualifiers)/NOAXES/NOKEY/NOLAB/OVER + -IF `($feature_max) LE ($feature_max_labels)` THEN +! /VS/RIBBON/OVER/PALETTE=ten_by_levels/THICK/SYM=19/NOLAB + +IF `($features_shown) LE ($feature_max_labels)` THEN DEFINE SYMBOL ferret_poly_palette = ten_by_levels DEFINE SYMBOL qualifiers = ($qualifiers)/PALETTE=($ferret_poly_palette) ! If undefined, set polygon scale according to number of points - IF ($ferret_poly_scale"1|*>0") THEN + IF `($ferret_poly_scale"1|*>0") AND ($py_syms"0")` THEN GO LAS_set_poly_scale DEFINE SYMBOL ferret_poly_scale 0.5*($ferret_poly_scale) ENDIF - -! *** draw outlines only when running Ferret. Too slow in PyFerret. - IF `($ferret_poly_scale) GE 0.4` THEN - IF ($program_name"0|Ferret>1|*>0") THEN \ - DEFINE SYMBOL qualifiers = ($qualifiers)/LINE/THICK=1 - ENDIF + + DEFINE SYMBOL qualifiers = ($qualifiers)/LINE/THICK=1 ELSE DEFINE SYMBOL qualifiers = ($qualifiers)/PALETTE=black DEFINE SYMBOL poly_scale = 0.4 - DEFINE SYMBOL plot_using_sym = 1 + DEFINE SYMBOL plot_using_sym = 1 ENDIF -! *** draw outlines only when running Ferret. Too slow in PyFerret. -IF ($program_name"0|Ferret>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/LINE +DEFINE SYMBOL poly_command POLY/FILL($qualifiers) -DEFINE SYMBOL poly_command POLY($qualifiers) DEFINE SYMBOL line_color = blue -DEFINE SYMBOL pysym_command = PLOT/VS/OVER/NOLAB/NOKEY/ribbon/highlight/PALETTE=($ferret_poly_palette)/siz=0.15 +DEFINE SYMBOL pysym_command = PLOT/VS/NOLAB/NOKEY/ribbon/highlight/PALETTE=($ferret_poly_palette)/siz=0.15/OVER +DEFINE SYMBOL fersym_command = PLOT/VS/NOLAB/NOKEY/ribbon/miss=blank/PALETTE=($ferret_poly_palette)/siz=0.15/THICK/OVER + +! Start the plot. Draw an underlay of dashed-line plot for time series and map trajctory plots + + +IF `itsa_tim_prop` THEN + LET tmin = p[L=@min] + LET tmax = p[L=@max] + LET t1 = `tmin[e=@min]` + LET t2 = `tmax[e=@max]` +ENDIF + +IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` THEN + + set data/fmask=subset_mask 1 + PPL COLOR,6,90,90,90 !gray + + IF `itsa_tim_prop EQ 0 AND itsa_map_plot EQ 0` THEN \ + PLOT/VS/SYM=dot($hlim)($vlim)/RIBBON/NOKEY/NOLAB/PALETTE=white {0,1}, {0,1}, {0,1} ! underlay to draw the axes... (Need /hlim, /vlim for expanded axes?) + + IF `itsa_tim_prop AND ($connect_dots"0|0|1|*>1")` THEN \ + PLOT/t=`t1`:`t2`/NOLAB/DASH=(0.1,0.04,0.1,0.04)/color=6 q -IF `( ($feature_max) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` THEN + IF `itsa_map_plot AND ($connect_dots"0|0|1|*>1")` THEN \ + PLOT/OVER/NOLAB/VS/RIBBON/DASH=(0.1,0.04,0.1,0.04)/pal=gray p,q, 0*q - LET p = XSEQUENCE( subset_mask * data_1_var_c) ! for regression line - LET q = XSEQUENCE( subset_mask * data_var_c) + PPL COLOR,6,100,0,100 !restore default line-6 color + + CANCEL SYMBOL connect_dots + + IF ($ax_label_x"0|*>1") THEN annotate/norm/halign=0/xp=0.5/yp=-0.06/siz=0.12 "($ax_label_x)" + IF ($ax_label_y"0|*>1") THEN annotate/norm/halign=0/angle=90/xp=-0.06/yp=0.5/siz=0.12 "($ax_label_y)" ! Use different color for each feature 1-10, 11-21, ... ! Use different symbols for each set of 10 LET ncolors = 10 LET nshapes = 20 - LET polygon_set = `INT(0.5+($feature_max)/nshapes)` - IF `polygon_set*nshapes LT ($feature_max)` THEN LET polygon_set = `polygon_set+1` + LET polygon_set = `INT(0.5+($features_shown)/nshapes)` + IF `polygon_set*nshapes LT ($features_shown)` THEN LET polygon_set = `polygon_set+1` ! See polyshape script for the list of available pre-defined shapes. @@ -228,53 +113,59 @@ IF `( ($feature_max) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` THEN GO LAS_pp_set_feature_shapes - LET cmax = `MIN(($feature_max),ncolors)` + LET cmax = `MIN(nfeatures,ncolors)` LET c1 = 1 - DEFINE SYMBOL poly_command ($poly_command)/LEVELS=(`c1`,`cmax+1`,1) - DEFINE SYMBOL pysym_command ($pysym_command)/LEVELS=(`c1`,`cmax+1`,1) +! DEFINE SYMBOL poly_command ($poly_command)/LEVELS=(`c1`,`cmax+1`,1) +! DEFINE SYMBOL fersym_command ($fersym_command)/LEVELS=(`c1`,`cmax+1`,1) +! DEFINE SYMBOL pysym_command ($pysym_command)/LEVELS=(`c1`,`cmax+1`,1) LET ishape = 1 LET icolor = 1 - LET colr_index = MOD(i[i=1:`nfeatures`],`ncolors`) - LET allcolors = IF colr_index EQ 0 THEN `ncolors` ELSE colr_index - IF `($have_dmask"0|*>1") EQ 0` THEN LET dmask = subset_mask * allcolors + 0*qmask + LET cvar = MOD(_m[ge=($rowvar)],`ncolors`) ! cycle through avail colors + + LET c1 = 1 + LET cn = MIN(ncolors, nfeatures) + +! PyFerret will use the fancy PLOT symbols. +! Note need to protect the colors from one set of 10 to the next + + LET idvar = EXPND_BY_LEN (_m[ge=($feature_variable)], ($rowvar), ($numobs)) + LET ids_on_obs = RESHAPE (idvar, ($xvar)) + + LET xplt_var = XSEQUENCE(($xvar)) + LET yplt_var = XSEQUENCE(($yvar)) + LET zplt_var = XSEQUENCE(ids_on_obs) + + +! LET xplt_var = ($xvar) +! LET yplt_var = ($yvar) +! LET zplt_var = ($zvar) - LET transpmask = TRANSPOSE_XZ(pmask) - LET transqmask = TRANSPOSE_XZ(qmask) - LET transdmask = TRANSPOSE_XZ(dmask) + DEFINE SYMBOL plot_arg = xplt_var, yplt_var, zplt_var + + LET ishape = 1 + LET icolor = 1 + + LET cvar = MOD(_m[ge=($rowvar)],`ncolors`) ! cycle through avail colors LET c1 = 1 - LET cn = `ncolors` + LET cn = MIN(ncolors, nfeatures) + + CANCEL data/fmask 1 + LET mmask = _M[ge=rowsize] REPEAT/RANGE=1:`nfeatures`:`ncolors`/NAME=ic (\ DEFINE SYMBOL ishape = `ishape`;\ - LET zx = transpmask[k=`c1`:`cn`];\ - LET zy = transqmask[k=`c1`:`cn`];\ - LET zd = transdmask[k=`c1`:`cn`];\ - DEFINE AXIS/X=1:`(cn-c1+1)*longest`:1 long_x;\ - LET lxx = x[gx=long_x];\ - LET xpolydat = RESHAPE(zx,lxx);\ - LET ypolydat = RESHAPE(zy,lxx);\ - LET colorplus = 0;\ - IF ($is_decimate"0|*>1") THEN LET colorplus = (ishape-1)*ncolors;\ - LET dpolydat = RESHAPE(zd-`colorplus`, lxx);\ - LET all_mask = IF xpolydat+ypolydat+dpolydat THEN 1;\ - LET all_x = COMPRESSI(all_mask*xpolydat);\ - LET all_y = COMPRESSI(all_mask*ypolydat);\ - LET all_d = COMPRESSI(all_mask*dpolydat);\ - LET ndo_it = `all_x[i=@ngd]`;\ - LET do_it = `ndo_it GT 0`;\ - LET/units=($lon_units"dum") plot_x = all_x[i=1:`ndo_it`];\ - LET plot_y = all_y[i=1:`ndo_it`];\ - LET plot_d = all_d[i=1:`ndo_it`];\ + CANCEL data/fmask 1;\ + LET ishape_mask = if mmask ge c1 and mmask le cn then 1;\ + LET mask_for_shape = subset_mask* mmask* ishape_mask;\ + SET DATA/fmask=mask_for_shape 1;\ ;\ - IF `do_it AND ($connect_dots"0|0|1|*>1")` THEN \ - PLOT/NOAX/VS/OVER/LINE=6/DASH=(0.1,0.04,0.1,0.04)/NOLAB xpolydat, ypolydat ;\ + DEFINE SYMBOL color_command = GO polymark ($poly_command)/LEVELS=(`c1`,`cn+1`,1) ($plot_arg), ($shape($ishape)), ($poly_scale) ;\ + IF ($py_syms"0") THEN DEFINE SYMBOL color_command = ($pysym_command)/sym=($pyshape($ishape))/E=`c1`:`cn`/LEVELS=(`c1`,`cn+1`,1) ($plot_arg);\ ;\ - DEFINE SYMBOL color_command = GO polymark ($poly_command) plot_x, plot_y, plot_d, ($shape($ishape)), ($poly_scale) ;\ - IF ($py_syms"0") THEN DEFINE SYMBOL color_command = ($pysym_command)/sym=($pyshape($ishape)) plot_x, plot_y, plot_d;\ - IF `do_it` THEN ($color_command); \ + ($color_command); \ ;\ LET c1 = `c1 + ncolors`;\ LET cn = `cn + ncolors`;\ @@ -283,16 +174,15 @@ IF `( ($feature_max) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` THEN PPL shaset protect;\ ) -! Note need to protect the colors from one set of 10 to the next - + CANCEL DATA/FMASK 1 + SET DATA/FMASK = subset_mask 1 + ELSE ! all features, do as a PLOT not a POLY command, much faster PLOT/VS/NOLAB/over/sym=19/siz=.12 p,q DEFINE SYMBOL ngood_data = `p[i=@ngd]` ENDIF - - ! If location(s) of a crossover has been sent, mark them. ! This might be one point, or two, comma-separated. diff --git a/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl b/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl index a18c6e94e..fa7cdc1b3 100644 --- a/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl @@ -166,7 +166,8 @@ IF `($have_time_lab"0|*>1") EQ 0` THEN ENDIF ! Do we need a YEAR label? If its a 1-D Time plot then we do -IF ($its_prop_prop_plot"0|*>1") THEN + +IF `($its_prop_prop_plot"0|*>1") OR ($its_tsplot"0|*>1")` THEN LET L_time = `($ferret_plot_var),return=Lsize` IF `(($have_year_lab"0|*>1") EQ 0) AND (L_time GT 1)` THEN IF `(STRCMP("($fview%A%)", "T") EQ 0) AND ($region_t_lo"0|*>1") AND ($do_t"0")` THEN diff --git a/JavaSource/resources/ferret/scripts/LAS_regressx.jnl b/JavaSource/resources/ferret/scripts/LAS_regressx.jnl index fb7e62509..f0e1c96c4 100644 --- a/JavaSource/resources/ferret/scripts/LAS_regressx.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_regressx.jnl @@ -5,8 +5,8 @@ let pq = p*q let pqmask = pq-pq ! 0 or "missing" so all variables share the same missing -let pmasked = p + pqmask -let qmasked = q + pqmask +let pmasked = XSEQUENCE(p + pqmask) +let qmasked = XSEQUENCE(q + pqmask) let pave = pmasked[x=@ave] let qave = qmasked[x=@ave] @@ -23,4 +23,5 @@ let intercep = qave - slope*pave let qhat = slope*p + intercep let rsquare = (pqvar*pqvar) / (LAS_pvar*LAS_qvar) -SET MODE/LAST VERIFY \ No newline at end of file +SET MODE/LAST VERIFY + diff --git a/JavaSource/resources/ferret/scripts/LAS_results.jnl b/JavaSource/resources/ferret/scripts/LAS_results.jnl index 8ecbab9eb..d54aa92c7 100644 --- a/JavaSource/resources/ferret/scripts/LAS_results.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_results.jnl @@ -51,13 +51,14 @@ ENDIF ! Annotate if the selection resulted in no data ngood_data is defined for insitu datasets + IF `($ngood_data"-1|*>1") NE -1` THEN - IF `($ngood_data) EQ 0` THEN annotate/norm/x=0.02/y=0.92/halign=-1/siz=0.1 "No Valid Data in the selection" + IF `($ngood_data) EQ 0` THEN annotate/norm/x=0.52/y=0.92/halign=0/siz=0.14 "No Valid Data in the selection" ELSE IF `($ferret_annotations"0|*>1") AND ($plotvar_is_basemap"0|*>1") EQ 0 AND ($no_novalid_lab"0|*>1") NE 1` THEN stat the_plot_var IF `($stat_ngood"0|0|*>1") EQ 0` THEN \ - annotate/norm/x=0.02/y=0.92/halign=-1/siz=0.1 "No Valid Data in the selection" + annotate/norm/x=0.52/y=0.92/halign=0/siz=0.14 "No Valid Data in the selection" ENDIF ENDIF @@ -110,9 +111,9 @@ IF ($is_animation_frame"0|0|*>1") THEN EXIT/SCRIPT ! If an insitu waterfall plot made a "blankvar" plot underlying the color plot, ! re-draw that to use in making the reference map. It has the correct time/space -! size and units. +! size and units, so draw this plot to set pplus symbols. -IF ($insitu_blankvar"0|*>1) THEN SHADE/PAL=white/NOLAB/NOKEY/LEV=(0,1,1) ($insitu_blankvar) +IF ($insitu_blankvar"0|*>1) THEN SHADE($insitu_blankvar_qual) ($insitu_blankvar) !Do not write out the url and variable name output. This info is not saved !when map_scale.xml is generated anyway. (See ferret ticket 1933) @@ -429,6 +430,7 @@ IF ($ferret_annotations%0|*>1%) THEN GO LAS_annotations_xml ! Result "colorbar" is the legend of the plot_image...only for Google Earth IF ($result_colorbar_filename%0|*>1%) THEN GO colorbar + ! Result ref_map is a ref map. Save to result_ref_map_filename IF ($ferret_use_ref_map%0|false>0|*>1%) THEN @@ -446,5 +448,7 @@ IF ($fland_area"0|*>1") THEN SAY _________________Map plot: $fland_area ($fland_area) SAY _________________Map plot: topo file ($topo_url) ENDIF + + ! End of file ------------LAS_results.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl b/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl index 14ea69477..2b2fb165b 100644 --- a/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl @@ -29,15 +29,24 @@ IF ($ferret_plot_key"0|0>1|nokey>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY ENDIF -! Graticule lines. For 1D plots, make them gray. +! Graticule lines. For 1D plots, make them gray. Multi-color line plots +! may already have set more colors. ! TODO: For time plots, either the configurer or the script might want to turn on ! TODO: graticules at the small tic marks. /GRATICULE=(DASH)="small, large" -DEFINE SYMBOL nlinecolors = 8 -SET MODE LINECOLORS:($nlinecolors) -PPL COLOR,7,70,70,70 ! gray -PPL COLOR,8,100,100,100 ! white +DEFINE SYMBOL nlinecolors = ($nlinecolors"6") +IF `($nlinecolors) EQ 6` THEN + SET MODE LINECOLORS:`($nlinecolors)+2` + + DEFINE SYMBOL gryclr = `($nlinecolors)+1` + PPL COLOR,($gryclr),70,70,70 !gray + + DEFINE SYMBOL whtclr = `($nlinecolors)+2` + PPL COLOR,($whtclr),100,100,100 ! white + + DEFINE SYMBOL nlinecolors = `($nlinecolors"6")+2` +ENDIF ! For time plots, turn on horizontal graticule lines, unless graticules ! have been turned off explicitly. Ignore choice of white - its in the menu @@ -46,25 +55,25 @@ PPL COLOR,8,100,100,100 ! white LET has_t = ($fview"0|T>1|*>0") IF `STRLEN("($fview)") EQ 2 AND STRINDEX("($fview)", "T") GT 0` THEN LET has_t = 1 -IF `has_t AND ($ferret_use_graticules"1|none>0|notic>0|white>0|*>1)` THEN +IF `has_t AND ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1)` THEN DEFINE SYMBOL onegrat = HGRAT IF `STRLEN("($fview)") EQ 2 AND STRINDEX("($fview)", "X") GT 0` THEN DEFINE SYMBOL onegrat = VGRAT IF ($ferret_use_graticules"0|black>1|*>0") THEN \ DEFINE SYMBOL qualifiers = ($qualifiers)/($onegrat)=(DASH,COLOR=black) - IF ($ferret_use_graticules"1|black>0|gray>1") THEN \ - DEFINE SYMBOL qualifiers = ($qualifiers)/($onegrat)=(DASH,COLOR=7) + IF ($ferret_use_graticules"1|1|black>0|gray>1|*>0") THEN \ + DEFINE SYMBOL qualifiers = ($qualifiers)/($onegrat)=(DASH,COLOR=($gryclr)) DEFINE SYMBOL ferret_use_graticules = none ! done, so skip the next IF block ENDIF ! Otherwise turn them on only if requested ! Either none or notic removes graticules from the plot -IF ($ferret_use_graticules"1|none>0|notic>0|*>1") THEN +IF ($ferret_use_graticules"1|1|none>0|notic>0|*>1") THEN DEFINE SYMBOL graticuleColor = black - IF ($ferret_use_graticules"1|default>1|gray>1|*>0") THEN - DEFINE SYMBOL graticuleColor = 7 + IF ($ferret_use_graticules"1|1|default>1|gray>1|*>0") THEN + DEFINE SYMBOL graticuleColor = ($gryclr) ELIF ($ferret_use_graticules"0|white>1|*>0") THEN - DEFINE SYMBOL graticuleColor = 8 + DEFINE SYMBOL graticuleColor = ($whtclr) ELIF ($ferret_use_graticules"0|black>1|*>0") THEN DEFINE SYMBOL graticuleColor = 1 ENDIF @@ -191,19 +200,22 @@ ENDIF ! end of options for twoDplot ! Do not set a /COLOR qualifier for multi-line plots ! Default is blue for line, vector, contour plots. ! Line-color is red for difference plots. +! +! IF there is already a /color in the qualifers don't add /COLOR +! unless the ferret_line_color symbol is set to override everything ! IF `($line_drawn"0|*>1") EQ 0` THEN \ DEFINE SYMBOL line_drawn = `($oneDplot"0|*>1") OR ($itsa_vector_plot"0|*>1") OR ($plot_type"0|CONTOUR>1|*>0")` - -sh sym ferret_line_color -IF `($line_drawn"0") AND ($itsa_multi_lineplot"0|*>1") EQ 0` THEN +IF `($line_drawn"0") AND ($itsa_multi_lineplot"0|*>1") EQ 0 AND ($nstations"1") EQ 1` THEN IF ($ferret_diff_var"0|*>1") THEN DEFINE SYMBOL ferret_line_color = red IF ($ferret_line_color"0|multi>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color%blue|default>blue|black|red|blue|green|lightblue|purple|*%) + LET has_color = STRINDEX("`UPCASE("($qualifiers)")`", "/COLOR") + IF `has_color EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color%blue|default>blue|black|red|blue|green|lightblue|purple|*%) + IF ($ferret_line_color%0|*>1%) THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color) ENDIF ENDIF ! skipped color setting if its a multi-line plot @@ -328,7 +340,7 @@ IF `($itsa_vector_plot"0|*>1") AND ($ferret_view"0|xy>1|*>0")` THEN ENDIF ENDIF ! end of XY vector plot settings. -IF `($graticuleColor"0|*>1") EQ 0` THEN DEFINE SYMBOL graticuleColor = 7 +IF `($graticuleColor"0|*>1") EQ 0` THEN DEFINE SYMBOL graticuleColor = ($gryclr) ! ----------------- End of LAS_set_plot_qualifiers.jnl ------------------------------------ diff --git a/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl b/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl index 8a398917f..0f5a56e86 100644 --- a/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl @@ -13,18 +13,9 @@ LET global_attnames = ..attnames LET varnames = ..varnames LET nvars = ..nvars -! Find longitude, latitude, and time variables -IF `($data_lon_var"0|*>1") + ($data_lat_var"0|*>1")+ ($data_time_var"0|*>1") LT 3` THEN - GO feature_get_direction_vars - DEFINE SYMBOL data_lon_var = ($data_x_var) - DEFINE SYMBOL data_lat_var = ($data_y_var) - DEFINE SYMBOL data_time_var = ($data_t_var) - ! These will be redefined later. - CANCEL SYMBOL data_x_var, data_y_var, data_t_var, data_z_var -ENDIF ! -! Is it a Profile or Trajectory dataset? +! Is it a Profile or Timeseries or Trajectory dataset? ! Find the featureType attribute, and find which variables ! are marked with the cf_role and sample_dimension attributes @@ -38,8 +29,33 @@ IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN ENDIF ! cf_role and sample_dimension are not included in DSG point datasets. +! rowsize isn't either. Set one up which is 1 for each point + +IF ($feature_type"0|point>1|*>0") THEN + + LET nfeatures = `($data_var),RETURN=size` + DEFINE SYMBOL nfeatures =`nfeatures` + IF ($data_0_x_var"0|*>1") THEN DEFINE SYMBOL data_x_var = ($data_0_x_var) + IF ($data_0_y_var"0|*>1") THEN DEFINE SYMBOL data_y_var = ($data_0_y_var) + +! Define an E-direction "rowsize" variable that's 1 for each point -IF ($feature_type"0|point>1|*>0") THEN EXIT/SCRIPT + LET getshape = '($data_0_var)' + DEFINE SYMBOL shape = `getshape,RETURN=shape` + IF ($shape"point>1|*>0") THEN + LET rowvar = 1 + ELSE + DEFINE SYMBOL ishape = ($shape"|X>i|Y>j|Z>k|T>l|E>m|F>n") + LET npts = `($data_0_var),return=($ishape)size` + LET rowvar = 1 + 0* _e[e=1:`npts`] + ENDIF + DEFINE SYMBOL rowvar = rowvar + + EXIT/SCRIPT +ENDIF + +! Find the variable with the cf_role attribute. It's the feature-id var. +! Also mark the direction variables and find the rowSize variable. REPEAT/RANGE=1:`nvars`/name=q (\ DEF SYM q = `q`;\ @@ -47,25 +63,53 @@ REPEAT/RANGE=1:`nvars`/name=q (\ GO dsg_find_roles;\ IF `STRCMP("($data_($num)_var)", "($feature_variable)") EQ 0` THEN \ DEFINE SYMBOL ferret_plot_title = ($feature_variable) ID;\ - IF `( ($feature_variable"0|*>1") GT 0) AND ( ($rowvar"0|*>1") GT 0)` THEN EXIT/LOOP\ ) + +! is cf_role on a coordinate variable? +! If so define a new variable containing the coordinates +! and redefine the color-by variable definition if it's color-by-id. + IF `($feature_variable"0|*>1") EQ 0` THEN LET ndims = ..ndims LET dimnames = ..dimnames - REPEAT/RANGE=1:`ndims`/name=q (\ + REPEAT/RANGE=1:`ndims`/name=q (\ DEF SYM q = `q`;\ + DEF SYM dimname = `dimnames[i=($q)]`;\ DEF SYM vname = (`dimnames[i=($q)]`);\ GO dsg_find_roles;\ - IF `STRCMP("($data_($num)_var)", "($feature_variable)") EQ 0` THEN \ - DEFINE SYMBOL ferret_plot_title = ($feature_variable) ID;\ - IF `( ($feature_variable"0|*>1") GT 0) AND ( ($rowvar"0|*>1") GT 0)` THEN EXIT/LOOP; \ + IF ($feature_variable"0|*>1") THEN ;\ + DEFINE SYMBOL id_on_dim = ($vname);\ + exit/loop; \ + ENDIF; \ ) + IF `($id_on_dim%0|*>1%) AND \ + STRINDEX( "($feature_variable%0%)", "($dimname)" ) GT 0` THEN \ + DEFINE SYMBOL feature_variable = ($dimname) ENDIF + +! We now have all of these settings for the dataset + +LET nfeatures = `($feature_variable),RETURN=msize` +DEFINE SYMBOL nfeatures =`nfeatures` + +! Rowsize variable directions + +DEFINE SYMBOL rdir = `($rowvar),RETURN=shape` +DEFINE SYMBOL rind = ($rdir"|X>I|E>M|POINT>M") + +DEFINE SYMBOL vshape = `($data_var),RETURN=shape` +LET color_by_index = `($vshape"0|E>1|*>0)` +LET color_by_feature = `STRCMP("($data_var)", "($feature_variable)") EQ 0` + +SHOW SYMBOL numobs +SHOW SYMBOL dsgshape +SHOW SYMBOL dsgshape_var + ! End of file ------------ LAS_setup_dsg.jnl-------------------------- SAY _________________ END LAS_setup_dsg: clock seconds: ($clock_secs) -! \ No newline at end of file +!` diff --git a/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl index e2802ee5e..6bb5bf794 100644 --- a/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl @@ -1,71 +1,46 @@ ! LAS_xytvar_setup.jnl -! ACM 3/2009 -! 5/2014 Fixes to XY map plots -! 10/2016 Performance fixes. The underlay plot can be on a coarser grid -! while the overlay will be done with full resolution data. -! 10/2017 Writing a note when data selection results in no data -! Here, if we already make such a note, xx var is all-missing, -! set a symbol to skip the new annotation. -! 11/2017 find direction variables based on attributes instead of assuming -! longitude, latitude, and time are variable names -! 12/2017 Define varibles for min,max of p and q for efficiency -! 1/2018 Time will only be the independent variable - no vertical time axis. -! 2/2018 Make a blank plot and exit immediately on finding a var is all-bad. -! 2/2018 Label thumbnails var vs time with the variable title. -! 2/2018 issue #1859 handle super short time ranges. Defining the time axis if < 2 hours +! ACM 4/2019 version for DSG datasets +! ... need a version similar to old version for gridded and other insitu... ! Draw the underlying axes of a property-property plot, ! formatted as a longitude, latitude or time axis. ! variable p is the prop_var (independent axis) masked for any subset chosen and ! with XSEQUENCE applied to put it on an x axis +! ! variable q is the data_var (dependent axis) masked for any subset chosen and ! with XSEQUENCE applied to put it on an x axis -! Define two viewports filling the window and do the axes in one, the -! plot in the other. If the annotations are being done separately, -! draw in the viewports defined in set_full_margins.jnl - ! May turn off axis labeling later PPL TICS .6,.125,.6,.125 PPL TICS .125,.2,.125,.2 PPL axlabp,-1,-1 -!! TESTING; do we want to only constrain the map for constraints, not for -!! chosen trajectories? -DEFINE SYMBOL xvar = constraints_mask*xvar -DEFINE SYMBOL yvar = constraints_mask*yvar +DEFINE SYMBOL xvar = xvar +DEFINE SYMBOL yvar = yvar LET p = ($xvar) LET q = ($yvar) + ! Are the variables longitude and latitude (when the dataset is not of trajectory type) ! If so then connect the dots and do not draw the regression line DEFINE SYMBOL propunits = none`($ferret_prop_var),return=units` DEFINE SYMBOL plotunits = none`($ferret_plot_var),return=units` -IF `STRLEN("($propunits)") GT 4` THEN DEFINE SYMBOL propunits = `($ferret_prop_var),return=units` -IF `STRLEN("($plotunits)") GT 4` THEN DEFINE SYMBOL plotunits = `($ferret_plot_var),return=units` -LET itsa_lon_prop = `STRINDEX("($propunits)", "east") GT 0 OR STRINDEX("($data_0_units)", "east") GT 0` -LET itsa_lat_plot = `STRINDEX("($plotunits)", "north") GT 0 OR STRINDEX("($data_1_units)", "north") GT 0` - -GO LAS_var_lon_lat_time ($ferret_prop_var) -LET itsa_lon_prop = ($var_is_lon"0") -LET itsa_lat_prop = ($var_is_lat"0") -LET itsa_tim_prop = ($var_is_time"0") +LET itsa_lon_prop = ($ferret_prop_var"0|($dsg_x_var)>1|*>0") +LET itsa_lat_prop = ($ferret_prop_var"0|($dsg_y_var)>1|*>0") +LET itsa_tim_prop = ($ferret_prop_var"0|($dsg_t_var)>1|*>0") +LET itsa_dep_prop = ($ferret_prop_var"0|($dsg_z_var%0%)>1|*>0") -GO LAS_var_lon_lat_time ($ferret_plot_var) -LET itsa_lon_plot = ($var_is_lon"0") -LET itsa_lat_plot = ($var_is_lat"0") -LET itsa_tim_plot = ($var_is_time"0") +LET itsa_lon_plot = ($ferret_plot_var"0|($dsg_x_var)>1|*>0") +LET itsa_lat_plot = ($ferret_plot_var"0|($dsg_y_var)>1|*>0") +LET itsa_tim_plot = ($ferret_plot_var"0|($dsg_t_var)>1|*>0") +LET itsa_dep_plot = ($ferret_plot_var"0|($dsg_z_var%0%)>1|*>0") - -IF `itsa_lon_prop + itsa_lat_plot EQ 2` THEN - DEFINE SYMBOL connect_dots = 1 - DEFINE SYMBOL do_rsquare = 0 -ENDIF +LET itsa_map_plot = `itsa_lon_prop AND itsa_lat_plot` CANCEL SYMBOL set_window_quals @@ -73,25 +48,24 @@ CANCEL SYMBOL set_window_quals ! (easier to understand, e.g. SST as a fcn of AIRT) IF ($variable_0_lab"0|*>1") THEN - DEFINE SYMBOL ax_label_x PPL XLAB @AC($variable_0_lab) + DEFINE SYMBOL ax_label_x @AC($variable_0_lab) IF `itsa_tim_prop OR itsa_lon_prop OR itsa_lat_prop` THEN CANCEL SYMBOL ax_label_x ENDIF IF ($variable_1_lab"0|*>1") THEN - DEFINE SYMBOL ax_label_y PPL YLAB @AC($variable_1_lab) + DEFINE SYMBOL ax_label_y @AC($variable_1_lab) IF `itsa_lon_plot OR itsa_lat_plot` THEN CANCEL SYMBOL ax_label_y ENDIF - ! If the axis labels are long, make the text size smaller LET labfac = 1. if `(labwid("($ax_label_x)", 0.12) / ($ppl$xlen)) GT 1` THEN LET labfac = ($ppl$xlen)/labwid("($ax_label_x)",0.12) if `(labwid("($ax_label_y)", 0.12) / ($ppl$ylen)) GT 1` THEN LET labfac = MIN(`labfac`,`($ppl$ylen)/labwid("($ax_label_y)",0.12)`) IF `labfac LT 1 AND labfac GT 0.06` THEN DEFINE SYMBOL ax_label_resize PPL LABSET,,`0.12*labfac`,`0.12*labfac` -! Do not label axes with the words LONGITUDE, LATITUDE -IF `itsa_lon_prop OR itsa_lat_prop` THEN DEFINE SYMBOL ax_label_x = ppl xlab -IF `itsa_lon_plot OR itsa_lat_plot` THEN DEFINE SYMBOL ax_label_y = ppl ylab +! Do not label map axes with the words LONGITUDE, LATITUDE +IF `itsa_lon_prop OR itsa_lat_prop` THEN CANCEL SYMBOL ax_label_x +IF `itsa_lon_plot OR itsa_lat_plot` THEN CANCEL SYMBOL ax_label_y ! size for the label that says a variable is all-missing @@ -116,27 +90,21 @@ IF ($ferret_thumb"0|0|*>1") THEN ENDIF - -! If this has already been done, just go make the underlay plot -IF `($axes_already_defined"0|*>1") EQ 0` THEN - - DEFINE SYMBOL win_asp = /ASPECT=.8 -IF `itsa_tim_prop` THEN DEFINE SYMBOL win_asp = /ASPECT=0.75 +IF `itsa_tim_prop` THEN + DEFINE SYMBOL win_asp = /ASPECT=0.75 + SET DATA/feature=time/FMASK=subset_mask 1 + DEFINE SYMBOL connect_dots = 1 + DEFINE SYMBOL do_rsquare = 0 +ENDIF + IF `itsa_lon_prop AND itsa_lat_plot` THEN DEFINE SYMBOL win_asp = /ASPECT=`($region_Y_range)/($region_X_range)` DEFINE SYMBOL set_window_quals = /SIZE=($ferret_size"0.5")($win_asp) -DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull1 -DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull2 - -DEFINE SYMBOL view1 = vfull1 -DEFINE SYMBOL view2 = vfull2 -IF ($ferret_annotations"0|*>1") THEN - DEFINE SYMBOL view1 = full_view - DEFINE SYMBOL view2 = full_view2 -ENDIF +DEFINE SYMBOL view1 = full_view +DEFINE SYMBOL view2 = full_view2 SET VIEW ($view1) @@ -156,13 +124,12 @@ IF `IS_ELEMENT_OF_STR_N(attnames, "standard_name")` THEN IF `STRINDEX("($posdirec)", "sea_floor_depth") GT 0` THEN DEFINE SYMBOL reverse_vert = 1 ENDIF + + ! If this symbol is set during this script, then ! the script will make a blank plot and exit. -CANCEL SYMBOL put_label - -! For the line connecting points in each feature, color it grey. -PPL COLOR,6,60,60,60 ! grey +CANCEL SYMBOL put_label let pq = p*q let pqmask = pq-pq @@ -170,16 +137,22 @@ let p_var = p + pqmask let q_var = q + pqmask ! Define some variables used below -LET pminmax = MINMAX(p_var) -LET qminmax = MINMAX(q_var) +LET pminmax = MINMAX(p) +LET qminmax = MINMAX(q) ! Check for all-bad data. pminmax and qminmax depend on both p and q. ! If bad, figure out which variable is all-bad and set the label string. +! DSG data needs XSEQUENCE before doing NGD transform DEFINE SYMBOL isbad = `pminmax[i=2] - pminmax[i=1] ` IF ($isbad"0|bad>1|*>0") THEN - DEFINE SYMBOL qgood = `q[i=@ngd] GT 0` - DEFINE SYMBOL pgood = `p[i=@ngd] GT 0` + + LET qtest = XSEQUENCE(q) + LET ptest = XSEQUENCE(p) + DEFINE SYMBOL qgood = `qtest[i=@ngd] GT 0` + DEFINE SYMBOL pgood = `ptest[i=@ngd] GT 0` + + DEFINE SYMBOL bad_verb = is IF `($pgood) EQ 0 AND ($qgood) NE 0` THEN DEFINE SYMBOL bad_title = ($ferret_title_0) IF `($pgood) NE 0 AND ($qgood) EQ 0` THEN DEFINE SYMBOL bad_title = ($ferret_title_1) @@ -190,502 +163,116 @@ IF ($isbad"0|bad>1|*>0") THEN ENDIF IF ($bad_title"0|*>1") THEN - PLOT/VS/NOLAB/SYM=dot {0,1}, {0,1} + PLOT/VS/SYM=dot/SET {0,1}, {0,1} + ppl xlab ($ferret_title_1) + ppl ylab ($ferret_title_0) + ppl tics 0,0,0,0 + ppl axatic 0,0 + ppl axlint 0,0 + sh sym lab* + go unlabel ($labnum_x) + PPL PLOT + IF ($ferret_thumb"0|0|*>1") THEN LET ylab_bad = `($ppl$ylen)-3*($miss_lab_siz)` - LABEL/NOUSER 0.2, `ylab_bad-0.4`, -1, 0, ($miss_lab_siz), @AS($bad_title)($bad_verb) All-Missing + LABEL/NOUSER 0.2, `ylab_bad-3*($miss_lab_siz)`, -1, 0, ($miss_lab_siz), @AS($bad_title)($bad_verb) All-Missing DEFINE SYMBOL no_novalid_lab = 1 CANCEL SYMBOL bad_title ELSE LET ylab_bad = `($ppl$ylen)-2*($miss_lab_siz)` - LABEL/NOUSER 0.2, `ylab_bad-0.2`, -1, 0, ($miss_lab_siz), @AS($bad_title) ($bad_verb) All-Missing + LABEL/NOUSER 0.2, `ylab_bad-3*($miss_lab_siz)`, -1, 0, ($miss_lab_siz), @AS($bad_title) ($bad_verb) All-Missing DEFINE SYMBOL no_novalid_lab = 1 CANCEL SYMBOL bad_title ENDIF DEFINE SYMBOL ngood_data = -1 ! Dont do another label in LAS_results. - EXIT/SCRIPT -ENDIF - -! Define axes for both variables using the range in the data - -!---------- -! Possibly redefine longitude to lon360 depending on the longitude range. -! Do this first, as the constraints are based on lon in 0-360. Then the -! constrained variable will be correct. (This fixes ticket 1623). - -IF `itsa_lon_prop` THEN - - DEFINE SYMBOL is_lon = 1 - DEFINE SYMBOL lon_units = `($ferret_prop_var),RETURN=units` - -! Get min and max longitudes and create a LON axis. -! All this lon360 stuff is to deal with cases where longitude data is on -! both sides of the dateline. - - LET amin = pminmax[i=1] - LET amax = pminmax[i=2] - let adel = `0.1*(amax-amin),prec=7` - LET amin = MIN(`amin` - adel, 180) - LET amax = MAX(`amax` + adel, -180) - -! Initialize - LET ax_lo = ($region_x_lo) - LET ax_hi = ($region_x_hi) - - IF `amax-amin LT ax_hi-ax_lo` THEN - LET ax_lo = amin - let ax_hi = amax - ENDIF - -! make sure del_ax is defined - GO LAS_is_range ax_lo ax_hi ! get del_ax - - LET varnames = ..varnames - IF `IS_ELEMENT_OF_STR(varnames, "lon360") GT 0` THEN - LET/UNITS="($lon_units)" xvar_360 = lon360 - ELSE - LET/UNITS="($lon_units)" xvar_360 = IF ($ferret_prop_var) LT 0 THEN ($ferret_prop_var)+360 ELSE ($ferret_prop_var) - ENDIF - - LET xvminmax360 = MINMAX(xvar_360) - LET amin360 = xvminmax360[i=1] - LET amax360 = xvminmax360[i=2] - let adel = `0.1*(amax360-amin360),prec=7` - LET amin = MIN(`amin360 - adel`, 360) - LET amax = MAX(`amax360 + adel`, 0) - - LET adiff = amax - amin - - IF `(amax360 - amin360) LT adiff` THEN - - LET ax_lo360 = xvminmax360[i=1] - LET ax_hi360 = xvminmax360[i=2] - LET ax_lo360 = `MIN(ax_lo360-adel, 360)` - LET ax_hi360 = `MAX(ax_hi360+adel, 0)` - - IF `(ax_hi360-ax_lo360) LT (ax_hi-ax_lo)` THEN - LET xvar = xvar_360 - DEFINE SYMBOL pvar_reset = xvar_360 - SET VAR/NAME=($ferret_prop_var)_in ($ferret_prop_var) - LET/UNITS="($lon_units)"/d=1 ($ferret_prop_var) = IF ($ferret_prop_var)_in LT 0 THEN ($ferret_prop_var)_in+360 ELSE ($ferret_prop_var)_in - CANCEL SYMBOL pvar_reset - LET/UNITS="($lon_units)" xvar_360 = ($ferret_prop_var) - LET ax_lo = `ax_lo360` - LET ax_hi = `ax_hi360` - ENDIF - - CANCEL SYMBOL put_label ! an all-missing label may not be needed if we are using LON+360 - LET amin = ax_lo - LET amax = ax_hi - GO LAS_is_range ax_lo ax_hi ! get del_ax - LET ax_lo = `amin` - let ax_hi = `amax` - - IF `(ax_hi-ax_lo) GE 359` THEN - LET ax_lo = ($region_x_lo) - LET ax_hi = ($region_x_hi) - ENDIF - - ELSE ! case with 360 degree range - IF `((ax_hi-ax_lo) GT 350) AND (ax_lo LT (-178))` THEN - LET/UNITS="($lon_units)" xvar = xvar_360 - DEFINE SYMBOL pvar_reset = xvar_360 - LET ax_lo = 0 - LET ax_hi = 360 - ENDIF - - ENDIF !`(ax_hi-ax_lo) LT 359` - - IF `amax GT 180` THEN - LET/UNITS="($lon_units)" xvar = xvar_360 - DEFINE SYMBOL pvar_reset = xvar_360 - ENDIF - - IF `(ax_lo GT amin) OR (ax_hi LT amax)` THEN - - IF `ax_lo-amin LT 1` THEN LET ax_lo = `ax_lo - 1 ` - IF `amax-ax_hi LT 1` THEN LET ax_hi = `ax_hi + 1` - - IF `(ax_lo GT amin) OR (ax_hi LT amax)` THEN - LET/UNITS="($lon_units)" xvar = xvar_360 - DEFINE SYMBOL pvar_reset = xvar_360 - ENDIF - ENDIF - -! If there was a longitude mask apply that to the plot region -! change the test - valid value may be zero - - IF `($constr_lon_min"-1.e34|*>1") NE -1.e34` THEN - LET amin = ($constr_lon_min) - LET amax = ($constr_lon_max) - GO LAS_is_range amin amax H - LET ax_lo = `amin` - let ax_hi = `amax` - ENDIF - - DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units="($lon_units%degrees_east%)" haxis - IF ($dm_labels"0|*>1") THEN DEFINE SYMBOL special_label_x = ppl xfor (($dm_labels)) - DEFINE SYMBOL have_haxis = 1 - - DEFINE SYMBOL region_x_range = `ax_hi - ax_lo` ! reset this so LAS_fland.jnl chooses the right resolution - - LET dep_var = x[gx=haxis] - CANCEL SYMBOL data_1_units - CANCEL SYMBOL ferret_title_0 ! dont need a horizontal axis label -ENDIF -!---------- Redefining longitude - -LET amin = pminmax[i=1] -LET amax = pminmax[i=2] - -IF `itsa_tim_prop` THEN DEFINE SYMBOL is_time = 1 -GO LAS_is_range amin amax -CANCEL SYMBOL is_time - -IF `($have_haxis"0|*>1") EQ 0` THEN \ -DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units="`p,RETURN=units`" haxis -DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units="`p,RETURN=units`" haxis1 - -LET dep_var = x[gx=haxis] -LET dep_var1 = x[gx=haxis1]; sh var dep_var1 - - -LET qminmax = MINMAX(q_var) -LET amin = qminmax[i=1] -LET amax = qminmax[i=2] -GO LAS_is_range amin amax -CANCEL SYMBOL is_time - -DEFINE AXIS/y=`ax_lo`:`ax_hi`:`del_ax`/units="`q,RETURN=units`" vaxis -DEFINE AXIS/y=`ax_lo`:`ax_hi`:`del_ax`/units="`q,RETURN=units`" vaxis1 - -LET indep_var = y[gy=vaxis] -LET indep_var1 = y[gy=vaxis1] - -! Formatted horizontal axes -! See if the independent axis is longitude, latitude, or time -! If so redefine those axes - -IF `itsa_lat_prop` THEN - -! Get min and max latitudes and create a LAT axis. - - LET amin = pminmax[i=1] - LET amax = pminmax[i=2] - LET pdel = 0.1*(amax-amin) - - LET amin = MAX(`amin-pdel`, -90) - LET amax = MIN(`amax+pdel`, 90) - - GO LAS_is_range amin amax - - DEFINE AXIS/y=`ax_lo`:`ax_hi`:`del_ax`/units=deg haxis - - IF ($dm_labels"0|*>1") THEN DEFINE SYMBOL special_label_x = ppl xfor (($dm_labels)) - - LET dep_var = y[gy=haxis] - - DEFINE SYMBOL pqual = /TRANS - CANCEL SYMBOL data_1_units - CANCEL SYMBOL ferret_title_0 ! dont need a horizontal axis label - -! In this case, a horizontal Latitude axis, the independent variable is q - - LET amin = qminmax[i=1] - LET amax = qminmax[i=2] - GO LAS_is_range amin amax - - DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units="`p,RETURN=units`" vaxis - - LET indep_var = x[gx=vaxis] - -ENDIF - -IF `itsa_tim_prop` THEN - -! Get min and max times and create a time axis. -! use the result of LAS_is_range to determine the delta, -! but use the limits from the data. - - LET amin = pminmax[i=1] - LET amax = pminmax[i=2] - DEFINE SYMBOL is_time = 1 - - IF ($constr_tim_min"0|*>1") THEN - LET amin = ($constr_tim_min) - LET amax = ($constr_tim_max) - ENDIF - - GO LAS_is_range amin amax - CANCEL SYMBOL is_time -! handling case where the time range is zero or very short - IF `ax_hi - ax_lo LT 7200 AND ($tunits%|seconds>1|*>0%)` THEN - LET ax_hi = `ax_hi + 1800,prec=15` - LET ax_lo = `ax_lo - 1800,prec=15` - LET del_ax = 30 - ENDIF - - DEFINE AXIS/T=`ax_lo,prec=15`:`ax_hi,prec=15`:`del_ax`/T0="`($data_t_var).time_origin`"/units=($tunits) haxis - DEFINE AXIS/T=`ax_lo,prec=15`:`ax_hi,prec=15`:`del_ax`/T0="`($data_t_var).time_origin`"/units=($tunits) haxis2k - DEFINE SYMBOL haxis2k_defined = 1 - -! (possibly) coarser axis for the all-missing plot that will make the underlay. - let thaxis = t[gt=haxis] - let nthaxis = `thaxis,return=lsize` - IF `nthaxis GT 2000` THEN \ - DEFINE AXIS/T=`ax_lo,prec=15`:`ax_hi,prec=15`/npoints=2000/T0="`($data_t_var).time_origin`"/units=($tunits) haxis2k - DEFINE SYMBOL haxis2k_defined = 1 - - DEFINE SYMBOL timeaxis = haxis - DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax` haxis1 - LET tt = t[gt=haxis] - - LET nt = `tt,RETURN=size` - LET t1 = `tboxlo[gt=haxis,L=1]` - LET tn = tboxhi[gt=haxis,L=`nt`] - DEFINE SYMBOL haxis_tstart = `TAX_DATESTRING (t1, tt, "minutes")` - DEFINE SYMBOL haxis_tend = `TAX_DATESTRING (tn, tt, "minutes")` - DEFINE SYMBOL haxis_taxname = haxis - - LET dep_var = 0*t[gt=haxis] - IF ($haxis2k_defined"0|1") THEN - LET dep_var2k = 0*t[gt=haxis2k] - ELSE - define axis/t=1:2:1/units=seconds haxis2k - define symbol insitu_blankvar = 1 - ENDIF - - ! A time-lon plot would normally plot with time on the vertical - IF `itsa_lon_plot` THEN DEFINE SYMBOL pqual = /TRANS - - DEFINE SYMBOL connect_dots = 1 - DEFINE SYMBOL do_rsquare = 0 - - LET timplotvar = t[gt=haxis2k] - -ENDIF - -! Formatted vertical axes - -! See if the independent axis is longitude, latitude, or time -! If so redefine those axes - -IF `itsa_lon_prop EQ 0 AND itsa_lon_plot` THEN - - DEFINE SYMBOL is_lon = 1 - -! Get min and max longitudes and create a LON axis. -! Draw a blank plot to put formatted axis on the plot. - - DEFINE SYMBOL pqual = /TRANS ! vertical longitude axis - - LET amin = qminmax[i=1] - LET amax = qminmax[i=2] - GO LAS_is_range amin amax - - DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units=deg vaxis - IF ($dm_labels"0|*>1") THEN DEFINE SYMBOL special_label_y = ppl yfor (($dm_labels)) - - LET indep_var = x[gx=vaxis] - - CANCEL SYMBOL data_units - CANCEL SYMBOL ferret_title_1 ! dont need a vertical axis label - - ! Then we need to redefine the other variable to have a y axis - - IF `( itsa_tim_prop + itsa_lat_prop ) EQ 0` THEN - LET amin = pminmax[i=1] - LET amax = pminmax[i=2] - GO LAS_is_range amin amax - DEFINE AXIS/y=`ax_lo`:`ax_hi`:`del_ax`/units="`p,RETURN=units`" haxis - - LET dep_var = y[gy=haxis] - DEFINE SYMBOL do_rsquare = 0 - ELSE - - DEFINE SYMBOL connect_dots = 1 - DEFINE SYMBOL do_rsquare = 0 - ENDIF - - DEFINE SYMBOL do_rsquare = 0 - -ENDIF - -IF `itsa_lat_prop EQ 0 AND itsa_lat_plot` THEN - -! Get min and max latitudes and create a LAT axis. -! Draw a blank plot to put formatted axis on the plot. - - LET amin = qminmax[i=1] - LET amax = qminmax[i=2] - - GO LAS_is_range amin amax ! get del_ax - DEFINE AXIS/y=`ax_lo`:`ax_hi`:`del_ax`/units=deg vaxis - DEFINE SYMBOL region_y_range = `ax_hi - ax_lo` ! reset this so LAS_fland.jnl chooses the right resolution - - IF ($dm_labels"0|*>1") THEN DEFINE SYMBOL special_label_y = ppl yfor (($dm_labels)) - - LET indep_var = y[gy=vaxis] - CANCEL SYMBOL data_units - CANCEL SYMBOL ferret_title_1 ! dont need a vertical axis label - - DEFINE SYMBOL do_rsquare = 0 - DEFINE SYMBOL connect_dots = 1 - -ENDIF - -! Depth axis in vertical direction - -IF ($reverse_vert"0") THEN - - LET amin = qminmax[i=1] - LET amax = qminmax[i=2] - GO LAS_is_range amin amax ! get del_ax - LET ax_lo = `amin` - LET ax_hi = `amax` - - DEFINE AXIS/z=`ax_lo`:`ax_hi`:`del_ax`/units="`($ferret_plot_var),RETURN=units`"/depth vaxis - DEFINE AXIS/z=`ax_lo`:`ax_hi`:`del_ax`/units="`($ferret_plot_var),RETURN=units`"/depth vaxis1 - LET indep_var = z[gz=vaxis] - LET indep_var1 = z[gz=vaxis1] - + EXIT/SCRIPT ENDIF -DEFINE SYMBOL axes_already_defined = 1 - -ENDIF ! axes_already_defined, make the underlay plot. - IF `(($ax_label_x"0|*>1") + ($ax_label_y"0|*>1") GE 1) AND (($ferret_thumb"0|0|*>1") EQ 0)` THEN DEFINE VIEW/AXES/X=0.12:0.99/y=0.06:0.93 full_view - DEFINE VIEW/AXES/X=0.12:0.99/y=0.1:0.93 full_view2 SET VIEW full_view ENDIF GO LAS_open_window IF ($ferret_thumb"0|0|*>1") THEN DEFINE VIEW/AXES/X=0.12:0.99/y=0.1:0.93 full_view - DEFINE VIEW/AXES/X=0.12:0.99/y=0.1:0.93 full_view2 SET VIEW full_view ENDIF -! Do time underlay as a line plot, so the overlays work consistently -! Label the y-axis with the variable title; enlarge if its a thumbnail plot. - -IF `itsa_tim_prop` THEN - - LET vert_minmax = MINMAX(indep_var) - LET amin = vert_minmax[i=1] - LET amax = vert_minmax[i=2] - - LET is_time = 0 - GO LAS_is_range amin amax - IF `($haxis2k_defined"0|1") EQ 0` THEN let timplotvar = t[gt=haxis2k] - 1000 +! If its a lon/lat plot, make a map with the same resolution as it would be +! done on a map, but with light gray. +! Only if longitude is on the horizontal axis - PLOT/NOLAB/VLIM=`ax_lo`:`ax_hi` timplotvar +IF `itsa_map_plot` THEN - ! label location to the left of the left axis + DEFINE SYMBOL do_rsquare = 0 + IF ($feature_type"0|trajectory>1|*>0") THEN DEFINE SYMBOL connect_dots = 1 + + CANCEL SYMBOL ferret_title_1 ! dont need a vertical axis label - LET xlab_loc = -0.06 - IF `MAX(ABS(ax_lo), ABS(ax_hi)) GT 1000` THEN LET xlab_loc = -0.08 + IF ($dm_labels"0|*>1") THEN DEFINE SYMBOL special_label_y = ppl yfor (($dm_labels)) + +! PLOT/VS/SET($qualifiers) p, q + +! GO LAS_is_range (($XAXIS_MIN)) (($XAXIS_MAX)) - DEFINE SYMBOL yaxis_title = ($ferret_title_1%($data_1_title)%) + STAT/brief p + LET amin = ($stat_min"0|bad>0|*") + LET amax = ($stat_max"0|bad>0|*") + GO LAS_is_range `amin` `amax` - IF `($is_thumb"0") AND ($yaxis_title"0|*>1")` THEN + DEFINE SYMBOL region_x_lo = `ax_lo` + DEFINE SYMBOL region_x_hi = `ax_hi` + DEFINE SYMBOL region_x_range = `ABS(ax_hi-ax_lo)` - ! use the title w/o units - DEFINE SYMBOL yaxis_title = ($data_1_title) + STAT/brief q + LET amin = ($stat_min"0|bad>0|*") + LET amax = ($stat_max"0|bad>0|*") - ! label size: Enlarge if possible depending on its length. + GO LAS_is_range `amin` `amax` - LET pagefrac = (LABWID("($yaxis_title)", 0.12*labfac) / ($ppl$ylen)) - IF `pagefrac GT 1` THEN LET labfac = `labfac/pagefrac` - - ENDIF - ANNOTATE/NORM/XPOS=`xlab_loc`/YPOS=0.5/HALIGN=0/ANGLE=90/SIZE=`0.12*labfac` "($yaxis_title)" - - EXIT/SCRIPT -ENDIF + DEFINE SYMBOL region_y_lo = `ax_lo` + DEFINE SYMBOL region_y_hi = `ax_hi` + DEFINE SYMBOL region_x_range = `ABS(ax_hi-ax_lo)` + DEFINE SYMBOL base_x_region = x=($region_x_lo):($region_x_hi) + DEFINE SYMBOL base_y_region = y=($region_y_lo):($region_y_hi) -LET bvar = dep_var + indep_var -IF `dep_var2k,RETURN=defined` then LET bvar = dep_var2k + indep_var - -LET allmiss = IF bvar THEN (`bvar,RETURN=bad`) -CANCEL MODE nodata_lab -IF `($special_label_x"0|*>1") OR ($special_label_y"0|*>1") OR\ - ($ax_label_x"0|*>1") OR ($ax_label_y"0|*>1")` THEN - SHADE/NOKEY/PAL=white($pqual)/SET/title=" " allmiss - ($ax_label_x) - ($ax_label_y) - ($ax_label_resize) - ($thumb_alab_size) - IF `($lab1"0|*>1")` THEN go unlabel 1 - PPL SHADE - SET VIEW full_view2 -ENDIF + IF ($constr_x_min"0") THEN DEFINE SYMBOL base_x_region = x=($constr_x_min):($constr_x_max) + IF ($constr_y_min"0") THEN DEFINE SYMBOL base_y_region = y=($constr_y_min):($constr_y_max) -SHADE/NOKEY/PAL=white($pqual)/NOAX/title=" "/SET allmiss - ($thumb_alab_size) - ($ax_label_resize) -IF ($lab1"0|*>1") THEN - IF `(STRINDEX("($lab1)", "YEAR") GT 0)` THEN - IF `STRINDEX("($note_($note_num%0%)_lab%0%)", "YEAR") EQ 0` THEN - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = ($lab1) - IF ($ferret_thumb"0|0|*>1") THEN label/nouser `-0.2*($ppl$xorg)`,`-0.95*($ppl$yorg)`,-1,0,($txl_lab_size),($lab1) - ENDIF - ENDIF - GO unlabel 1 -ENDIF -PPL SHADE - -! For time series, do a plot of the original variables to set the axis symbols -IF `itsa_tim_prop` THEN - SET VIEW ($view2) - LET bvar = dep_var1 + indep_var1 - IF `dep_var2k,RETURN=defined` then LET bvar = dep_var2k + indep_var1 - LET allmiss = IF bvar THEN (`bvar,RETURN=bad`) - SHADE/NOAX/NOKEY/PAL=white/title=" " allmiss - SET MODE/LAST nodata_lab - EXIT/SCRIPT -ENDIF + go basemap ($base_x_region) ($base_y_region) " " white -! For latitudes, do a plot of the original variables to set the axis symbols + DEFINE SYMBOL land_palette = gray_light + GO LAS_fland ($land_palette) + SET DATA 1 + DEFINE SYMBOL lon_units = degrees_east -IF `itsa_lat_prop` THEN - IF `itsa_lon_plot` THEN - SET MODE/LAST nodata_lab - EXIT/SCRIPT - ENDIF - SET VIEW ($view2) - LET bvar1 = dep_var1 + indep_var1 - LET allmiss1 = IF bvar THEN (`bvar1,RETURN=bad`) - SHADE/NOAX/NOKEY/PAL=white($pqual)/title=" " allmiss1 + DEFINE SYMBOL qualifiers = ($qualifiers)/OVER -ENDIF +ELSE -! If its a lon/lat plot, make a map with the same resolution as it would be -! done on a map, but with light gray. -! Only if longitude is on the horizontal axis + STAT/brief p + LET amin = ($stat_min"0|bad>0|*") + LET amax = ($stat_max"0|bad>0|*") + GO LAS_is_range `amin` `amax` -IF `itsa_lon_prop AND itsa_lat_plot` THEN + GO LAS_is_range `amin[e=@min]` `amax[e=@max]` + DEFINE SYMBOL hlim = /HLIM=`ax_lo`:`ax_hi` + + STAT/brief q + LET amin = ($stat_min"0|bad>0|*") + LET amax = ($stat_max"0|bad>0|*") + GO LAS_is_range `amin` `amax` - DEFINE SYMBOL region_x_lo = ($ppl$xmin) - DEFINE SYMBOL region_x_hi = ($ppl$xmax) - DEFINE SYMBOL land_palette = gray_light + DEFINE SYMBOL vlim = /VLIM=`ax_lo`:`ax_hi` - GO LAS_fland ($land_palette) - SET DATA 1 - DEFINE SYMBOL lon_units = degrees_east ENDIF -SET MODE/LAST nodata_lab - -!! See testing comment at top -DEFINE SYMBOL xvar = constraints_mask*xvar -DEFINE SYMBOL yvar = constraints_mask*yvar +DEFINE SYMBOL xvar = xvar +DEFINE SYMBOL yvar = yvar LET p = ($xvar) LET q = ($yvar) diff --git a/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl b/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl index 2bf25aa35..c1bbae368 100644 --- a/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl +++ b/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl @@ -1,7 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Author: ACM -! 10/14 Call one of the Waterfal Plots in XZ, YZ, or ZT. +! 10/14 Call one of the Waterfall Plots in XZ, YZ, or ZT. ! ! ! Set the gif filename, changing it from .gif to the name from this request @@ -9,12 +9,12 @@ GO LAS_initial_setup !! Make a 2d plot... -IF ($ferret_view"0|xzt>1|*>0") THEN -define symbol ferret_view = xz -ENDIF -IF ($ferret_view"0|yzt>1|*>0") THEN -define symbol ferret_view = yz -ENDIF +IF ($ferret_view"0|xzt>1|*>0") THEN DEFINE SYMBOL ferret_view = xz +IF ($ferret_view"0|yzt>1|*>0") THEN DEFINE SYMBOL ferret_view = yz + +! Set aspect ratio +DEFINE SYMBOL win_aspect = 0.6 + IF ($ferret_view"0|xz>1|yz>1|zt>1|*>0") THEN GO insitu_waterfall_($ferret_view) ELSE diff --git a/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl index 9f158dc32..baf480431 100644 --- a/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl @@ -37,6 +37,11 @@ DEFINE SYMBOL data_name_in = ($data_0_var) GO LAS_initialize_data 0 + +LET gettype= ($ferret_plot_var) +DEFINE SYMBOL vtype = `gettype,RETURN=dtype` +DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") + ! The chosen "plot-by" variable has no effect on this result. ! It is only ever a set of locations on the map. Reduce possible ! complications with data type of variable etc by substituting longitude. @@ -55,28 +60,22 @@ ENDIF GO LAS_url_label 0 ! For the annotations -DEFINE SYMBOL dshape = `($data_x_var),RETURN=shape` -IF ($dshape"0|POINT>1|*>0) THEN - IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `($data_x_var)` - IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `($data_x_var)` -ELSE - IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `($data_x_var)[($dshape"i")=@NGD]` - IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `($data_x_var)[($dshape"i")=@NBD]` -ENDIF -IF `STRINDEX("($ferret_view"0")", "x") GT 0` THEN - - LET/UNITS=degrees_east x_var_data = ($data_x_var) - IF `($nodata"0|*>1") EQ 0` THEN - STAT x_var_data - ELSE - DEFINE SYMBOL stat_min ($region_x_lo) - ENDIF - - IF ($data_y_var"0|*>1") THEN LET/UNITS=degrees_north y_var_data = ($data_y_var) - IF ($data_z_var"0|*>1") THEN LET z_var_data = ($data_z_var) - IF ($data_t_var"0|*>1") THEN LET t_var_data = ($data_t_var) +define axis/($dsgshape)=1:($numobs):1 simpleax +let countdata = ($data_0_var)[g($dsgshape)=simpleax] +IF ($dsgshape"0|POINT>1|*>0) THEN + IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = 1 + IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = 1 +ELSE + IF ($is_string) THEN + DEFINE SYMBOL ngood_data = 0 + DEFINE SYMBOL nbad_data = 0 + ELSE + stat ($data_0_var) + IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) + IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) + ENDIF ENDIF ! Plot qualifiers (graticule lines etc) @@ -94,17 +93,11 @@ GO LAS_XY_overlay_basemap PPL SHASET PROTECT -! GO LAS_fland black -! GO LAS_fland navy -! GO LAS_fland brown_dark -! GO LAS_fland green_pine - GO LAS_fland gray_dark PPL SHASET PROTECT ! Define plot qualifiers for polygon overlay -!CANCEL SYMBOL qualifiers DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/NOLAB ! There is no plot variable defined - only plotting locations - @@ -116,22 +109,8 @@ DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY ! If lon and lat are on the obs axis, pull out a single location ! for each feature id. -DEFINE SYMBOL lonshape = `x_var_data,return=shape` -DEFINE SYMBOL latshape = `y_var_data,return=shape` -DEFINE SYMBOL feature_shape = `($feature_variable),return=shape` - -IF ($lonshape"0|($feature_shape)>0|*>1) THEN - LET longest = ($rowvar)[($rind)=@max]+2 - LET data_var_x = EXPNDI_BY_Z_COUNTS(x_var_data, xsequence(($rowvar)),`longest`) - LET data_var_y = EXPNDI_BY_Z_COUNTS(y_var_data, xsequence(($rowvar)),`longest`) - - LET xpoints = data_var_x[k=1] - LET ypoints = data_var_y[k=1] -ELSE - LET xpoints = ($data_x_var) - LET ypoints = ($data_y_var) -ENDIF - +LET xpoints = ($data_x_var) +LET ypoints = ($data_y_var) ! Draw the locations as a light-blue circle with blue outline. IF `($program_name"0|PyFerret>1|*>0") AND ($FERRET_VERSION) GE 7.32` THEN @@ -184,6 +163,9 @@ GO set_constraint_labels ! Save the results +! Get rid of the label that would be drawn, no valid data +IF ($is_string"0") THEN DEFINE SYMBOL ngood_data = 1 + GO LAS_results box ! End of file ------------LAS_insitu_pie_xy.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl b/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl index ba1af2f94..2e5cb0e88 100644 --- a/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl +++ b/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl @@ -1,16 +1,15 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Timeseries_station_plot.jnl +! +! Plot sets of time series from a Discrete Sampling Geometries timeseries dataset ! ! Author: Ansley Manke ! Date: Nov 2014 -! 10/2016 ACM Catch and issue an error for string variables -! 12/2016 fixes for case when first variable is all-missing -! 8/2017 *acm* Account for change to expndi_by_m_function -! 11/2017 *acm* Handle timeseries data returned with just one point -! 11/2017 *acm* Dont label plots with units of "units" or "none" -! 11/2018 *acm* Fix loop control bug when a timeseries is all missing - -! Plot sets of time series from a Discrete Sampling Geometries timeseries dataset +! 3/2019 Rewrite to take advantage of native DSG file handling in Ferret/PyFerret +! Multiple stations, 1 variable, plot all stations together on one timeseries plot +! One station, multi-variable, plot together as for gridded multi-var time series plots +! Not handling multi-var, multi-station plots at this time +! (plot one var, all stations and write a note. ! SET MODE verify:always ! allows for debugging @@ -18,12 +17,6 @@ SET MODE verify:always ! allows for debugging ! Set the gif filename, changing it from .gif to the name from this request ! Set up to write info to the debug log so that FshowGO can be used GO LAS_initial_setup -! Add another color, light gray, to make a line through the middle of each plot -! for multiple timeseries, and for graticules. -LET ncolors = 7 -SET MODE LINEC:`ncolors` - -PPL COLOR,7,85,85,85 ! lt gray ! Do up to 8 separate stations as their own line plot on the page @@ -56,17 +49,11 @@ IF ($data_0_var"0|vid>1|*>0") THEN ENDIF DEFINE SYMBOL data_name_in = ($data_0_var) -GO LAS_initialize_data 0 +REPEAT/RANGE=1:($data_count)/NAME=icount (\ + GO LAS_initialize_data `icount-1`) -! for this we do not need var_with_gaps DEFINE SYMBOL data_var = ($data_0_var) -IF `($data_count) GT 1` THEN DEFINE SYMBOL data_var_1 = ($data_1_var) -IF `($data_count) GT 2` THEN DEFINE SYMBOL data_var_2 = ($data_2_var) -IF `($data_count) GT 3` THEN DEFINE SYMBOL data_var_3 = ($data_3_var) -IF `($data_count) GT 4` THEN DEFINE SYMBOL data_var_4 = ($data_4_var) -IF `($data_count) GT 5` THEN DEFINE SYMBOL data_var_5 = ($data_5_var) - DEFINE SYMBOL its_insitu = 1 DEFINE SYMBOL its_tsplot = 1 DEFINE SYMBOL line_drawn = 1 @@ -82,14 +69,33 @@ ENDIF REPEAT/RANGE=0:`($data_count)-1`/name=q (\ DEFINE SYMBOL q =`q`;\ - LET gettype = ($data_($q)_var)[($vshape"x")=1];\ + LET gettype = ($data_($q)_var);\ DEFINE SYMBOL vtype = `gettype,RETURN=dtype`;\ IF `($vtype"0|CHAR>1|*>0")` THEN ;\ - MESSAGE/ERROR **ERROR Invalid data type for variable";\ - EXIT/PROGRAM;\ + PLOT/vlim=0:1/hlim=0:1/nolab/set {100,101}, {100,101};\ + PPL AXLABP 0,0;\ + PPL TICS 0,0,0,0;\ + PPL PLOT;\ + DEFINE SYMBOL no_valid_lab = 1;\ + DEFINE SYMBOL ferret_plot_var = 1;\ + ANNOTATE/NORM/xpos=0.5/ypos=0.8/halign=0/size=0.14 "Time plot of ($data_title) is invalid: Make another choice";\ + GO LAS_results box;\ + EXIT/PROGRAM;\ ENDIF;\ ) +LET row_expand = EXPND_BY_LEN(XSEQUENCE(prof_id), XSEQUENCE(($rowvar)), rowsum) + +! or, make a nominal plot and punt. +! +! sh sym data*title*;\ +! PLOT/vlim=0:1/hlim=0:1/nolab/noaxis {100,101}, {100,101};\ +! DEFINE SYMBOL no_valid_lab = 1;\ +! DEFINE SYMBOL ferret_plot_var = 1;\ +! ANNOTATE/NORM/xpos=0.5/ypos=0.8/halign=0/size=0.14 "Time plot of ($data_title) is invalid: Make another choice";\ +! GO LAS_results box;\ +! EXIT/PROGRAM;\ + ! Here is variable 0 title DEFINE SYMBOL ferret_title_0 = ($ferret_plot_title"($data_var)") @@ -99,33 +105,16 @@ LET title_len = STRLEN("($ferret_title_0)") GO LAS_url_label 0 ! For the annotations -IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `($data_var)[i=@NGD]` -IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `($data_var)[i=@NBD]` -LET nstations = `($rowvar),return=msize` -LET maxrow = `($rowvar)[m=@max]` +LET data_good = ($data_var)[L=@ngd] +LET data_bad = ($data_var)[L=@nbd] -LET nobs = `time,return=isize` +DEFINE SYMBOL ngood_data = `data_good[m=@sum]` +DEFINE SYMBOL nbad_data = `data_bad[m=@sum]` +LET nstations = `nfeatures` DEFINE SYMBOL nstations = `nstations` -! Refuse to plot zillions of lines - -IF `nstations GT 30` THEN - MESSAGE/ERROR **ERROR Too many lines for Time plot. Choose 30 or fewer features to plot. - EXIT/PROGRAM -ENDIF - - -! when coloring multiple line plots, define a palette and color levels - -IF `nstations GT max_separate_stations` THEN - IF `($ferret_palette"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_palette = thirty_by_levels - IF `nstations LE max_labeled_stations` THEN \ - DEFINE SYMBOL ferret_palette = nine_by_levels - DEFINE SYMBOL ferret_fill_levels = (0,`nstations+1`,1) - IF `nstations GT max_labeled_stations AND ($data_count) eq 1` THEN DEFINE SYMBOL ferret_palette = range_of_blues ! something less bold... -ENDIF DEFINE SYMBOL margin_del = 0.08 ! If multiple axes for different units IF `($data_count) LE 2` THEN DEFINE SYMBOL margin_del = 0 @@ -133,422 +122,287 @@ IF `($data_count) LE 2` THEN DEFINE SYMBOL margin_del = 0 LET vxlo = 0.1 LET vxhi = 0.9 -let vylo = 0.16 ! 0.2 >> 0.16 -let vyhi = 0.98 +LET vylo = 0.16 ! 0.2 >> 0.16 +LET vyhi = 0.98 -IF `($data_count) GT 1 OR ($nstations) GT 1` THEN DEFINE SYMBOL itsa_multi_lineplot = 1 +LET num_colors = nstations +IF `nstations EQ 1` THEN LET num_colors = ($data_count) -GO LAS_set_plot_qualifiers -! Open the window, apply size, scale options -IF `nstations EQ 1 OR nstations GT max_separate_stations` THEN - DEFINE SYMBOL win_aspect = 0.4 -ELSE - DEFINE SYMBOL win_aspect = `0.4 + nstations/max_separate_stations` -ENDIF - -GO LAS_open_window - -DEFINE VIEW/AXES/X=0.08:0.99/YLIM=0.07:0.96 full_view -DEFINE VIEW/AXES/X=0.08:0.99/YLIM=0.07:0.96 full_viewr -SET VIEW full_view +show mode linecolors +IF `num_colors LE 12` THEN -PPL TICS,.1,.125,,,0,1 - - -! Use Ferret properties to set up the plot qualifiers -! Set up variables - multiple stations regrid to a common time axis + DEFINE SYMBOL nlinecolors = 13 + SET MODE LINECOLORS:13 + PPL COLOR,7,100,50,0 ! orange + PPL COLOR,8,0,55,0 ! dark green + PPL COLOR,9,60,0,100 ! purple + PPL COLOR,10,100,60,70 ! pink + PPL COLOR,11,80,70,60 ! tan + PPL COLOR,12,100,75,0 ! yellow -LET t1 = time[i=@min] -LET t2 = time[i=@max] -LET ntimes = min(2000,nstations *maxrow) - - -! Dataset with just one point. Make a nominal plot and exit - -IF `ntimes EQ 1 OR t1 EQ t2` THEN - LET t1 = time[i=@min] - 18000 - LET t2 = time[i=@max] + 18000 - LET ntimes = 5 - DEFINE AXIS/T=`t1,prec=15`:`t2,prec=15`/npoints=`ntimes`/UNITS=seconds/T0="`time.time_origin`" taxis_all - LET var = {,,`($data_var)`,,} - - LET tt5 = t[gt=taxis_all] - LET plot_var = reshape(var,tt5) - PLOT/symbol=19/siz=0.12/color=blue/thick/nolab reshape(var,tt5) - DEFINE SYMBOL data_0_var = plot_var - DEFINE SYMBOL result_type = tline - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = Request includes just one time point - GO LAS_results ($result_type) - exit/program -ENDIF - - -DEFINE AXIS/T=`t1,prec=15`:`t2,prec=15`/npoints=`ntimes`/UNITS=seconds/T0="`time.time_origin`" taxis_all + PPL COLOR,($nlinecolors),90,90,90 !gray + DEFINE SYMBOL gryclr = ($nlinecolors) +ELSE +! Define colors to duplicate the color-palette range_of_blues + DEFINE SYMBOL nlinecolors =` MOD(num_colors+2, 20)` + SET MODE LINECOLORS:`num_colors+2` -IF `nstations EQ 1` THEN - LET sloc = STRINDEX("`time.units`", " ") - LET tunits = SUBSTRING("`time.units`", 1, sloc-1) - DEFINE AXIS/T/UNITS=`tunits`/t0="`time.time_origin`" taxis = time -ENDIF -LET tt = t[gt=taxis] -LET tt_all = t[gt=taxis_all] + LET del = `1./(num_colors)` -DEFINE AXIS/x=1:`maxrow`:1 xrow -LET xvar = x[gx=xrow] + REPEAT/RANGE=2:`num_colors+1`/NAME=ii (\ + def sym ii = `ii`;\ + LET reds = 20 + (($ii)-1)* (30*del);\ + LET grns = 30 + (($ii)-1)* (50*del);\ + LET blus = 95 + (($ii)-1)* ( 5*del);\ + PPL COLOR,`ii`,`reds,prec=5`,`grns,prec=5`,`blus,prec=5`) -LET time2d = EXPNDI_BY_M_COUNTS (time[i=1:`nobs`], ($rowvar)[M=1:`nstations`], xvar) -LET var2d_0 = EXPNDI_BY_M_COUNTS (($data_var)[i=1:`nobs`], ($rowvar)[M=1:`nstations`], xvar) + PPL COLOR,($nlinecolors),90,90,90 !gray -LET id2dz = EXPNDI_ID_BY_Z_COUNTS( XSEQUENCE(($rowvar)[M=1:`nstations`]), maxrow) -LET id2d = RESHAPE(TRANSPOSE_XZ(id2dz), var2d_0) -DEFINE SYMBOL axset = /axes=0,1,1,0 + DEFINE SYMBOL gryclr = ($nlinecolors) -DEFINE SYMBOL vtype = `($data_var),RETURN=dtype` - IF ($vtype"0|CHAR>1|*>0") THEN - DEFINE SYMBOL error_string = Invalid data type for variable ($ferret_title_0). Choose another variable. - MESSAGE/ERROR **ERROR ($error_string) - EXIT/PROGRAM + DEFINE SYMBOL qualifiers = ($qualifiers)/color ENDIF -IF `($data_var)[i=@ngd] GE 1` THEN - LET dmm = MINMAX (($data_var)) - - ppl %range `dmm[i=1],prec=15`,`dmm[i=2],prec=15`, 5 - - IF ($ppl$range_low"|($ppl$range_high)>1|*>0") THEN - LET dm1 = 0.95*($ppl$range_low) - LET dm2 = 1.05*($ppl$range_low) - ppl %range `dm1,prec=15`,`dm2,prec=15`, 5 - ENDIF - LET ymn = ($ppl$range_low) - LET ymx = ($ppl$range_high) - LET ydl = ($ppl$range_inc) - - IF `STRINDEX(UPCASE("($data_units%0%)"), "COUNT") GT 0` THEN - LET dmm = minmax(($data_var)) - LET ymn = `dmm[i=1]-1` - LET ymx = `dmm[i=2]+1` - LET ydl = 0.5 - IF `ymx-ymn GT 10` THEN LET ydl = 1 - IF `ymx-ymn GT 20` THEN LET ydl = ($ppl$range_inc) - ENDIF - - IF `ymn EQ ymx` THEN - LET ymn = `ymn-1` - LET ymx = `ymx+1` - ENDIF -! Underlay plot with the time axis and the right vertical range -! check for the postitive=down attribute on the variable we're plotting - - IF `nstations LE max_labeled_stations AND ($data_count) EQ 1` THEN \ - DEFINE VIEW/AXES/X=0.08:0.99/YLIM=`vylo+0.02`:0.96 full_view - IF `($data_count) EQ 1 AND nstations GT 1` THEN - SET VIEW full_view - IF ($plot_pos_down"0|0|1|*>1") THEN - DEFINE SYMBOL vert = /VLIM=`ymx`:`ymn`:`ydl` - ELSE - DEFINE SYMBOL vert = /VLIM=`ymn`:`ymx`:`ydl` - ENDIF - PLOT/NOLAB($qualifiers)($vert) `ymn-100` + 0*t[gt=taxis_all] +IF `($data_count) GT 1 AND nstations EQ 1` THEN DEFINE SYMBOL itsa_multi_lineplot = 1 - ENDIF - -ELSE ! no valid data_var data - LET ymn = -1 - LET ymx = 1 - LET ydl = 0.5 -ENDIF - -IF `($data_var)[i=@ngd] EQ 0 AND ($data_count) eq 1` THEN - - PLOT/NOLAB($qualifiers)/VLIM=-1:1 `-100` + 0*t[gt=taxis_all] - LET nstations = 1 -! LABEL/NOUSER `0.5*($ppl$xlen)`,`0.5*($ppl$ylen)`,0,0,0.15 No Valid Data - DEFINE SYMBOL allbad = 1 - CANCEL SYMBOL axset -! DEFINE SYMBOL ferret_use_graticules = none -ENDIF ! For 1-variable, 1-station plots, turn on horizontal graticule lines, unless graticules ! have been turned off explicitly. Ignore choice of white - its in the menu ! but useless for line plots. IF `($data_count) EQ 1` THEN - IF `(nstations GE max_labeled_stations) AND ($ferret_use_graticules"1|none>0|notic>0|white>0|*>1)` THEN + IF `(nstations GE max_labeled_stations) AND ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1)` THEN IF ($ferret_use_graticules"0|black>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) + DEFINE SYMBOL ferret_use_graticules = 1 ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=7) + DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=($gryclr"7")) + DEFINE SYMBOL ferret_use_graticules = 1 ENDIF ENDIF ENDIF +IF `($data_count) GT 1 AND nstations GT 1` THEN + IF ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1) THEN + IF ($ferret_use_graticules"0|black>1") THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) + DEFINE SYMBOL ferret_use_graticules = 1 + ELSE + DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=($gryclr"7")) + DEFINE SYMBOL ferret_use_graticules = 1 + ENDIF + ENDIF +ENDIF + +GO LAS_set_plot_qualifiers +define symbol qualifiers ($qualifiers) + ! Otherwise turn them on only if requested IF `(nstations GT 1) AND ($ferret_use_graticules"0|none>0|notic>0|white>0|*>1)` THEN IF ($ferret_use_graticules"0|black>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=7) + DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=($gryclr"7")) ENDIF ENDIF + ! Change any line characteristics. The above LAS_set_plot_qualifiers, doesnt get the right ones ! because it depends on the view shape to determine plot type. This has a multi=D shape for a 1-D line plot. IF ($ferret_line_or_sym"0|*>1") THEN DEFINE SYMBOL plotsymbol = 25 GO set_linesym -!IF ($ferret_line_color"0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/color=($ferret_line_color) -!IF ($ferret_line_thickness"0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/thick=($ferret_line_thickness) -! Analyze the variables and units to group variables by unit. -! setting up definitions for station 1. If more stations, this will be repeated below. +! Open the window, apply size, scale options -LET row1 = 1 -LET rowm = `($rowvar)[m=1]` -IF `nstations EQ 1` THEN - DEFINE AXIS/T/UNITS=seconds/T0="`time.time_origin`" taxis_sta = time +IF `($data_count) EQ 1 OR nstations EQ 1` THEN + DEFINE SYMBOL win_aspect = 0.4 ELSE - DEFINE AXIS/T/UNITS=seconds/T0="`time.time_origin`" taxis_sta = time[i=`row1`:`rowm`] -ENDIF - - -LET tt = t[gt=taxis_sta] -LET plot_var_tA = RESHAPE(($ferret_plot_var), tt) + DEFINE SYMBOL win_aspect = `0.4 + nstations/max_separate_stations` -LET plot_var_t = plot_var_tA[gt=taxis_all@bin] -DEFINE SYMBOL ferret_plot_var_0 = plot_var_t -DEFINE SYMBOL units_0 = ($data_0_units"units") -DEFINE SYMBOL plot_arg = ($ferret_plot_var_0) -DEFINE SYMBOL all_units_same = 1 +! ? Adjust the aspect ratio to make the plots more uniformly +! shaped as there are more and more on the page? + LET aspects = {0.4,0.45,0.575,0.7,0.825, 0.95, 1.075, 1.2} + DEFINE SYMBOL win_aspect = `aspects[i=($data_count)]` -REPEAT/RANGE=1:`($data_count)-1`/name=q (\ - DEFINE SYMBOL q =`q`;\ - LET data_($q)_var_tA = RESHAPE(($data_($q)_var)[i=`row1`:`rowm`], tt);\ - LET data_($q)_var_t = data_($q)_var_tA[gt=taxis_all@bin];\ - DEFINE SYMBOL ferret_plot_var_($q) = data_($q)_var_t;\ - DEFINE SYMBOL plot_arg = ($plot_arg),($ferret_plot_var_($q));\ - DEFINE SYMBOL ferret_title_($q) = ($data_($q)_title) (($data_($q)_units));\ - DEFINE SYMBOL units_($q) = `UPCASE("($data_($q)_units%units%)")`;\ - DEFINE SYMBOL all_units_same = `($all_units_same) AND (STRCMP("($units_0)", "($units_($q))") EQ 0)`;\ -) +ENDIF -DEFINE SYMBOL have_multiline_defs = 1 -GO collect_units_vars +GO LAS_open_window -LET vxhi_g = `vxhi - ($margin_del)* (($nunit_grp)-2)` +DEFINE VIEW/AXES/X=0.08:0.99/YLIM=0.07:0.96 full_view +DEFINE VIEW/AXES/X=0.08:0.99/YLIM=0.07:0.96 full_viewr +SET VIEW full_view -IF `nstations EQ 1` THEN ! one station multi var +PPL TICS,.1,.125,,,0,1 - DEFINE SYMBOL data_var = plot_var_t - DEFINE SYMBOL ferret_view = t - DEFINE SYMBOL itsa_multi_lineplot = 1 - CANCEL SYMBOL ferret_trend_line +! Set up variables - multiple stations plotted on a common time axis -! symbols and/or line - GO set_linesym +LET tmin = time[L=@min] +LET tmax = time[L=@max] +LET t1 = `tmin[e=@min]` +LET t2 = `tmax[e=@max]` +LET ntimes = `time,RETURN=lsize` - DEFINE SYMBOL do_legend = `($data_count"0") GT 1` - IF `($allbad"0") EQ 0` THEN GO LAS_draw_multi_line_plot `vxlo` `vxhi` `vylo` `vyhi` +! Used by the results script for the time range - DEFINE SYMBOL ferret_plot_var = plot_var_t - LET vart = plot_var_t +DEFINE AXIS/T=`t1,prec=15`:`t2,prec=15`/npoints=`ntimes`/UNITS=seconds/T0="`time.time_origin`" taxis_all +LET tt_all = t[gt=taxis_all] -! end one station multi var -ELSE ! more than 1 station +! Dataset with just one point. Make a nominal plot and exit -! Plot the lines. For up to max_separate_stations, make separate labeled -! line plots. Otherwise make a cloud of colored lines, changing color -! with each line. Should have a UI choice between the two styles. +IF `ntimes EQ 1 OR t1 EQ t2` THEN + LET t1 = `t1 - 18000` + LET t2 = `t2 + 18000` + LET ntimes = 5 + DEFINE AXIS/T=`t1,prec=15`:`t2,prec=15`/npoints=`ntimes`/UNITS=seconds/T0="`time.time_origin`" taxis_all - IF `nstations LE max_separate_stations AND ($data_count) GT 1` THEN + LET var = {,,`($data_var)`,,} + + LET tt5 = t[gt=taxis_all] + LET plot_var = reshape(var,tt5) + PLOT/symbol=19/siz=0.12/color=blue/thick/nolab reshape(var,tt5) -! ? Do we want to adjust the aspect ratio to make the plots more uniformly -! shaped as there are more and more on the page? + DEFINE SYMBOL data_0_var = plot_var + DEFINE SYMBOL result_type = tline + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL note_($note_num)_lab = Request includes just one time point - LET aspects = {0.3,0.45,0.575,0.7,0.825, 0.95, 0.075, 1.2} + GO LAS_results ($result_type) + exit/program +ENDIF - LET aspects = {0.3,0.45,0.575,0.7,0.825, 0.95, 1.075, 1.2} - LET use_aspect = aspects[i=`nstations`] - set win/asp=`use_aspect` +DEFINE SYMBOL vtype = `($data_var),RETURN=dtype` + IF ($vtype"0|CHAR>1|*>0") THEN + DEFINE SYMBOL error_string = Invalid data type for variable ($ferret_title_0). Choose another variable. + MESSAGE/ERROR **ERROR ($error_string) + EXIT/PROGRAM +ENDIF -! Make the time series axis along the bottom -! This viewport will be used to draw the time axis at the bottom -! and to label the z axes. - - DEFINE VIEW/AXES/XLIM=`vxlo`:`vxhi`/YLIM=0.002:`vyhi` tv - IF `($data_count) GT 1` THEN DEFINE VIEW/AXES/TEXT=0.85/XLIM=`vxlo`:`vxhi_g`/YLIM=`vylo`:`vyhi` tv - SET VIEW tv +! Native time-series plot of multiple stations, one variable. +! (note in auto-labeling the series, if data all-missing, +! Ferret adds "No Valid Data" to the key label. If this makes +! the label long, then it's broken into 2 lines and writes, smaller. +! Can lead to inconsistent label sizes. See put_key.F) -! Define variables for consistent vertical axes for all the time series +! Multi-station plot of one variable +IF `($data_count) EQ 1` THEN - REPEAT/RANGE=1:`nunique`/name=g (\ - DEFINE SYMBOL group = `g-1`;\ - GO set_vertical_range ($group) ) + DEFINE VIEW/AXES/X=0.08:0.99/YLIM=`vylo+0.05`:0.96 full_view + SET VIEW full_view + PLOT($qualifiers)($axset) ($data_var) -! Draw the time axis along the bottom of the page. -! If there is just one timeseries, we'll plot the time -! axis along with the data so the plot axes line up. +ELSE - IF `($data_count) GT 1` THEN GO margins 0.1,1.4 \ - ELSE GO margins 0.1,0.6 - PLOT/NOLAB/SYM=DOT/AXES=0,1,0,0/VLIM=`plotmin_0`:`plotmax_0` t[gt=taxis_all] - DEFINE SYMBOL axset = /axes=0,0,1,0 +! Multi-variable plot of one station + IF `nstations EQ 1` THEN + sh sym data*var* + SET VAR/NAME=($data_0_var)_in ($data_0_var) + LET/LIKE=($data_0_var)_in/d=($dsetnum) ($data_0_var) = ($data_0_var)_in[gt=tt_all] + SET VAR/NAME=($data_1_var)_in ($data_1_var) + LET/LIKE=($data_1_var)_in/d=($dsetnum) ($data_1_var) = ($data_1_var)_in[gt=tt_all] + SET VAR/NAME=($data_2_var)_in ($data_2_var) + LET/LIKE=($data_2_var)_in/d=($dsetnum) ($data_2_var) = ($data_2_var)_in[gt=tt_all] + DEFINE SYMBOL ferret_view = t + DEFINE SYMBOL ferret_plot_var_0 = ($ferret_plot_var) + GO LAS_draw_multi_line_plot + +! Multi-station plots of each variable + ELSE + + + LET vxlo = 0.1 + LET vxhi = 0.9 + + LET vylo = 0.16 ! 0.2 >> 0.16 + LET vyhi = 0.94 + + + ! Draw the time axis and feature-ids just once at the bottom of the page. -! Define viewports for the time series plots -! If multiple data variables, leave room for the line-key at the bottom. LET y2 = `vyhi` - LET del = 0.92/nstations - IF `($data_count) GT 1` THEN LET del = 0.8/nstations - LET y1 = `y2 - del` + 0.02 - IF `nstations LE 3` THEN LET y1 = `y1 + 0.02` - - REPEAT/RANGE=1:`nstations`/NAME=s (\ - DEFINE SYMBOL s = `s`;\ - DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`y1`:`y2` vp_`s`;\ - DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi_g`/ylim=`y1`:`y2` vp_`s`_g;\ - DEFINE SYMBOL y1_($s) = `y1`;\ - DEFINE SYMBOL y2_($s) = `y2`;\ - LET y1 = `y1 - del`; LET y2 = `y2 - del`) - -! Set up to draw a gray horizontal line through the middle of each plot - LET t_all = t[gt=taxis_all] - LET tpts = {`t_all[L=@min]`, `t_all[L=@max]`} - LET ymid = ( `plotmax_0` + `plotmin_0`)/2 - LET ypts = {`ymid`, `ymid`} - DEFINE SYMBOL draw_gray = `nstations GT 1 AND ($data_count) EQ 1` - -! Draw and label each timeseries. Define the time series from the -! time data in each individual feature, regrid to the overall time series -! so they will be positioned correctly. - -! check for the postitive=down attribute on the variable we're plotting - - IF ($plot_pos_down"0|0|1|*>1") THEN - DEFINE SYMBOL vert = /VLIM=`plotmax_0`:`plotmin_0`:`plotinc` - ELSE - DEFINE SYMBOL vert = /VLIM=`plotmin_0`:`plotmax_0`:`plotinc` + LET del = (vyhi-vylo)/($data_count) + LET y1 = `y2 - del` + 0.05 + IF `($data_count) LE 3` THEN LET y1 = `y1 + 0.05` + + REPEAT/RANGE=1:($data_count)/NAME=s (\ + DEFINE SYMBOL s = `s`;\ + DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`y1`:`y2` vp_`s`;\ + DEFINE SYMBOL y1_($s) = `y1`;\ + DEFINE SYMBOL y2_($s) = `y2`;\ + LET y1 = `y1 - del`; LET y2 = `y2 - del`) + + ! Adjust the aspect window so that multiple variables each have space similar + ! to what is used for 2 viewports and leaving enough at the bottom for the line key + + IF `($data_count) GT 2` THEN + + LET yy2 = `vyhi` + LET yy1 = `yy2 - (vyhi-vylo)/2` + 0.1 + DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`yy1`:`yy2` vp_test + set view vp_test + plot ($data_0_var) + LET y_frac = ($ppl$ylen)/($ppl$xlen) + DEFINE SYMBOL win_aspect = `0.2 + (($data_count)+1)* y_frac` + DEFINE SYMBOL ferret_size = `($ferret_size)* (1+0.2*(($data_count)-2))` + CANCEL SYMBOL set_window_quals + CANCEL WINDOW/all + GO LAS_open_window ENDIF + + ! Set up to draw a gray horizontal line through the middle of the plot - IF `plotinc EQ 0` THEN CANCEL SYMBOL vert - - DEFINE SYMBOL axset = /axes=0,0,1,1 - - IF ($allbad"0|*>1") THEN -! LABEL/NOUSER `0.5*($ppl$xlen)`,`0.5*($ppl$ylen)`,0,0,0.15 No Valid Data - ELSE - - IF `($data_count) GT 1` THEN - GO set_linesym - DEFINE SYMBOL do_legend = 0 - DEFINE SYMBOL nohoriz = 1 - ENDIF - -! Definitions for the different variables. The time axis taxis_sta -! and variable tt on that axis are redefined at each iteration -! of the stations loop below, other definitions made earlier - - LET row1 = 1 - LET rowm = `($rowvar)[m=1]` - - - REPEAT/RANGE=1:`nstations`/name=s (\ - DEFINE SYMBOL s = `s`;\ - SET VIEW vp_($s)_g;\ - SET VIEW vp_($s);\ - LET rowm = `row1+($rowvar)[m=($s)]-1`;\ - DEFINE AXIS/T/UNITS=seconds/T0="`time.time_origin`" taxis_sta = time[i=`row1`:`rowm`];\ - LET tt = t[gt=taxis_sta];\ - LET plot_var_tA = RESHAPE(($ferret_plot_var)[i=`row1`:`rowm`], tt);\ - REPEAT/RANGE=1:`($data_count)-1`/name=q (\ - DEFINE SYMBOL q =`q`;\ - LET data_($q)_var_tA = RESHAPE(($data_($q)_var)[i=`row1`:`rowm`], tt);\ - );\ - IF `($s) EQ nstations` THEN DEFINE SYMBOL do_legend = 1;\ - DEFINE SYMBOL station_label = `($feature_variable)[m=($s)]`;\ - DEFINE SYMBOL vpname = ($s)_;\ - GO LAS_draw_multi_line_plot `vxlo` `vxhi` ($y1_($s)) ($y2_($s));\ - let row1 = `rowm+1`) - - LET vart = plot_var_t - ENDIF ! allbad - - ELSE ! more than max_separate_stations stations, data_count is 1 - -! plot lines colored by index number, skipping any that are empty - - -! tt and vart are redefined in the loop if there is valid data in the -! individual series - - LET tt = t[gt=taxis_all] - LET vart = 1./0 + 0* tt + LET t_all = t[gt=taxis_all] + LET tpts = {`t1`, `t2`} - IF ($allbad"0|*>1") THEN -! LABEL/NOUSER `0.5*($ppl$xlen)`,`0.5*($ppl$ylen)`,0,0,0.15 No Valid Data - ELSE + DEFINE SYMBOL draw_gray = `($data_count) GT 1` -! Define correct time axis for each trajectory. If there are large gaps in the -! time axis itself detect that and pick up the pen. + DEFINE SYMBOL axset = /axes=0,0,1,0 - cancel symbol ferret_plot_var + REPEAT/RANGE=1:`($data_count)-1`/name=ivar (\ + DEFINE SYMBOL ivar = `ivar`;\ + DEFINE SYMBOL idata `ivar-1`;\ + DEFINE SYMBOL plotvar = ($data_($idata)_var);\ + SET VIEW vp_($ivar);\ + PLOT($qualifiers)($axset)/NOLAB ($plotvar);\ + ANNOTATE/NORM/XPOS=0.02/YPOS=1.05/HALIGN=-1/SIZE=0.12 "@AC($data_($idata)_title)";\ + ANNOTATE/NOUSER/XPOS=`-0.5*($ppl$yorg)`/YPOS=`($ppl$ylen)/2`/HALIGN=0/SIZE=0.1/angle=90 "@AC($data_($idata)_units)";\ + ) + + SET VIEW vp_($data_count) + DEFINE SYMBOL axset = /axes=0,1,1,0 + + DEFINE SYMBOL ivar = ($data_count);\ + DEFINE SYMBOL idata `($ivar)-1`;\ + DEFINE SYMBOL plotvar = ($data_($idata)_var);\ + + PLOT($qualifiers)($axset)/set ($plotvar) + ppl ylab " " + ppl title " " + IF ($labnum_x"0|*>1") THEN GO unlabel ($labnum_x) + IF ($labnum_y"0|*>1") THEN GO unlabel ($labnum_y) + IF ($labnum_z"0|*>1") THEN GO unlabel ($labnum_z) + IF ($labnum_t"0|*>1") THEN GO unlabel ($labnum_t) + IF ($labnum_e"0|*>1") THEN GO unlabel ($labnum_e) + IF ($labnum_dset"0|*>1") THEN GO unlabel ($labnum_dset) + IF ($labnum_datitl"0|*>1") THEN GO unlabel ($labnum_datitl) + IF ($labnum_year"0|*>1") THEN GO unlabel ($labnum_year) + + PPL PLOT + ANNOTATE/NORM/XPOS=0.02/YPOS=1.05/HALIGN=-1/SIZE=0.12 "@AC($data_($idata)_title)" + ANNOTATE/NOUSER/XPOS=`-0.5*($ppl$yorg)`/YPOS=`($ppl$ylen)/2`/HALIGN=0/SIZE=0.1/angle=90 "@AC($data_($idata)_units)" + + ENDIF ! nstations - LET colrx = id2d[m=1] - DEFINE SYMBOL cshp = `colrx,RETURN=shape` - - LET row1 = 1 - LET rowm = `($rowvar)[m=1]` - - REPEAT/RANGE=1:`nstations`/name=s (\ - DEFINE SYMBOL s = `s`;\ - LET rowm = `row1+($rowvar)[m=($s)]-1`;\ - DEFINE AXIS/T/UNITS=seconds/T0="`time.time_origin`" taxis = time[i=`row1`:`rowm`];\ - let row1 = `rowm+1`;\ - LET tempx = var2d_0[m=($s)];\ - LET colrx = id2d[m=($s)];\ - DEFINE SYMBOL ferret_title_`($s)-1` `($feature_variable)[m=($s)]`;\ - IF `tempx[($cshp)=@ngd] eq 0` then exit/cycle;\ - LET tt = t[gt=taxis];\ - LET have_dat = 1;\ - LET var_t = reshape(tempx, tt);\ - LET colort = reshape(colrx, tt) - 0.1;\ - let delt = tbox[gt=taxis];\ - let maskvar = delt[L=@ave]*1.1;\ - let gap_mask = if delt LE `maskvar` then 1;\ - IF `($rowvar)[m=($s)] GT 1` THEN PLOT/OVER/NOLAB/THICK=1/RIBBON($qualifiers) gap_mask*var_t,colort;\ - ) - - IF ($units_0"0|units>0|none>0|NONE>0|*>1") THEN LABEL/NOUSER `-0.6`, `($ppl$ylen)/2`, 0, 90, 0.12, @AC($units_0) - - IF `nstations LE max_labeled_stations` THEN\ - GO LAS_lineplot_legend `nstations` ($ferret_palette) - -! Setting up for the map-scale file to get the right info for time zooming - SET VAR/NAME=var_t0 var_t - - LET tt0 = tt[L=1] - LET ttn = tt[L=@max] - LET var_t = IF tt EQ tt0 OR tt EQ ttn THEN var_t0 - SET VIEW full_viewr - PLOT/NOAX/NOLAB/SYM=dot/RIBBON/PALETTE=white var_t, var_t - let vart = var_t0 - - ENDIF ! allbad - ENDIF ! nstations LE max_separate_stations - -ENDIF ! IF `nstations EQ 1` ELSE ... - -! for the results script -DEFINE SYMBOL ferret_plot_var = vart +ENDIF ! Add labels at the top for the location of overlaid lines ! and for URLs if they exist @@ -556,6 +410,7 @@ DEFINE SYMBOL ferret_plot_var = vart GO labels_above_plot ! Add timeseries information on the top + GO feature_labels ! if constraints are shown via constraint_0_lhs etc, define labels for those @@ -567,6 +422,7 @@ GO set_constraint_labels DEFINE SYMBOL data_0_var = tt_all DEFINE SYMBOL result_type = tline + GO LAS_results ($result_type) ! End of file ------------ Timeseries_station_plot.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl index 473926814..1683ac233 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl @@ -9,10 +9,6 @@ ! leave a thin dotted line at the original density ! add to the title, "from data sampled every xxx" ! 12/2013 ACM Always draw with ribbon plot style -! -! 8/2016 *acm* If the Ferret property traj_discrete has been set, check -! whether the distance between points is large; if so plot as discrete -! points connected with a thin line. IF `($ferret_memory"25.6") LT 200` THEN SET MEM/SIZ=200 @@ -25,25 +21,13 @@ GO LAS_initial_setup ! Initialize the region and data. -DEFINE SYMBOL data_initialization_script = Trajectory_initialize_data_insitu DEFINE SYMBOL data_initialization_script = feature_initialize_data_insitu -! DEFINE SYMBOL ferret_label = 0 - SET MODE verify:always ! allows for debugging -DEFINE SYMBOL its_insitu = 1 DEFINE SYMBOL its_trajectory_map = 1 GO LAS_initialize_region 0 -IF ($data_0_var"0|vid>1|*>0") THEN - DEFINE SYMBOL ferret_by_id = 1 - USE "($data_0_url)" - LET varnames = ..varnames - - DEFINE SYMBOL data_0_var = `varnames[i=1]` - CANCEL DATA "($data_0_url)" -ENDIF DEFINE SYMBOL data_name_in = ($data_0_var) GO LAS_initialize_data 0 @@ -58,26 +42,13 @@ ENDIF ! Set the URL label for the first dataset. GO LAS_url_label 0 -! For the annotations -IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `($data_var)[i=@NGD]` -IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `($data_var)[i=@NBD]` - IF `STRINDEX("($ferret_view"0")", "x") EQ 0` THEN MESSAGE/ERROR **ERROR Expecting a view in xy or xyt EXIT/PROGRAM ENDIF -LET/UNITS=degrees_east x_var_data = ($data_x_var) -IF `($nodata"0|*>1") EQ 0` THEN - STAT x_var_data -ELSE - DEFINE SYMBOL stat_min ($region_x_lo) -ENDIF - -IF ($data_y_var"0|*>1") THEN LET/UNITS=degrees_north y_var_data = ($data_y_var) -IF ($data_z_var"0|*>1") THEN LET z_var_data = ($data_z_var) -IF ($data_t_var"0|*>1") THEN LET t_var_data = ($data_t_var) +DEFINE SYMBOL stat_min ($region_x_lo) LET var_data = ($data_var) DEFINE SYMBOL var_data = ($data_var)[i=1,m=1] @@ -86,11 +57,20 @@ LET gettype= ($var_data) DEFINE SYMBOL vtype = `gettype,RETURN=dtype` DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") -IF `($is_string) AND ($ferret_strfloat"0|*>1")` THEN - SET VAR/NAME = var_data_0 var_data - LET var_data = STRFLOAT(var_data_0) - SET ATT/LIKE=var_data_0 var_data - DEFINE SYMBOL ferret_plot_var var_data +! For the annotations +IF ($is_string"0|*>1") THEN + sh sym data*var ! ngood is number of x,y locations? + stat ($data_x_var) + IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) + IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) + LET datmin = 1 + LET datmax = ($nfeatures) +ELSE + stat ($data_var) + IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) + IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) + LET datmin = ($stat_min) + LET datmax = ($stat_max) ENDIF ! Special color-by-time key @@ -99,39 +79,27 @@ IF ($ferret_plot_key"0|date_key>1|*>0") THEN ! In this case we set up a time axis, and label the color key with dates ! If the units are seconds since, we don't need that much resolution for this. Make it hours. - LET tmin = ($data_var)[i=@MIN] - LET tmax = ($data_var)[i=@MAX] - - LET since_loc = STRINDEX("`($data_t_var).units`","since") - 2 - IF `since_loc GT 1` THEN - LET tunits = SUBSTRING("`($data_t_var).units`",1,`since_loc`) - DEFINE SYMBOL tunits = `tunits` - ENDIF - DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($data_t_var).time_origin`"/units=($tunits) time_axis - IF ($tunits"0|seconds>1|*>0") THEN \ - DEFINE AXIS/T=`tmin`:`tmax`:3600/T0="`($data_t_var).time_origin`"/units=($tunits) time_axis DEFINE SYMBOL datekey = 1 - DEFINE SYMBOL ferret_key_annotate = 0 - LET ttvar = t[gt=time_axis] - DEFINE SYMBOL datekey_time_arg = ttvar - IF `($ferret_plot_levels"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_plot_levels = 50 IF `($ferret_fill_levels"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_fill_levels = ($ferret_plot_levels) + GO define_dsg_taxis + ENDIF -IF ($ferret_by_id"0|*>1") THEN - DEFINE SYMBOL ferret_plot_levels = `($rowvar),RETURN=lsize` - LET id_data = COMPRESSI(XSEQUENCE(TRANSPOSE_XZ(id_by_c))) - LET var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL var_data = id_data[i=1:`($data_x_var),RETURN=isize`] +IF `($ferret_by_id"0|*>1") OR color_by_feature EQ 1` THEN + DEFINE SYMBOL var_data = ($feature_variable) + LET var_data = ($feature_variable) DEFINE SYMBOL ferret_plot_title Colored by Trajectory Number -ENDIF + CANCEL SYMBOL ferret_fill_levels + IF ($is_string"0") THEN DEFINE SYMBOL ferret_fill_levels = (1,($nfeatures),1) + IF `($ferret_palette"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_palette = ten_by_levels + DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=center -! Set color levels -GO LAS_initialize_var_levels + DEFINE SYMBOL ferret_key_annotate = 0 +ENDIF ! Color key for the variable values. ! If there is no plot variable defined (only plotting locations), @@ -199,24 +167,13 @@ ELSE KEYMARK 0 ENDIF -! Define plot qualifiers for polygon overlay +! Define plot qualifiers for trajectory overlay -!CANCEL SYMBOL qualifiers DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/NOLAB - ! Get info for deciding on line thickness GO feature_labels -! Ribbon plot -DEFINE SYMBOL plot_command = PLOT/VS/RIBBON/LINE/FAST -IF ($thinline"0|*>1") THEN - DEFINE SYMBOL plot_command = PLOT/VS/RIBBON - DEFINE SYMBOL thinline_plot_vars = x_var_data, y_var_data -ENDIF - -!DEFINE SYMBOL plot_command = PLOT/VS/RIBBON/SYM=dot - IF `($drawthick"0|*>1") EQ 0` THEN DEFINE SYMBOL drawthick = 1 DEFINE SYMBOL drawthick = 2 @@ -224,14 +181,14 @@ IF `($drawthick"0|*>1") EQ 0` THEN IF ($decimation_fraction"0|*>1") THEN DEFINE SYMBOL drawthick = 2 ELSE - IF `featuresize LT 20` THEN DEFINE SYMBOL drawthick = 3 + IF `nfeatures LT 20` THEN DEFINE SYMBOL drawthick = 3 ENDIF ! If there's not a lot of data on the map and the region is pretty small, -! IF `featuresize LT 20 AND (($basemap_area"0") LT 0.2)` THEN DEFINE SYMBOL drawthick = 3 +! IF `nfeatures LT 20 AND (($basemap_area"0") LT 0.2)` THEN DEFINE SYMBOL drawthick = 3 ! Try this first, few cruises --> thick - IF `featuresize LT 20` THEN DEFINE SYMBOL drawthick = 3 + IF `nfeatures LT 20` THEN DEFINE SYMBOL drawthick = 3 ENDIF IF `($drawthick"0|1|2|3|*>0") GT 1` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=($drawthick) @@ -239,16 +196,16 @@ IF `($drawthick"0|1|2|3|*>0") GT 1` THEN DEFINE SYMBOL qualifiers = ($qualifiers ! Is this a single mooring where all the location data is at a single location? If so make a colored symbol -LET lonattnames = ($data_x_var_in).attnames -LET latattnames = ($data_y_var_in).attnames +LET lonattnames = ($dsg_x_var).attnames +LET latattnames = ($dsg_y_var).attnames IF `IS_ELEMENT_OF_STR(lonattnames, "actual_range") GT 0 AND \ IS_ELEMENT_OF_STR(lonattnames, "actual_range") GT 0` THEN - LET lvar = ($data_x_var_in).actual_range + LET lvar = ($dsg_x_var).actual_range LET lonmin `lvar[i=@min],PREC=9` LET lonmax `lvar[i=@max],PREC=9` - LET lvar = ($data_y_var_in).actual_range + LET lvar = ($dsg_y_var).actual_range LET latmax `lvar[i=@max],PREC=9` LET latmin `lvar[i=@min],PREC=9` @@ -263,7 +220,7 @@ IF ($single_color"0|*>1") THEN ENDIF ! When there are just a few points (missing or valid), draw a colored symbol as well as the ribbon line. -IF `npts LE 30` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/SYM=17 +!IF `($numobs) LE 30` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/SYM=17 ! Points will mark location of missing data if needed ! Use color=1 for black... @@ -285,120 +242,40 @@ SAY _________________ Start line plot: clock seconds: LET pre_plot = ($clock_secs) ! Draw the ribbon plot -! With Ferret v6.95 and higher, and if there is a gap_var variable, -! use the PLOT/VS/GAPLOC qualifier to pick up the pen, e.g. when -! the sample number is not sequential, indicating a gap due to -! region or constraints. See setup_dsg_variables.jnl IF ($single_color"0|*>1") THEN - DEFINE SYMBOL plot_plot_vars = x_var_data, y_var_data - ($plot_command)($qualifiers) ($plot_plot_vars) + PLOT($qualifiers) 1+0* ($ferret_plot_var) ELSE ! or /missing=blank or leave off for gray... - DEFINE SYMBOL plot_plot_vars = x_var_data, y_var_data, var_data - - IF `($ferret_version) GE 6.95 AND ($have_gap_var"0|*>1)` THEN - DEFINE SYMBOL plot_command = ($plot_command)/GAPLOC=sample_number - DEFINE SYMBOL plot_plot_vars = x_var_data, y_var_data, var_data, gap_var - ENDIF - - IF ($is_mooring"0|*>1") THEN !? - ($plot_command)($qualifiers)/missing=black/SET ($plot_plot_vars) - ELSE - IF ($thinline"0|*>1") THEN PLOT/VS/LINE/OVER/NOLAB/COLOR=black ($thinline_plot_vars) - ($plot_command)($qualifiers)/MISSING=black/SET ($plot_plot_vars) - ENDIF - - IF ($ferret_annotations%0|*>1%) THEN GO key_at_top + PLOT($qualifiers)/MISSING=black/SET ($ferret_plot_var) + GO key_at_top PPL RIBBON/OVER ENDIF + ! Hack: histogram levels IF `STRINDEX("($ferret_fill_levels)", "H") GT 0 OR STRINDEX("($ferret_fill_levels)", "h") GT 0` THEN \ -($plot_command)($qualifiers)/missing=black/nokey x_var_data, y_var_data, var_data +PLOT($qualifiers)/missing=black/nokey var_data SAY _________________ END line plot: clock seconds: ($clock_secs) SAY _________________ total time for line plot, seconds ----- `($clock_secs) - pre_plot` +! For the results script, IF ($ferret_plot_var"0|*>1") THEN - LET data_range = minmax(var_data) - DEFINE SYMBOL data_plotted_min = `data_range[i=1],prec=7` - DEFINE SYMBOL data_plotted_max = `data_range[i=2],prec=7` + DEFINE SYMBOL data_plotted_min = `datmin,prec=7` + DEFINE SYMBOL data_plotted_max = `datmax,prec=7` ENDIF -! Set the shape to what is used above it will be the same on the key -DEFINE SYMBOL ferret_poly_shape = ($ferret_poly_shape%square|delta|triangle|diamond|pentagon|hexagon|circle|star|plus|ex|*>square%) - -! Add labels; unless all labels have been turned off - -IF `($ferret_label"1|0|1|*>1") EQ 1` THEN - - ! Add the plot title on the bottom - ! Nudge things down a little for 'yt and 'zt views because the time axis - ! has years labeled beneath the months. - - IF `($ferret_annotations"0|*>1") EQ 0` THEN - IF ($ferret_view"0|yt>1|zt>1|*>0") THEN - LABEL/NOUSER `($ppl$xlen)/2`, `-0.6*($ppl$yorg)`, 0, 0, 0.14, @AC($ferret_plot_title) - ELSE - LABEL/NOUSER `($ppl$xlen)/2`, `-0.5*($ppl$yorg)`, 0, 0, 0.14, @AC($ferret_plot_title) - ENDIF - ENDIF - - IF ($t_lab_lo"0|*>1") THEN - DEFINE SYMBOL n_left_labels `($n_left_labels"0") + 1` - DEFINE SYMBOL upper_left_($n_left_labels) ($t_lab_lo) - IF ($t_lab_hi"0|*>1") THEN DEFINE SYMBOL upper_left_($n_left_labels) ($t_lab_lo) to ($t_lab_hi) - DEFINE SYMBOL time_lab ($upper_left_($n_left_labels)) - ENDIF - -ENDIF ! ferret_label - ! Add labels at the top for the dataset name etc if they exist GO labels_above_plot -! Add any constraint labels in the lower left, or as annotation notes. -! (The constraints themselves are handled in the data request from ERDDAP. -! We do not need masking for constraints in map plots.) - -IF `($ferret_annotations%0|*>1%)` THEN - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - DEFINE SYMBOL note_num = `($note_num"0") + 1`; \ - DEFINE SYMBOL note_($note_num)_lab = ($mask_title_($mmask)); \ - ENDIF) -ELSE - - IF `$nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - DEFINE SYMBOL label_x = `-0.95*($ppl$xorg)` - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - LABEL/NOUSER `($label_x)`, `($label_y)`, -1, 0, 0.12, ($mask_title_($mmask)) ; \ - DEFINE SYMBOL label_y = `($label_y) - 0.2`; \ - ENDIF) -ENDIF - ! if constraints are shown via constraint_0_lhs etc, define labels for those GO set_constraint_labels -! restore key-annotation setting: keys not annotated -KEYMARK 0 - - -! Draw extra points, e.g. moorings as dots. Do this after -! annotations have been set up; if constraints are on platforms -! the markings will be more prominent. +! Draw extra points, e.g. moorings as dots. Do this last so these +! marks will be on top of everything else. IF ($custom_dataset"0|*>1") THEN IF `($ferret_is_($custom_dataset)"0|*>1") AND ($custom_post_trajectory"0|*>1")` THEN \ diff --git a/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl b/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl index 00d4d7106..424c370e9 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl @@ -17,11 +17,10 @@ GO LAS_initial_setup 0 -DEFINE SYMBOL frmt width=1024/norow +DEFINE SYMBOL frmt width=1024 ! /norow? IF ($ferret_data_format"0|csv>1|tsv>1|asc>1|*>0") THEN DEFINE SYMBOL frmt = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") - ENDIF CANCEL MODE INTERPOLATE ! important when evaluating the size limits @@ -30,3 +29,5 @@ SET LIST/FILE="($result_ferret_listing_filename)" GO list_traj_data + +! End of file ------------ Trajectory_Data_Convert_File.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/Trajectory_corr_File.jnl b/JavaSource/resources/ferret/scripts/Trajectory_corr_File.jnl index a33af269a..91930389f 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_corr_File.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_corr_File.jnl @@ -1,23 +1,12 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! Trajectory_correlation.jnl +! Trajectory_corr_File.jnl ! ! Author: Ansley Manke ! Date: 8/2011 -! Trajectory_correlation.jnl initializes data from a trajectory- -! request from a database and creates a property-property plot. The -! data variables com in from symbols database_access_0* and -! database_access_1*, optionally colored by the values in database_access_2. -! -! Once the variables are initialized call the prop-prop -! plot script from the LAS scripts. - -! The scatter plot is drawn using polygons, with options sent in for -! symbol_color, symbol_shape, and symbol_size. - -! NOTE If the two variables are going to have DIFFERENT region settings, -! changes will need to be made to annotate that info on the plot. - +! Trajectory_corr_File.jnl initializes data from a trajectory- +! request from ERDDAP and makes a listing. +! ! Set up to write info to the debug log so that FshowGO can be used GO LAS_initial_setup 0 @@ -33,5 +22,5 @@ ENDIF DEFINE SYMBOL its_trajectory_corr = 1 GO list_prop_prop -! ----- End of Trajectory_correlation.jnl ------------------------------------------------ +! ----- End of Trajectory_corr_File.jnl ------------------------------------------------ diff --git a/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl b/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl index f8be2515e..1057f5a73 100644 --- a/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl +++ b/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl @@ -1,110 +1,54 @@ ! DSG_find_roles.jnl -! Find the Profile or Trajectory dimension and get its size -! Find the Obs dimension and get its size -! 4/3/2017 *acm* Additions for point data types -! 4/3/2017 *acm* Handle datasets where dimensions are not also coordinate variables -! 11/2018 *acm* Handle datasets where feature-variable is a coordinate variable with numeric feature ids +! Find the feature-id variable +! Identify the direction variables (lon/lat needed in trajectory-plot script). +! +! 2/2019 redo for DSG-enabled Ferret LET var_attnames = ($vname).attnames - IF `IS_ELEMENT_OF_STR(var_attnames, "cf_role")` THEN - LET featureSize = `($vname),RETURN=msize` DEFINE SYMBOL feature_variable = ($vname) ENDIF IF `IS_ELEMENT_OF_STR(var_attnames, "sample_dimension")` THEN - DEFINE SYMBOL obsdim = `($vname).sample_dimension` - LET obsXvar = x[gx=($obsdim)] - LET obsSize = `obsXvar,RETURN=isize` DEFINE SYMBOL rowvar = ($vname) -ENDIF - -! The cf_role attribute might be on a coordinate variable. -! If so, set up index as the feature id. LAS expects a -! the feature variable to be a string. -! We probably want to concoct names based on the location and time. -! Write a function to return the list for best flexibility. - - -! Use ..coordnames for coordinate-variable namesinstead of ..dimnames. -! Some files have dimensions that are not coordinate variables. - - -IF `($feature_variable"0|*>1")` THEN - LET feature_name = ($feature_variable) - LET cnames = ..coordnames - - IF `STRINDEX("($feature_variable)", "(") GT 0` THEN - DEF SYM dname = `cnames[i=($q)]` - -! are the feature-id's numeric"? and not just 1,2,3...? -! If so make them become the id string. - - let ee_var = _e[ge=($dname)] + 1 - let ee_siz = `ee_var,return=msize` - IF `ee_var[m=@max] NE ee_siz` THEN - LET nlen = INT(1+LOG(ee_var[m=@max])) -! LET/d=($dsetnum"1") feature_name = FLOATSTR(ee_var, "(i`nlen`)") - LET/title="($dname)" feature_name = FLOATSTR(ee_var, "(i`nlen`)") - -! otherwise concoct id's based on the location/ time - ELSE - - IF `($data_lon_var"0|*>1") + ($data_lat_var"0|*>1") + ($data_time_var"0|*>1") LT 3` THEN - MESSAGE/ERROR **ERROR Did not find longitude, latitude and time variables in the dataset - EXIT/PROGRAM - ENDIF - - LET tmax = ($data_time_var)[x=@MAX,m=@MAX] - LET tmin = ($data_time_var)[x=@MIN,m=@MIN] - LET since_loc = STRINDEX("`($data_time_var).units`","since") - 2 - IF `since_loc GT 1` THEN - LET tunits = SUBSTRING("`($data_time_var).units`",1,`since_loc`) - DEFINE SYMBOL tunits = `tunits` - ENDIF - DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($data_time_var).time_origin`"/units=($tunits) taxis_for_name - - let tt_for_name = t[gt=taxis_for_name,L=1] - -! are lon,lat,time on the obs axis? If so make labels with the first location and time -! of each trajectory - LET nx = `($data_lat_var),RETURN=isize` - LET nm = `($data_lat_var),RETURN=msize` - IF `nx GT nm` THEN - LET nr = `($rowvar),RETURN=msize` - LET end_of_traj = xsequence(($rowvar)[m=@rsum]) - LET start_of_traj = XCAT(1,end_of_traj+1) - LET lonsample = SAMPLEI (($data_lon_var), start_of_traj) - LET lonsample360 = IF lonsample GE 0 THEN lonsample ELSE lonsample+360 - LET latsample = SAMPLEI (($data_lat_var), start_of_traj) - LET timsample = SAMPLEI (($data_time_var), start_of_traj) - - LET xlon_for_name = lonsample360[i=1:`nr`] - LET xlat_for_name = latsample[i=1:`nr`] - LET xtim_for_name = timsample[i=1:`nr`] - ELSE - LET xlon_for_name = XSEQUENCE(IF ($data_lon_var) GE 0 THEN ($data_lon_var) ELSE ($data_lon_var)+360 ) - LET xlat_for_name = XSEQUENCE(($data_lat_var)) - LET xtim_for_name = XSEQUENCE(($data_time_var)) - ENDIF - - LET/d=($dsetnum"1") feature_name = RESHAPE(LON_LAT_TIME_STRING(xlon_for_name, \ - xlat_for_name, xtim_for_name, tt_for_name, "($feature_type%A%)"), ($rowvar)) - DEFINE SYMBOL feature_name_list = 1 +ENDIF - ENDIF ! concoct id's +IF `IS_ELEMENT_OF_STR(var_attnames, "axis")` THEN + DEFINE SYMBOL adir = `($vname).axis` + IF ($adir"0|X>1|*>0") THEN + DEFINE SYMBOL data_x_var = ($vname) + DEFINE SYMBOL dsg_x_var = ($vname) + ENDIF + IF ($adir"0|Y>1|*>0") THEN + DEFINE SYMBOL data_y_var = ($vname) + DEFINE SYMBOL dsg_y_var = ($vname) + ENDIF + IF ($adir"0|Z>1|*>0") THEN + DEFINE SYMBOL data_z_var = ($vname) + DEFINE SYMBOL dsg_z_var = ($vname) + ENDIF + IF ($adir"0|T>1|*>0") THEN + DEFINE SYMBOL data_t_var = ($vname) + DEFINE SYMBOL dsg_t_var = ($vname) + ENDIF - DEFINE SYMBOL feature_variable = feature_name +ENDIF -! Is this one of the variables in the plot (color-by?) If so, redefine the symbol +! Put the name in quotes in case it's a pseudo-var such as K +LET getshape = '($vname)' +IF `STRINDEX("($vname)", "(") GT 0` THEN LET getshape = ($vname) - REPEAT/range=0:`($data_count)-1`/name=ic (\ - DEFINE SYMBOL ic = `ic`;\ - IF ($data_($ic)_var"0|($dname)>1|*>0") THEN \ - DEFINE SYMBOL data_($ic)_var = feature_name) +DEFINE SYMBOL shape = `getshape,RETURN=shape` +IF ($shape"0|E>0|POINT>0|*>1") THEN + DEFINE SYMBOL ishape = ($shape"|X>i|Y>j|Z>k|T>l|*>nothing") + IF ($ishape"nothing>1|*>0") THEN + MESSAGE/ERROR **ERROR analyzing Distributed Sampling Geometries dataset, grid of ($vname) + EXIT/PROGRAM ENDIF - + DEFINE SYMBOL numobs = `'($vname)',RETURN=($ishape)size` + DEFINE SYMBOL dsgshape_var = ($vname) ! a variable on the obs axis + DEFINE SYMBOL dsgshape = `'($vname)',RETURN=shape` ENDIF !---------------- end of DSG_find_roles.jnl ------------------------- diff --git a/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl b/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl index c3f8eef89..4c99d2da9 100644 --- a/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl +++ b/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl @@ -10,28 +10,22 @@ ! 10/2017 *acm* Set up color variable in a more consistent way ! 11/2017 *acm* Remove any quotes from around variable title and units ! 3/2018 *acm* If a feature-type plot has a color palette setting, set up to use it -! 7/2019 *acm* If running DSG-enabled Ferret, set the dataset to ignore DSG type -! for non-upgraded scripts -! 2/2020 Check for existence of global attributes before using global_attnames. +! 4/2019 Modernizing for DSG-enabled Ferret DEFINE SYMBOL num ($1"0") -! Non-DSG scripts, using a DSG-enabled Ferret -IF `($ferret_version"0") GE 7.6` THEN - USE /FEATURE=none ($data_0_url) -ELSE - USE ($data_0_url) -ENDIF - -! The dataset_id should be the ERDDAP dataset ID. Check that it's defined anf +! The dataset_id should be the ERDDAP dataset ID. Check that it's defined and ! if not set it to the dataset_name IF `($data_($num)_dataset_id"0|*>1") EQ 0` THEN DEFINE SYMBOL data_($num)_dataset_id = ($data_($num)_dataset_name) +IF ($fview"0|T>1|*>0") THEN DEFINE SYMBOL use_as = /feature=timeseries + ! The variable at the x and y locations IF ($data_($num)_var"0|1|*>1") THEN DEFINE SYMBOL data_var ($data_($num)_var) IF ($data_($num)_title"0|1|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title) + ! Remove any quotes surrounding data_title string GO LAS_unquote_string data_title @@ -42,14 +36,13 @@ IF `($data_count"0") GT 1` THEN ) ENDIF - IF ($data_($num)_name"0|1|*>1") THEN DEFINE SYMBOL data_name ($data_($num)_name) DEFINE SYMBOL ferret_plot_title ($data_title) IF ($data_($num)_units"0|1|text>0|none>0|*>1") THEN DEFINE SYMBOL data_units ($data_($num)_units) ! Remove any quotes surrounding data_title string - GO LAS_unquote_string data_unitss + GO LAS_unquote_string data_units ELSE CANCEL SYMBOL data_($num)_units ENDIF @@ -78,19 +71,8 @@ IF `($1"0") EQ 0` THEN IF ($data_($num)_units"0|1|*>1") THEN LET variable_lab = STRCAT(data_title, data_units) ENDIF -! SET DATA and check for errors -!!!! These are sometimes filled in with a tabledap address not the netCDF file. Keep it using data_0_url. -!!!! SET DATA "($data_($num)_url)" -!! -!!!! When running DSG-enabled Ferret/PyFerret, need the updated scripts to work with DSG files. -!!!! These scripts are NOT updated - -SET DATA "($data_0_url)" -IF `($ferret_version) GE 7.6` THEN - USE /FEATURE=none "($data_0_url)" -ELSE - USE "($data_0_url)" -ENDIF +! open the dataset and report errors +USE($use_as) "($data_($num)_url)" IF ($fer_last_error"0|*>1") THEN DEFINE SYMBOL error_status = ERROR @@ -99,33 +81,24 @@ IF ($fer_last_error"0|*>1") THEN EXIT/SCRIPT ENDIF -LET nglobal_atts = ..nattrs -LET global_attnames = ..attnames - - ! Get the dataset title -DEFINE SYMBOL dataset_title_att = dataset title -IF `nglobal_atts GT 0` THEN +LET global_attnames = ..attnames IF `IS_ELEMENT_OF_STR(global_attnames, "title") GT 0` THEN DEFINE SYMBOL dataset_title_att = `..title` ENDIF -ENDIF +DEFINE SYMBOL dset($num) = `($data_var),RETURN=dsetnum` -! Is there a custom palette? This may be reset in custom_dataset_definitions.jnl below -IF `($ferret_insitu_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_insitu_palette) -IF `($ferret_Point_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Point_palette) -IF `($ferret_Profile_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Profile_palette) -IF `($ferret_Timeseries_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Timeseries_palette) -IF `($ferret_TrajectoryProfile_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_TrajectoryProfile_palette) -IF `($ferret_Trajectory_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Trajectory_palette) +GO feature_initialize_plot_settings GO custom_dataset_definitions ! Did the request return the no-data flag? +LET global_attnames = ..attnames +LET nglobal_atts = ..nattrs IF `nglobal_atts GT 0` THEN IF `IS_ELEMENT_OF_STR(global_attnames, "query_result") GT 0` THEN DEFINE SYMBOL data_query_string = `..query_result` @@ -144,11 +117,12 @@ IF `nglobal_atts GT 0` THEN ENDIF ENDIF -DEFINE SYMBOL dsetnum = `($data_0_var),RETURN=dsetnum` +DEFINE SYMBOL dsetnum = `($data_($num)_var),RETURN=dsetnum` -! Is it a Profile or Trajectory dataset? +! Is it a Profile, Timeseries, or Trajectory dataset? GO LAS_setup_dsg + IF `($its_listing"0|*>1") AND ($num) EQ 0` THEN ! For ascii listings, if a variable is the same as the feature variable, @@ -164,199 +138,47 @@ IF `($its_listing"0|*>1") AND ($num) EQ 0` THEN ! Keep original variable names as symbols data_0_var_orig, ... ! Treat longitude and latitude the same. - GO LAS_rename_vars 0 DEFINE SYMBOL data_var ($data_($num)_var) ENDIF -IF ($feature_variable"0|*>1") THEN - IF `($have_feature_nums"0|*>1) EQ 0` THEN GO feature_initialize_vars -ENDIF -! The x and y locations for insitu plots -! Use the _CoordinateAxisType to define data_x_var, data_y_var, -! data_t_var if there is a time variable, data_z_var if there is depth. +! Define the feature mask -IF ($feature_type"0|point>1|*>0") THEN - LET rowvar = x[gx=($DATA_VAR)] - DEFINE SYMBOL rowvar = rowvar - CANCEL SYMBOL its_trajectory_map - DEFINE SYMBOL its_point_map = 1 -ENDIF +LET feature_mask = 1 + 0*rowsize -IF `($data_x_var"0|*>1") EQ 0` THEN GO feature_lon_lat_time_depth +IF `($have_feature_mask"0|*>1") EQ 0` THEN + DEFINE SYMBOL features_shown = `nfeatures` + LET subset_mask = 1 + 0*rowsize +ENDIF -DEFINE SYMBOL mark_end = ($data_var) +IF ($ferret_cruise_list"0|*>1") THEN GO feature_list_mask -! If the plot is colored by profile ID then fake that variable, and exit +! Is the plot colored by profile ID LET color_by_feature = 0 -LET color_by_index = 0 IF `(($num)+1) eq ($data_count)` THEN - IF `($data_($num)_var"0|vid>1|($feature_variable)>1|*>0") AND ($nodata"0|*>1) EQ 0` THEN - IF `($rowvar"0|*>1") EQ 0` THEN DEFINE SYMBOL rowvar = rowSize - LET color_by_feature = 1 - ENDIF + IF `($data_($num)_var"0|vid>1|($feature_variable)>1|*>0") AND \ + ($nodata"0|*>1) EQ 0` THEN LET color_by_feature = 1 ! Or, is this a DSG file with the feature_variable we have already identified? - IF `($data_($num)_var"0|($feature_variable)>1|*>0") AND ($rowvar"0|*>1")` THEN LET color_by_feature = 1 -ENDIF + IF ($data_($num)_var"0|($feature_variable)>1|*>0") THEN LET color_by_feature = 1 -! Make the RowSize and other metadata variables be on the E axis. -IF `($rowvar"0|*>1") AND ($feature_type"0|point>0|*>1")` THEN - DEFINE SYMBOL rdir = `($rowvar),RETURN=shape` - DEFINE SYMBOL rind = ($rdir"|X>I|E>M|POINT>M") - LET setnum = `($rowvar),RETURN=dsetnum` - IF ($rind"|I>1|*>0") THEN - LET esiz = `($rowvar),RETURN=isize` - DEFINE AXIS/E=1:`esiz`:1 `($rowvar),RETURN=xaxis`M - DEFINE SYMBOL eaxis = `($rowvar),RETURN=xaxis`M - DEFINE SYMBOL rind = M - LET varnames = ..varnames - - REPEAT/RANGE=1:`..nvars`/NAME=q\ - (DEFINE SYMBOL q = `q`;\ - DEFINE SYMBOL vname = `varnames[i=($q)]`;\ - DEFINE SYMBOl vshape = `($vname),RETURN=shape`;\ - LET vsiz = `($vname),RETURN=size`;\ - IF `($vshape"|X>1|*>0) and vsiz EQ esiz` THEN ;\ - SET VAR/NAME=($vname)_in ($vname);\ - LET/D=`setnum` ($vname) = RESHAPE(($vname)_in, _E[ge=($eaxis)]);\ - SET ATT/LIKE=($vname)_in ($vname);\ - ENDIF;\ - ) - ENDIF - LET longest = ($rowvar)[m=@max]+2 ENDIF ! Other variables on the E axis to be colored the same way. -IF `color_by_index EQ 1` THEN let color_by_feature = 1 - -IF `color_by_feature EQ 1` THEN - - IF `($ferret_version) GE 7.6` THEN - USE /FEATURE=none "($data_($num)_url)" - ELSE - USE "($data_($num)_url)" - ENDIF - - - DEFINE SYMBOL data_($num)_var = `varnames[i=1]` - DEFINE SYMBOL is_vid = 1 - DEFINE SYMBOL data_var_only ($data_($num)_var) - DEFINE SYMBOL data_num `($data_($num)_var),RETURN=dsetnum` - -! Create the profile variables and symbols - - GO LAS_initialize_feature_id - - DEFINE SYMBOL mark_end = ($data_var) - - IF ($its_prop_prop_plot"0|*>1") THEN - - DEFINE SYMBOL ferret_poly_levels = `($rowvar),RETURN=lsize` - LET id_data = COMPRESSI(XSEQUENCE(TRANSPOSE_XZ(id_by_c))) - IF ($its_listing"0|*>1") THEN - LET/TITLE="($data_($num)_var)" var_data = ($data_($num)_var) - DEFINE SYMBOL data_($num)_var = ($data_($num)_var) - DEFINE SYMBOL data_var = ($data_($num)_var) - DEFINE SYMBOL ferret_plot_var = ($data_($num)_var) - ELSE - LET/TITLE="($data_($num)_name%ID%)" var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL data_($num)_var = var_data - DEFINE SYMBOL data_var = var_data - DEFINE SYMBOL ferret_plot_var = var_data - ENDIF - - IF ($data_($num)_title"0|1|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title) - - IF ($data_($num)_name"0|1|*>1") THEN DEFINE SYMBOL data_name ($data_($num)_name) - - IF `($data_($num)_units%0|" ">0|text>0|none>0|*>1%) EQ 0` THEN CANCEL SYMBOL data_($num)_units - IF ($data_($num)_units"0|1|*>1") THEN DEFINE SYMBOL data_units ($data_($num)_units) - - DEFINE SYMBOL ferret_plot_title ($data_title) - IF ($data_($num)_units"0|1|*>1") THEN DEFINE SYMBOL ferret_plot_title ($data_title) ($data_($num)_units) - - DEFINE SYMBOL color_by_feature = 1 - - EXIT/SCRIPT ! dont need the rest of the setup for prop-prop plots - ENDIF ! its_prop_prop_plot - -ENDIF - ! Is it a varible on the E axis of a DSG file? IF ($its_trajectory_map"0|*>1") THEN -DEFINE SYMBOL vshape = `($data_var),RETURN=shape` -IF ($vshape"0|POINT>1|*>0") THEN - DEFINE SYMBOL eshape = `($data_var),return=eaxis` - IF ($eshape"0|NORMAL>0|*>1") THEN DEFINE SYMBOL vshape = E -ENDIF - -IF `($vshape"0|E>1|*>0) AND (STRCMP("($data_var)", "($feature_variable)") NE 0)` THEN - -! Is there a rowsize variable? - IF ($rowvar"0|*>1") THEN DEFINE SYMBOL rowvar = rowsize - -! Expand trajectory variable into obs axis - DEFINE SYMBOL vtype = 0 - LET gettype = ($data_var) - DEFINE SYMBOL vtype = `gettype,RETURN=dtype` - DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") - - IF ($is_string"0|0|*>1") THEN - LET/TITLE="($ferret_title_0)" data_var_expand = EXPND_BY_LEN_STR(($data_var), ($rowvar),`($rowvar)[m=@sum]`) - LET mark_end = xsequence(_m[gm=($data_var)]) - DEFINE SYMBOL mark_end = mark_end - DEFINE SYMBOL mark_end_m = 1 - ELSE - LET/TITLE="($ferret_title_0)" data_var_expand = EXPND_BY_LEN(($data_var), ($rowvar),`($rowvar)[m=@sum]`) - LET mark_end = ($data_var) - DEFINE SYMBOL mark_end = mark_end - DEFINE SYMBOL mark_end_m = 1 + DEFINE SYMBOL vshape = `($data_var),RETURN=shape` + IF ($vshape"0|POINT>1|*>0") THEN + DEFINE SYMBOL eshape = `($data_var),return=eaxis` + IF ($eshape"0|NORMAL>0|*>1") THEN DEFINE SYMBOL vshape = E ENDIF - DEFINE SYMBOL data_var = data_var_expand - - DEFINE SYMBOL numobs = `($data_var),return = isize` ENDIF -ENDIF - -IF `($its_prop_prop_plot"0|*>1") EQ 0 and ($its_trajectory_map"0|*>1")` THEN ! map plot, do decimation - -IF ($rowvar"0|*>1") THEN - -! DSG file. Do decimation if there are over num_decimate points. - - LET num_decimate = 200000 - - DEFINE SYMBOL data_x_is_lon = 1 - - LET full_range = 360*90 - LET max_range = ($region_x_range)* ($region_y_range) - LET max_range = MAX(($region_x_range), ($region_y_range)) - - DEFINE SYMBOL data_x_is_lon = 1 - LET tol1 = `(max_range/full_range)` - IF `tol1 LT 1.e-6` THEN LET tol1 = 1.e-6 - LET tol2 = `tol1` -! Tolerances 10% of the data range over the approx pixel width of a plot. - - LET tol1 = 0.1*($region_x_range)/200 - IF `tol1 LT 1.e-6` THEN LET tol1 = 1.e-6 - - LET tol2 = 0.1*($region_y_range)/200 - IF `tol2 LT 1.e-6` THEN LET tol2 = 1.e-6 - - GO setup_dsg_variables `num_decimate` `tol1` `tol2` ! variable tolerance computed in the decimate script - -ELSE - LET nout_lonlat = `var_data_masked[i=@ngd]` - DEFINE SYMBOL nout_lonlat = `nout_lonlat` -ENDIF -ENDIF ! map plot, do decimation +IF ($vshape"0|E>1|*>0") THEN LET color_by_feature = 1 LET data_num = `($data_($num)_var),RETURN=dsetnum` DEFINE SYMBOL data_num = `data_num` @@ -402,47 +224,11 @@ ENDIF DEFINE SYMBOL color_vnum = 0 IF `($its_prop_prop_plot"0") AND ($data_count) GT 2` THEN DEFINE SYMBOL color_vnum = 2 -IF `($data_($color_vnum)_var"0|time>1|*>0")` THEN +IF `($data_($color_vnum)_var"0|($data_t_var)>1|*>0")` THEN DEFINE SYMBOL ferret_plot_key = date_key SET VAR/TITLE="Time" ($data_var)[d=`data_num`] SET VAR/TITLE="Time" ($ferret_plot_var)[d=`data_num`] -! Also check for other Time variables, e.g. Cast Time -ELSE - LET attnames = ($data_($color_vnum)_var).attnames - IF `IS_ELEMENT_OF_STR_N(attnames, "units") GT 0 AND \ - IS_ELEMENT_OF_STR_N(attnames, "time_origin") GT 0` THEN - IF `STRINDEX(($data_($color_vnum)_var).units, "since") GT 0` THEN - DEFINE SYMBOL ferret_plot_key = date_key - SET VAR/TITLE="Time" ($data_var)[d=`data_num`] - SET VAR/TITLE="Time" ($ferret_plot_var)[d=`data_num`] - ENDIF - ENDIF -ENDIF - -! Mark whether there are color levels set on first entry. -! Compute automatic open-ended levels. - -IF `data_num EQ 1` THEN - IF ($ferret_fill_levels"0|*>1") THEN DEFINE SYMBOL input_fill_levels = 1 - IF ($ferret_poly_levels"0|*>1") THEN - DEFINE SYMBOL ferret_fill_levels ($ferret_poly_levels) - DEFINE SYMBOL input_fill_levels = 1 - ENDIF - - LET its_plot = `STRINDEX(UPCASE("($operation_ID)"), "PLOT") GT 0` - IF `STRLEN("($ferret_view)") EQ 2 AND its_plot GT 0` THEN - IF ($ferret_fill_levels"1|closed>0|*>1") THEN GO LAS_auto_levels - ENDIF - IF `STRLEN("($ferret_view)") EQ 2 AND STRINDEX("($operation_ID)", "poly") GT 0` THEN - IF ($ferret_fill_levels"1|closed>0|*>1") THEN GO LAS_auto_levels - ENDIF - IF ($ferret_fill_levels"0|closed>1|*>0") THEN CANCEL SYMBOL ferret_poly_levels - IF ($ferret_fill_levels"0|closed>1|*>0") THEN CANCEL SYMBOL input_fill_levels - IF ($ferret_fill_levels"0|closed>1|*>0") THEN CANCEL SYMBOL ferret_fill_levels - - IF `($ferret_poly_levels"0|*>1") EQ 0` THEN \ - IF ($ferret_fill_levels"0|*>1") THEN DEFINE SYMBOL ferret_poly_levels ($ferret_fill_levels) ENDIF ! Set color levels for the data variable. Default levels, or apply a setting @@ -458,44 +244,6 @@ IF `($ferret_plot_key"0|date_key>1|*>0") EQ 0` THEN GO LAS_initialize_var_levels ENDIF -! Apply the expression in ferret_expression. $ represents the variable. - -IF ($ferret_expression"0|*>1") THEN - LET ev = STRINDEX("($ferret_expression)", "$") - IF `ev EQ 0` THEN - DEFINE SYMBOL error_status = ERROR - DEFINE SYMBOL error_type = EXPRESSION - DEFINE SYMBOL error_string = The expression ($ferret_expression) must contain at least one $. - EXIT/SCRIPT - ENDIF - - LET en = STRLEN("($ferret_expression)") - LET e1 = ev - 1 - LET e2 = ev + 1 - IF `e1 GT 0` THEN DEFINE SYMBOL expr1 = `SUBSTRING("($ferret_expression)", 1, e1)` - IF `e2 LT en` THEN DEFINE SYMBOL expr2 = `SUBSTRING("($ferret_expression)", e2, en)` - - DEFINE SYMBOL ferret_plot_var ($expr1)($data_var)($expr2) - DEFINE SYMBOL ferret_plot_title ($expr1)($data_title)($expr2) - -! This works except if the expression has spaces around the $ characters. -! Otherwise Ferret seems to be looking for script arguments. - - LET esecond = STRINDEX("($expr2)", "$") - IF `esecond GT 0` THEN - - LET ev = STRINDEX("($expr2)", "$") - LET en = STRLEN("($expr2)") - LET e1 = ev - 1 - LET e2 = ev + 1 - IF `e1 GT 0` THEN DEFINE SYMBOL expr3 = `SUBSTRING("($expr2)", 1, e1)` - IF `e2 LT en` THEN DEFINE SYMBOL expr4 = `SUBSTRING("($expr2)", e2, en)` - - DEFINE SYMBOL ferret_plot_var ($expr1)($data_var)($expr3)($data_var)($expr4) - DEFINE SYMBOL ferret_plot_title ($expr1)($data_var)($expr3)($data_var)($expr4) - ENDIF -ENDIF - CANCEL VAR data_num IF ($nodata"0|*>1") THEN @@ -504,5 +252,3 @@ IF ($nodata"0|*>1") THEN ENDIF !---------------- end of feature_initialize_data_insitu.jnl ------------------------- - - diff --git a/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl b/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl index 02ce3c215..815acce71 100644 --- a/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl +++ b/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl @@ -69,7 +69,7 @@ ELSE LET feature_numbers = i[gx=xmask_axis] IF `($subset_mask"0|*>1") EQ 0` THEN LET feature_mask = 1 + 0*feature_numbers ! may redefine later -! Scramble the IDs if we are coloring by ID, scramble them so cruises nearby in the alphabet +! Scramble the IDs if we are coloring by ID, scramble them so features nearby in the alphabet ! more likely to get different colors. Create a 2D variable, reshape to it, then unravel ! that back out. diff --git a/JavaSource/resources/ferret/scripts/feature_key.jnl b/JavaSource/resources/ferret/scripts/feature_key.jnl index 0e4f7af3f..9b3bfe200 100644 --- a/JavaSource/resources/ferret/scripts/feature_key.jnl +++ b/JavaSource/resources/ferret/scripts/feature_key.jnl @@ -5,13 +5,12 @@ ! Make a list of the ID number and feature ID to go back ! for possible subsets of this set of features. -IF `($feature_max) LE ($feature_max_labels)` THEN +IF `nfeatures LE ($feature_max_labels)` THEN - IF `($ferret_feature_list_xml"0|*>1") EQ 0` THEN + GO dsg_feature_name + IF ($result_icon_webrowset_filename"0|*>1") THEN \ GO LAS_insitu_write_webrowset.jnl - ENDIF - ENDIF ! LAS creates the key from the webrowset diff --git a/JavaSource/resources/ferret/scripts/feature_labels.jnl b/JavaSource/resources/ferret/scripts/feature_labels.jnl index 1957bbc76..5e39920c8 100644 --- a/JavaSource/resources/ferret/scripts/feature_labels.jnl +++ b/JavaSource/resources/ferret/scripts/feature_labels.jnl @@ -6,16 +6,10 @@ ! and number of valid and missing points shown. ! On prop-prop plots, don't show missing. The count of missing-values in the ! data is not distinguishable from the missing data due to applying constraints. -! 4/3/2017 *acm* Additions for point data types -! 8/2017 *acm* Account for change to expndi_by_m_function -! 10/2017 *acm* Handle the ferret_plot_var if its string type - -! If all labeling turned off just exit. -IF `($ferret_label"1|0|1|*>1") EQ 0` THEN EXIT/SCRIPT ! If it is not a feature-type dataset, exit -IF `($feature_type"0|*>1") EQ 0` THEN EXIT/SCRIPT +IF `($feature_type"0|*>1") EQ 0` THEN EXIT/SCRIPT IF ($feature_type"0|point>1|*>0") THEN DEFINE SYMBOL note_num = `($note_num"0") + 1` @@ -23,64 +17,20 @@ IF ($feature_type"0|point>1|*>0") THEN DEFINE SYMBOL plusmissing = (($nbad_data) missing) IF ($nbad_data"0|0|*>1") THEN DEFINE SYMBOL note_($note_num)_lab = ($note_($note_num)_lab) ($plusmissing) EXIT/SCRIPT -ENDIf - -LET check_var = $1%XSEQUENCE(($ferret_plot_var))% -DEFINE SYMBOL vtype = `check_var,return=dtype` -IF ($vtype"0|char>1|*>0) THEN LET check_var = XSEQUENCE( ($ferret_plot_var_2"($data_x_var%1%)") ) - -! Fill with a known value to distinguish between input missing values -! and values missing because of the different length of trajectories or profiles. - -! Define variable prof_traj by trajectory or profile length -! Count number of good and missing values in each. - -LET datmax = check_var[I=@max] -IF `(MISSING(datmax,100) EQ 100) AND (MISSING(datmax,10) EQ 10)` THEN LET datmax = 0 - -IF `datmax LE 1` THEN - LET fillval = 100 -ELSE - LET fillval = `10^(INT(LOG(datmax))+1)` -ENDIF - -LET var_fill = MISSING(check_var,`fillval`) -LET var_fill_z = EXPNDI_BY_Z_COUNTS(var_fill, XSEQUENCE(($rowvar)),`longest`) - -LET var_flag_z = IF var_fill_z EQ `fillval` THEN 1 -LET nbad_in_prof_traj = var_flag_z[K=@NGD] -LET ngood_in_prof_traj = var_fill_z[K=@NGD] - var_flag_z[K=@NGD] - -LET trajectory_mask = 1 -IF ($text_mask_trajectory"0|*>1") THEN - LET trajectory_mask = XSEQUENCE(($text_mask_trajectory)) -ELSE - IF `IS_ELEMENT_OF_STR_N(varnames, "($feature_variable)") NE 0` THEN - LET trajectory_m = 1+0*_m[ge=($feature_variable)] - LET trajectory_mask = XSEQUENCE(trajectory_m) - ENDIF ENDIF -LET ngood_chosen_prof_traj = subset_mask* trajectory_mask* ngood_in_prof_traj -LET nbad_chosen_prof_traj = subset_mask* trajectory_mask* nbad_in_prof_traj +! ($ngood_data) and perhaps ($nbad_data) have already been computed. -! Just compute one of these, and subtract from the total in dataset -IF `($ngood_data"0|*>1") EQ 0` THEN - IF `($ferret_memory"25.6") LT 700` THEN SET MEM/SIZ=700 - LET allsize = `check_var,RETURN=isize` - DEFINE SYMBOL nbad_data = `nbad_chosen_prof_traj[i=@SUM]` - DEFINE SYMBOL ngood_data = `allsize - ($nbad_data)` -ENDIF - -LET allvars = ..varnames +IF `($prof_traj_shown"0|*>1") EQ 0` THEN DEFINE SYMBOL prof_traj_shown = ($nfeatures) -DEFINE SYMBOL maskdir = `feature_mask,return=shape` -IF ($maskdir"0|POINT>1|*>0") THEN - DEFINE SYMBOL prof_traj_shown = 1 -ELSE - IF ($prof_traj_shown"1|*>0") THEN DEFINE SYMBOL prof_traj_shown = `feature_mask[($maskdir)=@sum]` - DEFINE SYMBOL prof_traj_shown = ($prof_traj_shown"($prof_traj_max)") +IF `($have_feature_mask"0|*>1") EQ 0` THEN + DEFINE SYMBOL maskdir = `feature_mask,RETURN=shape` + IF ($maskdir"0|POINT>1|*>0") THEN + DEFINE SYMBOL prof_traj_shown = 1 + ELSE + IF `($prof_traj_shown) EQ ($nfeatures)` THEN DEFINE SYMBOL prof_traj_shown = `feature_mask[($maskdir)=@sum]` + ENDIF ENDIF ! c_s used to add plural s to a label if more than one trajectory or profile. @@ -119,90 +69,22 @@ ELSE DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s), ($ngood_data) points shown ENDIF -! Notation about the decimation (if data is pre-decimated) - -! Don't label the decimation counts. It's too inaccurate and confusing. -DEFINE SYMBOL nolabels_decimation_counts = 1 - -IF `($piecewise_decimation"0|*>1") AND ($ngood_data) GT 0` THEN -IF ($nolabels_decimation_counts"0|*>1") THEN ! make points-shown annotations or not - - DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s) shown - - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = Data subsampled for efficiency (explanation) -ELSE ! make points-shown annotations or not - - LET full_good = -9999 - - IF `(IS_ELEMENT_OF_STR_N(varnames, "nobs_full") EQ 0) OR\ - (IS_ELEMENT_OF_STR_N(varnames, "nobs_deci") EQ 0)` THEN - MESSAGE/ERROR **ERROR nobs_full and nobs_deci not in the netCDF file" - EXIT/PROGRAM - ENDIF - -! compute overall fraction for decimation of the cruises returned - LET frac_deci = `nobs_deci[m=@sum]/nobs_full[m=@sum]` - LET frac_deci_all = `nobs_deci[m=@sum]/nobs_full[m=@sum]` - - IF `frac_deci GT 1` THEN - LET frac_deci = 1 - - ELIF `frac_deci GT 0` THEN - LET full_good = ($ngood_data)/frac_deci - LET full_bad = ($nbad_data)/frac_deci - ENDIF - let full_all = `full_good` - -! Make the computation on a per-cruise basis, the count of good data -! in the cruise related to the decimation fraction for that cruise - - LET frac_deci = nobs_deci/nobs_full ! fraction for each feature - - LET maxrow = `($rowvar)[m=@max]` - DEFINE AXIS/x=1:`maxrow`:1 xrow - LET xvar = x[gx=xrow] - - LET ok = IF ($data_var_in) THEN 1 - LET ok2d = EXPNDI_BY_M_COUNTS(ok, ($rowvar), xvar) - LET ok_cruise = ok2d[x=@sum] - LET ok_cruise_full = IF frac_deci GT 0 THEN ok_cruise/frac_deci ELSE 0 - LET full_good = ok_cruise_full[m=@SUM] +IF ($first_feature_only"0|*>1") THEN + DEFINE SYMBOL prof_traj_shown = 1 + DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type), ID is ($first_feature_id) +ELSE - IF `full_good GT 1.e6` THEN - DEFINE SYMBOL approx_msg = `full_good/1.e6,prec=3` million - ELIF `full_good GT 1.e3` THEN - DEFINE SYMBOL approx_msg = `full_good/1.e3,prec=2` thousand - ELSE - DEFINE SYMBOL approx_msg = `full_good,prec=3` - ENDIF - IF `($nbad_data"0|*") GT 0` THEN - LET full_bad = full_good * ($nbad_data)/($ngood_data) - IF `full_bad GT 1.e6` THEN - DEFINE SYMBOL approx_bad = `full_bad/1.e6,prec=2` million - ELIF `full_bad GT 1.e3` THEN - DEFINE SYMBOL approx_bad = `full_bad/1.e3,prec=2` thousand - ELSE - DEFINE SYMBOL approx_bad = `full_bad,prec=2` - ENDIF - ENDIF +! Notation about the decimation (if data is pre-decimated) + DEFINE SYMBOL nolabels_decimation_counts = 1 - DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s), approx. ($approx_msg) valid obs - IF ($approx_bad"0|*>1") THEN \ - DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s), approx. ($approx_msg) valid obs plus ($approx_bad) missing + IF `($piecewise_decimation"0|*>1") AND ($ngood_data) GT 0` THEN GO decimation_labels -! Put a link to the doc containing description of the decimation scheme. - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = Subsample of ($ngood_data) valid points shown (explanation) - IF `($nbad_data"0") GT 0` THEN \ - DEFINE SYMBOL note_($note_num)_lab = Subsample of ($ngood_data) valid and ($nbad_data) missing \ -points shown (explanation) - -ENDIF ! make points-shown annotations or not -ENDIF +ENDIF! first_feature_only !---------------- end of feature_labels.jnl ------------------------- + +pause diff --git a/JavaSource/resources/ferret/scripts/feature_list_mask.jnl b/JavaSource/resources/ferret/scripts/feature_list_mask.jnl index 560dde4f8..4fadec5e3 100644 --- a/JavaSource/resources/ferret/scripts/feature_list_mask.jnl +++ b/JavaSource/resources/ferret/scripts/feature_list_mask.jnl @@ -1,84 +1,77 @@ ! feature_list_mask.jnl ! If a cruise list (trajectory list, profile list) ! is defined, set up the mask. +! +! Format the cruise list and define the mask. Do this just once. +IF `($have_feature_mask"0|*>1") EQ 1` THEN EXIT/SCRIPT +IF `($ferret_cruise_list"0|*>1") EQ 0` THEN EXIT/SCRIPT -! Format the cruise list and define the mask. Do this just once - -! Once the all_subset is defined then the list mask is all set. +! For character feature-id variable need to convert the +! list of ids to a list of quoted strings. -IF `($ferret_cruise_list"0|*>1") EQ 0` THEN - LET feature_mask_obs = 1 - DEFINE SYMBOL have_feature_mask = {1} - EXIT/SCRIPT -ENDIF - -IF `($all_subset"0|*>1")` THEN EXIT/SCRIPT +DEFINE SYMBOL vtype = `($feature_variable),RETURN=dtype` +IF ($vtype"0|CHAR>1|*>0") THEN -IF `($subset_mask"0|*>1")` THEN EXIT/SCRIPT + LET all_len = STRLEN("($ferret_cruise_list)") + LET subset_len = `all_len` -LET all_len = STRLEN("($ferret_cruise_list)") -LET subset_len = `all_len` + ! Initialize, first id in symbol all_subset -! Initialize, first cruise id in symbol all_subset + DEFINE SYMBOL subset_list = ($ferret_cruise_list) + LET s1 = 1 + LET s2 = `STRINDEX("($subset_list)", ",")` + IF `s2 EQ 0` THEN LET s2 = subset_len+1 + DEFINE SYMBOL one_cruise = "`SUBSTRING("($subset_list)", 1,s2-1)`" + DEFINE SYMBOl all_subset = ($one_cruise) + DEFINE SYMBOL subset_list= ($all_subset) -DEFINE SYMBOL subset_list = ($ferret_cruise_list) -LET s1 = 1 -LET s2 = `STRINDEX("($subset_list)", ",")` -IF `s2 EQ 0` THEN LET s2 = subset_len+1 -DEFINE SYMBOL one_cruise = "`SUBSTRING("($subset_list)", 1,s2-1)`" -DEFINE SYMBOl all_subset = ($one_cruise) -DEFINE SYMBOL subset_list= ($all_subset) - -IF `s2 NE 0` THEN - LET s1 = `s1+s2` - IF `s1 LT all_len` THEN - DEFINE SYMBOL subset_list= `SUBSTRING("($ferret_cruise_list)",s1,subset_len-s2)` - LET subset_len = STRLEN("($subset_list)") + IF `s2 NE 0` THEN + LET s1 = `s1+s2` + IF `s1 LT all_len` THEN + DEFINE SYMBOL subset_list= `SUBSTRING("($ferret_cruise_list)",s1,subset_len-s2)` + LET subset_len = STRLEN("($subset_list)") + ENDIF ENDIF -ENDIF ! If more in the list, add them. -IF `(s2 NE 0) AND (s1 LT all_len)` THEN - REPEAT/RANGE=1:200 ( ;\ - LET s2 = `STRINDEX("($subset_list)", ",")`;\ - IF `s2 EQ 0` THEN LET s2 = subset_len+1;\ - DEFINE SYMBOL one_cruise = "`SUBSTRING("($subset_list)", 1,s2-1)`";\ - DEFINE SYMBOl all_subset = ($all_subset),($one_cruise);\ - IF `s2 EQ 0` THEN EXIT/LOOP;\ - LET s1 = `s1+s2`;\ - IF `s1 GE all_len` THEN EXIT/LOOP;\ - DEFINE SYMBOL subset_list= `SUBSTRING("($ferret_cruise_list)",s1,subset_len-s2)`;\ - LET subset_len = STRLEN("($subset_list)");\ - ) -ENDIF + IF `(s2 NE 0) AND (s1 LT all_len)` THEN + REPEAT/RANGE=1:200 ( ;\ + LET s2 = `STRINDEX("($subset_list)", ",")`;\ + IF `s2 EQ 0` THEN LET s2 = subset_len+1;\ + DEFINE SYMBOL one_cruise = "`SUBSTRING("($subset_list)", 1,s2-1)`";\ + DEFINE SYMBOl all_subset = ($all_subset),($one_cruise);\ + IF `s2 EQ 0` THEN EXIT/LOOP;\ + LET s1 = `s1+s2`;\ + IF `s1 GE all_len` THEN EXIT/LOOP;\ + DEFINE SYMBOL subset_list= `SUBSTRING("($ferret_cruise_list)",s1,subset_len-s2)`;\ + LET subset_len = STRLEN("($subset_list)");\ + ) + ENDIF -LET subset_ids = {($all_subset)} + LET subset_ids = {($all_subset)} -! Define a mask to use on the entire list of values: plot or not to plot -! the polygons on the prop-prop plot. + ! Define the mask variable + LET subset_mask = ELEMENT_INDEX_STR ( ($feature_variable), subset_ids ) -IF `IS_ELEMENT_OF_STR_N(varnames, "($feature_variable)") NE 0` THEN - LET subm_ids = IF ELEMENT_INDEX_STR_N(($feature_variable), subset_ids) GT 0 THEN 1 +ELSE ! numeric variable -! maybe the feature_variable is a dimension so the scripts have defined the -! feature_variable instead of it being in the file. + list ($feature_variable) + say ($ferret_cruise_list) - IF `($feature_variable),RETURN=isready` THEN \ - LET subm_ids = IF ELEMENT_INDEX_STR_N(($feature_variable), subset_ids) GT 0 THEN 1 + LET subset_mask = if element_index ( ($feature_variable), {($ferret_cruise_list)}) then 1 -! apply mask as data_var_c* subset_mask - LET subset_mask = XSEQUENCE(subm_ids) + 0*i[gx=xmask_axis] ! put it on a non-abstract axis -ELSE - LET n_subset = `($rowvar),RETURN=msize` - LET subset_mask = 1 + 0*i[i=1:`n_subset`] ENDIF -DEFINE SYMBOL features_shown = `subset_mask[i=@sum]` -DEFINE SYMBOL subset_mask = 1 ! mask is defined +! Apply the mask at the dataset level + +SET DATA/FMASK=subset_mask ($dsetnum) + +DEFINE SYMBOL features_shown = `subset_mask[e=@sum]` +DEFINE SYMBOL subset_mask = 1 ! mask is defined LET feature_mask = subset_mask ! used in the key when color-by-cruise -LET feature_mask_obs = EXPND_BY_LEN(feature_mask,($rowvar),`($rowvar)[m=@sum]`) DEFINE SYMBOL have_feature_mask = 1 !---------------- end of feature_list_mask.jnl ------------------------- diff --git a/JavaSource/resources/ferret/scripts/feature_lon_lat_time_depth.jnl b/JavaSource/resources/ferret/scripts/feature_lon_lat_time_depth.jnl index 76bceec5e..2f91885c1 100644 --- a/JavaSource/resources/ferret/scripts/feature_lon_lat_time_depth.jnl +++ b/JavaSource/resources/ferret/scripts/feature_lon_lat_time_depth.jnl @@ -3,115 +3,9 @@ ! Use file attributes to find which variables correspond to ! longitude, latitude, time in a Trajectory file -GO feature_get_direction_vars - -IF ($data_x_var"0|*>1") THEN DEFINE SYMBOL original_longi_var = ($data_x_var) -IF ($data_y_var"0|*>1") THEN DEFINE SYMBOL original_lati_var = ($data_y_var) -IF ($data_z_var"0|*>1") THEN DEFINE SYMBOL original_vert_var = ($data_z_var) -IF ($data_t_var"0|*>1") THEN DEFINE SYMBOL original_time_var = ($data_t_var) - -! Are longitude and latitude on the E axis of the dsg file? (profile data) -! Expand them, making sure the result is on the obs axis not abstract axis. -! List them in skip_list_var so they dont get listed in file outputs. - -sh sym its_trajectory_map -sh sym its_profile_map -sh sym data_x_var,data_y_var, data_t_var -IF ($its_profile_map"0|*>1") then exit/script - - -LET rowsum = ($rowvar)[m=@sum] - -DEFINE SYMBOL vshape = `($data_x_var),RETURN=shape` -IF `($vshape"0|E>1|POINT>1|*>0)` THEN - DEFINE SYMBOL ($data_x_var)_name = ($data_x_var) - SET VAR/NAME=($data_x_var)_M ($data_x_var) - LET ($($data_x_var)_name)_x = EXPND_BY_LEN(($data_x_var)_M, ($rowvar), rowsum) - LET/units="`($data_x_var)_M,return=units`"/TITLE="`($data_x_var)_M,RETURN=title`" \ - ($($data_x_var)_name) = ($($data_x_var)_name)_x[gx=obsXvar@ASN] - DEFINE SYMBOL skip_list_var = ($skip_list_var) ($data_x_var)_M -ENDIF - -DEFINE SYMBOL vshape = `($data_y_var),RETURN=shape` -IF `($vshape"0|E>1|POINT>1|*>0)` THEN - DEFINE SYMBOL ($data_y_var)_name = ($data_y_var) - SET VAR/NAME=($data_y_var)_M ($data_y_var) - LET ($($data_y_var)_name)_y = EXPND_BY_LEN(($data_y_var)_M, ($rowvar), rowsum) - LET/units="`($data_y_var)_M,return=units`"/TITLE="`($data_y_var)_M,RETURN=title`" \ - ($($data_y_var)_name) = ($($data_y_var)_name)_y[gx=obsXvar@ASN] - DEFINE SYMBOL skip_list_var = ($skip_list_var) ($data_y_var)_M -ENDIF - -DEFINE SYMBOL vshape = `($data_t_var),RETURN=shape` -IF `($vshape"0|E>1|POINT>1|*>0)` THEN - DEFINE SYMBOL ($data_t_var)_name = ($data_t_var) - SET VAR/NAME=($data_t_var)_M ($data_t_var) - LET ($($data_t_var)_name)_y = EXPND_BY_LEN(($data_t_var)_M, ($rowvar), rowsum) - LET/units="`($data_t_var)_M,return=units`"/TITLE="`($data_t_var)_M,RETURN=title`" \ - ($($data_t_var)_name) = ($($data_t_var)_name)_y[gx=obsXvar@ASN] - DEFINE ATTRIBUTE ($($data_t_var)_name).time_origin = "`($data_t_var)_M.time_origin`" - DEFINE SYMBOL skip_list_var = ($skip_list_var) ($data_t_var)_M -ENDIF - -! If the data was expanded above, we need to redefine these variables, -! used in synthesizing feature names when there is no name in the datset - -IF `($feature_name_list"0|*>1") AND ($skip_list_var"0|*>1")` THEN - - LET xlon_for_name = XSEQUENCE(IF ($data_x_var)_M GE 0 THEN ($data_x_var)_M ELSE ($data_x_var)_M+360 ) - LET xlat_for_name = XSEQUENCE(($data_y_var)_M) - LET xtim_for_name = XSEQUENCE(($data_t_var)_M) - -ENDIF - -IF `($data_x_var%0|*>1%) + ($data_y_var%0|*>1%) LT 2` THEN - MESSAGE/ERROR **ERROR Dataset must contain a Lon variable and a Lat variable - EXIT/PROGRAM -ENDIF +! DSG-enabled Ferret: maybe we don't need these -IF `($its_trajectory_map"0|*>1") OR ($its_profile_map"0|*>1")` THEN - IF ($rowvar"0|*>1") THEN DEFINE SYMBOL rowvar = rowsize - - DEFINE SYMBOL vshape = `($data_x_var),RETURN=shape` - IF `($vshape"0|E>1|POINT>1|*>0) AND (STRCMP("($data_x_var)", "($feature_variable)") NE 0)` THEN - -! Expand feature variable into obs axis - LET/TITLE="($ferret_title_0)" data_x_var_expand = EXPND_BY_LEN(($data_x_var), ($rowvar), rowsum) - DEFINE SYMBOL data_x_var = data_x_var_expand - - ENDIF - - DEFINE SYMBOL vshape = `($data_y_var),RETURN=shape` - IF `($vshape"0|E>1|POINT>1|*>0) AND (STRCMP("($data_y_var)", "($feature_variable)") NE 0)` THEN - -! Expand feature variable into obs axis - LET/TITLE="($ferret_title_0)" data_y_var_expand = EXPND_BY_LEN(($data_y_var), ($rowvar), rowsum) - DEFINE SYMBOL data_y_var = data_y_var_expand - - ENDIF - - IF ($data_z_var"0|*>1") THEN - DEFINE SYMBOL vshape = `($data_z_var),RETURN=shape` - IF `($vshape"0|E>1|POINT>1|*>0) AND (STRCMP("($data_z_var)", "($feature_variable)") NE 0)` THEN - -! Expand feature variable into obs axis - LET/TITLE="($ferret_title_0)" data_z_var_expand = EXPND_BY_LEN(($data_z_var), ($rowvar), rowsum) - DEFINE SYMBOL data_z_var = data_z_var_expand - - ENDIF - ENDIF ! IF ($data_z_var) - - IF ($data_t_var"0|*>1") THEN - DEFINE SYMBOL vshape = `($data_t_var),RETURN=shape` - IF `($vshape"0|E>1|POINT>1|*>0) AND (STRCMP("($data_t_var)", "($feature_variable)") NE 0)` THEN - -! Expand feature variable into obs axis - LET/TITLE="($ferret_title_0)" data_t_var_expand = EXPND_BY_LEN(($data_t_var), ($rowvar), rowsum) - DEFINE SYMBOL data_t_var = data_t_var_expand - - ENDIF - ENDIF ! IF ($data_t_var) +GO feature_get_direction_vars -ENDIF !---------------- end of feature_lon_lat_time_depth.jnl ------------------------- diff --git a/JavaSource/resources/ferret/scripts/insitu_pie_xy.jnl b/JavaSource/resources/ferret/scripts/insitu_pie_xy.jnl index d262817a7..3d642909e 100644 --- a/JavaSource/resources/ferret/scripts/insitu_pie_xy.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_pie_xy.jnl @@ -22,7 +22,7 @@ define symbol n3colocate = `ismdup[i=@sum]` define symbol size_creep_factor `(($ngood_data)+300)/(($ngood_data)+150) - 1` ! [0,1] range ! Instead base this on the number of profiles. Under ~50 start to increase the size. -define symbol size_creep_factor `(featuresize+100)/(featuresize+50) - 1` ! [0,1] range +define symbol size_creep_factor `(nfeatures+100)/(nfeatures+50) - 1` ! [0,1] range let/quiet sym_size = 0.9 + 1.5*($size_creep_factor) LET/QUIET PLMdflt_scale = 0.1 diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl index d69b326b8..62ec53358 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl @@ -1,6 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! $Header$ ! insitu_waterfall_xz.jnl +! ACM 8/2020 version for DSG datasets ! ! Creates a XZ Waterfall plot ! @@ -20,340 +21,30 @@ DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var !DEFINE SYMBOL ribbon = 0 ! wiggly waterfall plots, still colored if there is a color palette. DEFINE SYMBOL its_insitu = 1 -GO LAS_initialize_region 0 +! Open the dataset, analyze the DSG dataset, set up plot variables.8/19/2020 -IF ($data_0_var"0|vid>1|*>0") THEN - DEFINE SYMBOL ferret_by_id = 1 - USE "($data_0_url)" - LET varnames = ..varnames - - DEFINE SYMBOL data_0_var = `varnames[i=1]` - CANCEL DATA "($data_0_url)" -ENDIF -GO LAS_initialize_data 0 - -! Check for errors (They often occur during dataset initialization.) - -IF ($error_status"0|*>1") THEN - MESSAGE/ERROR **ERROR ($error_string) - EXIT/PROGRAM -ENDIF - -! Set the URL label for the first dataset. -GO LAS_url_label 0 - -! Create the profile variables and symbols - -IF `color_by_feature EQ 1` THEN GO LAS_initialize_feature_id - -DEFINE SYMBOL variable_lab = ($variable_lab) at depth (meters) - -! Apply any constraints - -LET xvar = ($data_var) -LET nx_var = `($data_var),RETURN=isize` - -LET var_mask = 1+0*x[gx=xvar,i=1:`nx_var`] -LET subset_mask = 1 -LET text_mask = 1 -LET ntext_masks = 0 - -IF ($constraint_0_lhs"0|*>1) THEN - GO prop_prop_constraints -ENDIF - -LET constraints_mask = var_mask* text_mask -LET constraints_mask1 = var_mask* text_mask - -! Apply the constraints mask - -LET var_data_masked = constraints_mask * ($data_var) -DEFINE SYMBOL data_var = var_data_masked - -! For the annotations -DEFINE SYMBOL ngood_data = `($data_var)[i=@NGD]` -DEFINE SYMBOL nbad_data = `($data_var)[i=@NBD]` - -! If the variable is TIME then symbols are -! DATA_VAR = "coord_time", DATA_T_VAR = "hours_1970" ?? -! -! In this case we can set up a time axis, and call polymark_datekey - -LET nout_lonlat = `var_data_masked[i=@ngd]` -DEFINE SYMBOL nout_lonlat = `nout_lonlat` - -! When the data crosses the branch cut, replicate the lon,lat,var variables -! with lon+360 or lon-360 and replicate latitudes, mask, and color-by variable - -IF `STRINDEX("($ferret_view"0")", "x") GT 0` THEN - - LET/UNITS=degrees_east x_var_data = ($data_x_var) - IF `($nodata"0|*>1") EQ 0` THEN - STAT x_var_data - ELSE - DEFINE SYMBOL stat_min ($region_x_lo) - ENDIF - - IF ($data_y_var"0|*>1") THEN LET/UNITS=degrees_north y_var_data = ($data_y_var) - IF ($data_z_var"0|*>1") THEN LET z_var_data = ($data_z_var) - IF ($data_t_var"0|*>1") THEN LET t_var_data = ($data_t_var) - LET var_data = ($data_var) - DEFINE SYMBOL var_data = ($data_var) - - IF `($STAT_MIN) LT ($REGION_X_LO)` THEN - DEFINE SYMBOL do_wrap = 360 - LET/UNITS=degrees_east x_var_data_wrap = x_var_data + ($do_wrap) - ENDIF - - IF `($REGION_X_HI) LT ($STAT_MAX)` THEN - DEFINE SYMBOL do_wrap = -360 - LET/UNITS=degrees_east x_var_data_wrap = x_var_data + (($do_wrap)) - ENDIF - - IF ($do_wrap"0|*>1") THEN - DEFINE SYMBOL data_x_var = x_var_data - DEFINE SYMBOL data_y_var = y_var_data - DEFINE SYMBOL data_z_var = z_var_data - DEFINE SYMBOL data_t_var = t_var_data - DEFINE SYMBOL data_var = var_data - ENDIF -ENDIF - -IF ($ferret_plot_key"0|date_key>1|*>0") THEN - - LET tmin = ($data_t_var)[i=@MIN] - LET tmax = ($data_t_var)[i=@MAX] - - LET since_loc = STRINDEX("`($data_t_var).units`","since") - 2 - IF `since_loc GT 1` THEN - LET tunits = SUBSTRING("`($data_t_var).units`",1,`since_loc`) - DEFINE SYMBOL tunits = `tunits` - ENDIF - DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($data_t_var).time_origin`"/units=($tunits) time_axis - - LET ttvar = t[gt=time_axis] - DEFINE SYMBOL datekey_time_arg = ttvar - - DEFINE SYMBOL margin = 1 - DEFINE SYMBOL ferret_fill_levels = 30 - -ENDIF - -IF ($ferret_by_id"0|*>1") THEN - DEFINE SYMBOL ferret_palette = more_by_levels - DEFINE SYMBOL ferret_fill_levels = `($rowvar),RETURN=lsize` - LET id_data = COMPRESSI(XSEQUENCE(TRANSPOSE_XZ(id_by_c))) - LET var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL ferret_plot_title Colored by Profile Number -ENDIF - -! Plot qualifiers (graticule lines etc) -GO LAS_set_plot_qualifiers - -! Open the window -GO LAS_open_window - -! Turn on annotate_key, which persists until turned off -! (unless key_annoatate property tells us otherwise). - -IF ($ferret_key_annotate"1|0|1|*>1") THEN - KEYMARK 1 -ELSE - KEYMARK 0 -ENDIF - -IF ($ribbon"1|0|1|*>1") THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/KEY -ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY -ENDIF - -DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") - -IF ($ribbon"0|*>1") THEN - DEFINE SYMBOL plot_command = PLOT/VS/RIBBON/LINE($qualifiers) - IF `nout_lonlat LT 50000` THEN DEFINE SYMBOL plot_command = ($plot_command)/THICK -ENDIF -LET prof_id = _m[ge=($rowvar)] - -LET rowsum = `($rowvar)[m=@sum]` -LET row_expand = EXPND_BY_LEN(XSEQUENCE(prof_id), XSEQUENCE(($rowvar)), rowsum) -LET new1 = IF MISSING(row_expand,-100) EQ -100 then 1 -LOAD row_expand - -DEFINE SYMBOL nprofiles = `($rowvar),return=msize` - -! newrow is 1 at the start of each new profile - -LET ib = row_expand[i=@ddb] -LET new1 = missing(ib,1) -LET newrow = if new1 ne 0 then 1 - -LET nk = `($data_z_var),return=isize` + `($rowvar)[m=@ngd]` -DEFINE SYMBOL nk = `nk` - - -! set up masks - -! Variables for the waterfall plots - -LET/TITLE="`($data_var),RETURN=title`" varplot = EXPNDI_BY(XSEQUENCE(($data_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Latitude"/UNITS="degrees_north" latplot = EXPNDI_BY(XSEQUENCE(($data_y_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Longitude"/UNITS="degrees_east" lonplot = EXPNDI_BY(XSEQUENCE(($data_x_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Depth"/UNITS="m" zplot = EXPNDI_BY(($data_z_var), newrow, ($nk)) - -LET/TITLE="Depth"/UNITS="m" issurf = EXPNDI_BY(XSEQUENCE(newrow), XSEQUENCE(newrow), ($nk)) ! Surface locations - -LET ntic = 10 -PPL %range ($region_z_lo), ($region_z_hi), `ntic` -LET dlo = ($ppl$range_low) -LET dhi = ($ppl$range_high) - -PPL %range ($region_y_lo), ($region_y_hi), `ntic` -LET ylo = ($ppl$range_low) -LET yhi = ($ppl$range_high) - -PPL %range ($region_x_lo), ($region_x_hi), `ntic` -LET xlo = ($ppl$range_low) -LET xhi = ($ppl$range_high) +GO LAS_insitu_waterfall_setup ! First plot sets up plot symbols. The reset_labels and color-key labeled by dates ! expect the color plot to be an overlay. -! For LAS_results: -DEFINE SYMBOL AX_VERT_POSTV = down - -! Make a blank plot with the correct X axis on the horizal and depth -! axis on the vertical. +PPL COLOR,6,60,60,60 ! grey +PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_x_var), ($data_z_var) +ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" +PLOT/OVER/VS/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_x_var), ($data_z_var), ($data_var) + IF ($ferret_annotations%0|*>1%) THEN GO reset_labels + GO key_at_top -DEFINE AXIS/z=`dlo`:`dhi`/depth/npoints=100 vaxis -DEFINE SYMBOL vunits= `($data_z_var),RETURN=units`AAA -IF `STRCMP("($vunits)", "AAA")` THEN SET AXIS/UNITS=`($data_z_var),RETURN=units` vaxis +PPL RIBBON/OVER + +! Add location labels as annotation notes. -DEFINE AXIS/x=`xlo`:`xhi`/npoints=100 haxis -DEFINE SYMBOL vunits= `($data_x_var),RETURN=units`AAA -IF `STRCMP("($vunits)", "AAA")` THEN SET AXIS/UNITS=`($data_x_var),RETURN=units` haxis - -DEFINE SYMBOL insitu_blankvar = blankvar -LET blankvar = 100+x[gx=haxis] + z[gz=vaxis] -SHADE/PAL=white/NOLAB/NOKEY/LEV=(0,1,1) blankvar -ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),return=units`" - - -IF ($ribbon"1|0|1|*>1") THEN - - PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/VLIM=`dhi`:0/HLIM=`xlo`:`xhi` lonplot, zplot - PLOT/OVER/VS/RIBBON/LINE/SYM=19/THICK/VLIM=`dhi`:0/HLIM=`xlo`:`xhi`($qualifiers)/SET lonplot, zplot, varplot - IF ($ferret_annotations%0|*>1%) THEN GO reset_labels - PPL RIBBON/OVER - -ELSE - -! To make wiggly waterfall plots - - define axis/x=-180:360:180/units=degrees xfull - define axis/y=90s:90n:90/units=degrees yfull - define axis/z=0:10000:5000/depth zfull - -! valmid - a "nice" value roughly mid-range of the "surface" values - DEFINE SYMBOL nvals `($data_var)[i=@ngd]` - IF `($nvals) EQ 0` THEN - DEFINE SYMBOL valmin 0.0 - DEFINE SYMBOL valmax 0.0 - DEFINE SYMBOL valmid 0.0 - ELSE - DEFINE SYMBOL valmin `($data_var)[i=@min]` - DEFINE SYMBOL valmax `($data_var)[i=@max]` - LET vsurf = varplot * issurf - PPL %RANGE,`vsurf[i=@min]`,`vsurf[i=@max]`,5 ! range of "surface" values - DEFINE SYMBOL ninc `(($ppl$range_high) - ($ppl$range_low))/($ppl$range_inc)` - DEFINE SYMBOL valmid `($ppl$range_low) + INT(($ninc)/2)*($ppl$range_inc)` - ENDIF - DEFINE SYMBOL valrange `($valmax) - ($valmin)` ! full range - -! decide on a range to use for the length key - ppl %RANGE,($valmin),($valmax),10 - DEFINE SYMBOL scale_min ($ppl$range_low) - DEFINE SYMBOL scale_max ($ppl$range_high) - - IF `($valrange) EQ 0` THEN - DEFINE SYMBOL wscale `0.1 * (xhi - xlo)` - ELSE - DEFINE SYMBOL wscale `0.1 * (xhi - xlo)/($valrange)` - ENDIF - -! draw a blank,labelled rectangle - allow room for waterfalls at edges - DEFINE SYMBOL wleft `($wscale)*(($valmid) - ($valmin))` - DEFINE SYMBOL wright `($wscale)*(($valmax) - ($valmid))` - - FILL/VLIM=0:`dhi`/HLIM=`xlo`:`xhi`/NOKEY/NOLAB/LEV=(-100,-99,1) 0*x[gx=xfull]*z[gz=zfull] - PPL YLAB @ACDepth (meters) - -! X or Y coordinates of profiles and depths defined above, lonplot, latplot, zplot. -! Values are varplot the values - -! plot the waterfalls, if any - IF `($nvals) EQ 0` THEN - LABEL/NOUSER `(ppl$xlen)/2`,`(ppl$ylen)/2`,0,0,.25 @ACNo Valid Data - ELSE - ! ... vertical profile markers - PLOT/VS/LINE/color=black/OVER/NOLAB/i=1:($nk) lonplot, zplot - ! ... profile data - IF `($nvals)/($nprofiles) GT 50` THEN -! PLOT/VS/LINE/COLOR=red/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot - RIBBON/VS/LINE/palette=($ferret_palette"red")/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot, zplot - ELSE -! PLOT/VS/LINE/COLOR=red/SYM=1/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot - RIBBON/VS/LINE/SYM=1/palette=($ferret_palette"red")/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot, zplot - ENDIF - ! ... scale indicator - DEFINE SYMBOL xmidsc (`(xhi + xlo)/2`) - DEFINE SYMBOL xlosc `($xmidsc) - ($wscale)*(($valmid) - ($scale_min))` - DEFINE SYMBOL xhisc `($xmidsc) + ($wscale)*(($scale_max) - ($valmid))` - DEFINE SYMBOL zmidsc `dhi/2` - DEFINE SYMBOL zlen `dhi/50` - DEFINE SYMBOL zlosc `($zmidsc) - ($zlen)/2` - DEFINE SYMBOL zhisc `($zmidsc) + ($zlen)/2` - PLOT/VS/LINE/COLOR=blue/THICK=2/OVER/NOLAB {($xlosc),($xlosc),($xlosc),($xhisc),($xhisc),($xhisc)},{($zlosc),($zhisc),($zmidsc),($zmidsc),($zlosc),($zhisc)} - ENDIF - -ENDIF ! NOT ribbon - -! Add any constraint labels as annotation notes. - -DEFINE SYMBOL longitude_lab = Longitude: ($region_x_lo):($region_x_hi) +DEFINE SYMBOL latitude_lab = Latitude: ($region_y_lo):($region_y_hi) DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) -IF `($ferret_annotations%0|*>1%)` THEN - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - DEFINE SYMBOL note_num = `($note_num"0") + 1`; \ - DEFINE SYMBOL note_($note_num)_lab = ($mask_title_($mmask)); \ - ENDIF) -ELSE - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - DEFINE SYMBOL label_x = `-0.95*($ppl$xorg)` - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - LABEL/NOUSER `($label_x)`, `($label_y)`, -1, 0, 0.12, ($mask_title_($mmask)) ; \ - DEFINE SYMBOL label_y = `($label_y) - 0.2`; \ - ENDIF) -ENDIF - -! Add cruise information on the top +! Add dataset information on the top GO feature_labels ! if constraints are shown via constraint_0_lhs etc, define labels for those diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl index 30ad89481..8bd98f991 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl @@ -1,6 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! $Header$ ! insitu_waterfall_yz.jnl +! ACM 8/2020 version for DSG datasets ! ! Creates a YZ Waterfall plot ! @@ -12,338 +13,34 @@ GO LAS_initial_setup DEFINE SYMBOL data_initialization_script = feature_initialize_data_insitu -! DEFINE SYMBOL ferret_label = 0 - SET MODE verify:always ! allows for debugging DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var -!DEFINE SYMBOL ribbon = 0 ! wiggly waterfall plots, still colored if there is a color palette. DEFINE SYMBOL its_insitu = 1 -GO LAS_initialize_region 0 - -IF ($data_0_var"0|vid>1|*>0") THEN - DEFINE SYMBOL ferret_by_id = 1 - USE "($data_0_url)" - LET varnames = ..varnames - - DEFINE SYMBOL data_0_var = `varnames[i=1]` - CANCEL DATA "($data_0_url)" -ENDIF -GO LAS_initialize_data 0 - -! Check for errors (They often occur during dataset initialization.) - -IF ($error_status"0|*>1") THEN - MESSAGE/ERROR **ERROR ($error_string) - EXIT/PROGRAM -ENDIF - -! Set the URL label for the first dataset. -GO LAS_url_label 0 - -! Create the profile variables and symbols - -IF `color_by_feature EQ 1` THEN GO LAS_initialize_feature_id - -DEFINE SYMBOL variable_lab = ($variable_lab) at depth (meters) - -! Apply any constraints - -LET xvar = ($data_var) -LET nx_var = `($data_var),RETURN=isize` - -LET var_mask = 1+0*x[gx=xvar,i=1:`nx_var`] -LET subset_mask = 1 -LET text_mask = 1 -LET ntext_masks = 0 - -IF ($constraint_0_lhs"0|*>1) THEN - GO prop_prop_constraints -ENDIF - -LET constraints_mask = var_mask* text_mask -LET constraints_mask1 = var_mask* text_mask - -! Apply the constraints mask - -LET var_data_masked = constraints_mask * ($data_var) -DEFINE SYMBOL data_var = var_data_masked - -! For the annotations -DEFINE SYMBOL ngood_data = `($data_var)[i=@NGD]` -DEFINE SYMBOL nbad_data = `($data_var)[i=@NBD]` - -! If the variable is TIME then symbols are -! DATA_VAR = "coord_time", DATA_T_VAR = "hours_1970" ?? -! -! In this case we can set up a time axis, and call polymark_datekey - -LET nout_lonlat = `var_data_masked[i=@ngd]` -DEFINE SYMBOL nout_lonlat = `nout_lonlat` - -! When the data crosses the branch cut, replicate the lon,lat,var variables -! with lon+360 or lon-360 and replicate latitudes, mask, and color-by variable - -IF `STRINDEX("($ferret_view"0")", "x") GT 0` THEN - - LET/UNITS=degrees_east x_var_data = ($data_x_var) - IF `($nodata"0|*>1") EQ 0` THEN - STAT x_var_data - ELSE - DEFINE SYMBOL stat_min ($region_x_lo) - ENDIF - - IF ($data_y_var"0|*>1") THEN LET/UNITS=degrees_north y_var_data = ($data_y_var) - IF ($data_z_var"0|*>1") THEN LET z_var_data = ($data_z_var) - IF ($data_t_var"0|*>1") THEN LET t_var_data = ($data_t_var) - LET var_data = ($data_var) - DEFINE SYMBOL var_data = ($data_var) - - IF `($STAT_MIN) LT ($REGION_X_LO)` THEN - DEFINE SYMBOL do_wrap = 360 - LET/UNITS=degrees_east x_var_data_wrap = x_var_data + ($do_wrap) - ENDIF - - IF `($REGION_X_LO) LT ($STAT_MIN)` THEN - DEFINE SYMBOL do_wrap = -360 - LET/UNITS=degrees_east x_var_data_wrap = x_var_data + (($do_wrap)) - ENDIF - -ENDIF - -IF ($ferret_plot_key"0|date_key>1|*>0") THEN - - LET tmin = ($data_t_var)[i=@MIN] - LET tmax = ($data_t_var)[i=@MAX] - - LET since_loc = STRINDEX("`($data_t_var).units`","since") - 2 - IF `since_loc GT 1` THEN - LET tunits = SUBSTRING("`($data_t_var).units`",1,`since_loc`) - DEFINE SYMBOL tunits = `tunits` - ENDIF - DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($data_t_var).time_origin`"/units=($tunits) time_axis - - LET ttvar = t[gt=time_axis] - DEFINE SYMBOL datekey_time_arg = ttvar - - DEFINE SYMBOL margin = 1 - DEFINE SYMBOL ferret_fill_levels = 30 - -ENDIF - -IF ($ferret_by_id"0|*>1") THEN - DEFINE SYMBOL ferret_palette = more_by_levels - DEFINE SYMBOL ferret_fill_levels = `($rowvar),RETURN=lsize` - LET id_data = COMPRESSI(XSEQUENCE(TRANSPOSE_XZ(id_by_c))) - LET var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL ferret_plot_title Colored by Profile Number -ENDIF - -! Plot qualifiers (graticule lines etc) -GO LAS_set_plot_qualifiers +! Open the dataset, analyze the DSG dataset, set up plot variables. -! Open the window -GO LAS_open_window - -! Turn on annotate_key, which persists until turned off -! (unless key_annoatate property tells us otherwise). - -IF ($ferret_key_annotate"1|0|1|*>1") THEN - KEYMARK 1 -ELSE - KEYMARK 0 -ENDIF - -IF ($ribbon"1|0|1|*>1") THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/KEY -ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY -ENDIF - -DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") - -IF ($ribbon"0|*>1") THEN - DEFINE SYMBOL plot_command = PLOT/VS/RIBBON/LINE($qualifiers) - IF `nout_lonlat LT 50000` THEN DEFINE SYMBOL plot_command = ($plot_command)/THICK -ENDIF - -LET prof_id = _m[ge=($rowvar)] - -LET rowsum = `($rowvar)[m=@sum]` -LET row_expand = EXPND_BY_LEN(XSEQUENCE(prof_id), XSEQUENCE(($rowvar)), rowsum) -LET new1 = IF MISSING(row_expand,-100) EQ -100 then 1 -LOAD row_expand - -DEFINE SYMBOL nprofiles = `($rowvar),RETURN=msize` - -! newrow is 1 at the start of each new profile - -LET ib = row_expand[i=@ddb] -LET new1 = missing(ib,1) -LET newrow = if new1 ne 0 then 1 - -LET nk = `($data_z_var),RETURN=isize` + `($rowvar)[m=@ngd]` -DEFINE SYMBOL nk = `nk` - - -! set up masks - -! Variables for the waterfall plots - - -LET/TITLE="`($data_var),RETURN=title`" varplot = EXPNDI_BY(XSEQUENCE(($data_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Latitude"/UNITS="degrees_north" latplot = EXPNDI_BY(XSEQUENCE(($data_y_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Longitude"/UNITS="degrees_east" lonplot = EXPNDI_BY(XSEQUENCE(($data_x_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Depth"/UNITS="m" zplot = EXPNDI_BY(($data_z_var), newrow, ($nk)) - -LET/TITLE="Depth"/UNITS="m" issurf = EXPNDI_BY(XSEQUENCE(newrow), XSEQUENCE(newrow), ($nk)) ! Surface locations - -LET ntic = 10 -PPL %range ($region_z_lo), ($region_z_hi), `ntic` -LET dlo = ($ppl$range_low) -LET dhi = ($ppl$range_high) - -PPL %range ($region_y_lo), ($region_y_hi), `ntic` -LET ylo = ($ppl$range_low) -LET yhi = ($ppl$range_high) - -PPL %range ($region_x_lo), ($region_x_hi), `ntic` -LET xlo = ($ppl$range_low) -LET xhi = ($ppl$range_high) +GO LAS_insitu_waterfall_setup ! First plot sets up plot symbols. The reset_labels and color-key labeled by dates ! expect the color plot to be an overlay. -! For LAS_results: -DEFINE SYMBOL AX_VERT_POSTV = down - -! Make a blank plot with the correct Y axis on the horizal and depth -! axis on the vertical. - -DEFINE AXIS/z=`dlo`:`dhi`/depth/npoints=100 vaxis -DEFINE SYMBOL vunits= `($data_z_var),RETURN=units`AAA -IF `STRCMP("($vunits)", "AAA")` THEN SET AXIS/UNITS=`($data_z_var),RETURN=units` vaxis - -DEFINE AXIS/y=`ylo`:`yhi`/npoints=100 haxis -DEFINE SYMBOL vunits= `($data_y_var),RETURN=units`AAA -IF `STRCMP("($vunits)", "AAA")` THEN SET AXIS/UNITS=`($data_x_var),RETURN=units` haxis - - -DEFINE SYMBOL insitu_blankvar = blankvar -LET blankvar = 100+y[gy=haxis] + z[gz=vaxis] -SHADE/PAL=white/NOLAB/NOKEY/LEV=(0,1,1) blankvar -ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),return=units`" - -IF ($ribbon"1|0|1|*>1") THEN - PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/VLIM=`dhi`:0/HLIM=`ylo`:`yhi` latplot, zplot - PLOT/OVER/VS/RIBBON/LINE/SYM=19/THICK/VLIM=`dhi`:0/HLIM=`ylo`:`yhi`($qualifiers)/SET latplot, zplot, varplot - IF ($ferret_annotations%0|*>1%) THEN GO reset_labels - PPL RIBBON/OVER -ELSE +PPL COLOR,6,60,60,60 ! grey +PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_y_var), ($data_z_var) -! To make wiggly waterfall plots +ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" - define axis/x=-180:360:180/units=degrees xfull - define axis/y=90s:90n:90/units=degrees yfull - define axis/z=0:10000:5000/depth zfull - -! valmid - a "nice" value roughly mid-range of the "surface" values - DEFINE SYMBOL nvals `($data_var)[i=@ngd]` - IF `($nvals) EQ 0` THEN - DEFINE SYMBOL valmin 0.0 - DEFINE SYMBOL valmax 0.0 - DEFINE SYMBOL valmid 0.0 - ELSE - DEFINE SYMBOL valmin `($data_var)[i=@min]` - DEFINE SYMBOL valmax `($data_var)[i=@max]` - LET vsurf = varplot * issurf - PPL %RANGE,`vsurf[i=@min]`,`vsurf[i=@max]`,5 ! range of "surface" values - DEFINE SYMBOL ninc `(($ppl$range_high) - ($ppl$range_low))/($ppl$range_inc)` - DEFINE SYMBOL valmid `($ppl$range_low) + INT(($ninc)/2)*($ppl$range_inc)` - ENDIF - DEFINE SYMBOL valrange `($valmax) - ($valmin)` ! full range - -! decide on a range to use for the length key - ppl %RANGE,($valmin),($valmax),10 - DEFINE SYMBOL scale_min ($ppl$range_low) - DEFINE SYMBOL scale_max ($ppl$range_high) - - IF `($valrange) EQ 0` THEN - DEFINE SYMBOL wscale `0.1 * (yhi - ylo)` - ELSE - DEFINE SYMBOL wscale `0.1 * (yhi - ylo)/($valrange)` - ENDIF - -! draw a blank,labelled rectangle - allow room for waterfalls at edges - DEFINE SYMBOL wleft `($wscale)*(($valmid) - ($valmin))` - DEFINE SYMBOL wright `($wscale)*(($valmax) - ($valmid))` - - FILL/VLIM=0:`dhi`/HLIM=`ylo`:`yhi`/NOKEY/NOLAB/LEV=(-100,-99,1) 0*y[gy=yfull]*z[gz=zfull] - PPL YLAB @ACDepth (meters) - +PLOT/OVER/VS/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_y_var), ($data_z_var), ($data_var) + IF ($ferret_annotations%0|*>1%) THEN GO reset_labels + GO key_at_top +PPL RIBBON/OVER -! X or Y coordinates of profiles and depths defined above, lonplot, latplot, zplot. -! Values are varplot the values - -! plot the waterfalls, if any - IF `($nvals) EQ 0` THEN - LABEL/NOUSER `(ppl$xlen)/2`,`(ppl$ylen)/2`,0,0,.25 @ACNo Valid Data - ELSE - ! ... vertical profile markers - PLOT/VS/LINE/color=black/OVER/NOLAB/i=1:($nk) latplot, zplot - ! ... profile data - IF `($nvals)/($nprofiles) GT 50` THEN - PLOT/VS/LINE/COLOR=red/OVER/NOLAB/i=1:($nk) latplot + ($wscale)*(varplot - ($valmid)), zplot - ELSE - PLOT/VS/LINE/COLOR=red/SYM=1/OVER/NOLAB/i=1:($nk) latplot + ($wscale)*(varplot - ($valmid)), zplot - ENDIF - ! ... scale indicator - DEFINE SYMBOL xmidsc (`(yhi + ylo)/2`) - DEFINE SYMBOL xlosc `($xmidsc) - ($wscale)*(($valmid) - ($scale_min))` - DEFINE SYMBOL xhisc `($xmidsc) + ($wscale)*(($scale_max) - ($valmid))` - DEFINE SYMBOL zmidsc `dhi/2` - DEFINE SYMBOL zlen `dhi/50` - DEFINE SYMBOL zlosc `($zmidsc) - ($zlen)/2` - DEFINE SYMBOL zhisc `($zmidsc) + ($zlen)/2` - PLOT/VS/LINE/COLOR=blue/THICK=2/OVER/NOLAB {($xlosc),($xlosc),($xlosc),($xhisc),($xhisc),($xhisc)},{($zlosc),($zhisc),($zmidsc),($zmidsc),($zlosc),($zhisc)} - ENDIF - -ENDIF ! NOT ribbon - -! Add any constraint labels as annotation notes. +! Add location labels as annotation notes. DEFINE SYMBOL longitude_lab = Longitude: ($region_x_lo):($region_x_hi) DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) -IF `($ferret_annotations%0|*>1%)` THEN - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - DEFINE SYMBOL note_num = `($note_num"0") + 1`; \ - DEFINE SYMBOL note_($note_num)_lab = ($mask_title_($mmask)); \ - ENDIF) -ELSE - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - DEFINE SYMBOL label_x = `-0.95*($ppl$xorg)` - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - LABEL/NOUSER `($label_x)`, `($label_y)`, -1, 0, 0.12, ($mask_title_($mmask)) ; \ - DEFINE SYMBOL label_y = `($label_y) - 0.2`; \ - ENDIF) -ENDIF - -! Add cruise information on the top +! Add feature information on the top GO feature_labels ! if constraints are shown via constraint_0_lhs etc, define labels for those diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl index bb880ae82..36b3edeab 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl @@ -5,6 +5,7 @@ ! Creates a ZT Waterfall plot ! 10/2017 Fix for different-shaped data. Check that variable time_units defined before using. ! 4/2018 Ferret updates require that the time-variable has units of seconds since origin. +! ACM 8/2020 version for DSG datasets ! ! Set the gif filename, changing it from .gif to the name from this request ! Set up to write info to the debug log so that FshowGO can be used @@ -14,373 +15,46 @@ GO LAS_initial_setup DEFINE SYMBOL data_initialization_script = feature_initialize_data_insitu -! DEFINE SYMBOL ferret_label = 0 SET MODE verify:always ! allows for debugging DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var -!DEFINE SYMBOL ribbon = 0 ! wiggly waterfall plots, still colored if there is a color palette. DEFINE SYMBOL its_insitu = 1 -GO LAS_initialize_region 0 -IF ($data_0_var"0|vid>1|*>0") THEN - DEFINE SYMBOL ferret_by_id = 1 - USE "($data_0_url)" - LET varnames = ..varnames +! Open the dataset, analyze the DSG dataset, set up plot variables. - DEFINE SYMBOL data_0_var = `varnames[i=1]` - CANCEL DATA "($data_0_url)" -ENDIF -GO LAS_initialize_data 0 - -! Check for errors (They often occur during dataset initialization.) - -IF ($error_status"0|*>1") THEN - MESSAGE/ERROR **ERROR ($error_string) - EXIT/PROGRAM -ENDIF - -! Set the URL label for the first dataset. -GO LAS_url_label 0 - -! Create the profile variables and symbols - -IF `color_by_feature EQ 1` THEN GO LAS_initialize_feature_id - -DEFINE SYMBOL variable_lab = ($variable_lab) at depth (meters) - -! Apply any constraints - -LET xvar = ($data_var) -LET nx_var = `($data_var),RETURN=isize` - -LET var_mask = 1+0*x[gx=xvar,i=1:`nx_var`] -LET subset_mask = 1 -LET text_mask = 1 -LET ntext_masks = 0 - -IF ($constraint_0_lhs"0|*>1) THEN - GO prop_prop_constraints -ENDIF - -LET constraints_mask = var_mask* text_mask -LET constraints_mask1 = var_mask* text_mask - -! Apply the constraints mask - -LET var_data_masked = constraints_mask * ($data_var) -DEFINE SYMBOL data_var = var_data_masked - -! For the annotations -DEFINE SYMBOL ngood_data = `($data_var)[i=@NGD]` -DEFINE SYMBOL nbad_data = `($data_var)[i=@NBD]` - -LET nout_lonlat = `var_data_masked[i=@ngd]` -DEFINE SYMBOL nout_lonlat = `nout_lonlat` - -IF ($ferret_plot_key"0|date_key>1|*>0") THEN - - LET tmin = ($data_t_var)[i=@MIN] - LET tmax = ($data_t_var)[i=@MAX] - - LET since_loc = STRINDEX("`($data_t_var).units`","since") - 2 - IF `since_loc GT 1` THEN - LET tunits = SUBSTRING("`($data_t_var).units`",1,`since_loc`) - DEFINE SYMBOL tunits = `tunits` - ENDIF - - - -! Adjust if start and end times are too close together - LET oneday = 1 - - let time_unitsok =`time_units,return=isready` - if `time_unitsok eq 0` then let time_units = tunits - IF `STRINDEX(time_units, "sec") GT 0` THEN LET oneday = 24*60*60 - IF `STRINDEX(time_units, "min") GT 0` THEN LET oneday = 24*60 - IF `STRINDEX(time_units, "ho") GT 0` THEN LET oneday = 24 - IF `STRINDEX(time_units, "da") GT 0` THEN LET oneday = 1 - IF `tmin-tmax LT 1.e-3` THEN - IF `tmin GT 0` THEN - LET tmin = `tmin - oneday` - LET tmax = `tmax + oneday` - ELSE - LET tmin = `tmin + oneday` - LET tmax = `tmax - oneday` - ENDIF - ENDIF - - DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($data_t_var).time_origin`"/units=($tunits) time_axis - - LET ttvar = t[gt=time_axis] - DEFINE SYMBOL datekey_time_arg = ttvar - - DEFINE SYMBOL margin = 1 - DEFINE SYMBOL ferret_fill_levels = 30 - -ENDIF - -IF ($ferret_by_id"0|*>1") THEN - DEFINE SYMBOL ferret_palette = more_by_levels - DEFINE SYMBOL ferret_fill_levels = `($rowvar),RETURN=lsize` - LET id_data = COMPRESSI(XSEQUENCE(TRANSPOSE_XZ(id_by_c))) - LET var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL var_data = id_data[i=1:`($data_x_var),RETURN=isize`] - DEFINE SYMBOL ferret_plot_title Colored by Profile Number -ENDIF - -! Plot qualifiers (graticule lines etc) -GO LAS_set_plot_qualifiers - -! Open the window -GO LAS_open_window - -! Turn on annotate_key, which persists until turned off -! (unless key_annoatate property tells us otherwise). - -IF ($ferret_key_annotate"1|0|1|*>1") THEN - KEYMARK 1 -ELSE - KEYMARK 0 -ENDIF - -IF ($ribbon"1|0|1|*>1") THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/KEY -ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY -ENDIF - -DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") - -IF ($ribbon"0|*>1") THEN - DEFINE SYMBOL plot_command = PLOT/VS/RIBBON/LINE($qualifiers) - IF `nout_lonlat LT 50000` THEN DEFINE SYMBOL plot_command = ($plot_command)/THICK -ENDIF -LET prof_id = _m[ge=($rowvar)] - -LET rowsum = `($rowvar)[m=@sum]` -LET row_expand = EXPND_BY_LEN(XSEQUENCE(prof_id), XSEQUENCE(($rowvar)), rowsum) -LET new1 = IF MISSING(row_expand,-100) EQ -100 then 1 -LOAD row_expand - -DEFINE SYMBOL nprofiles = `($rowvar),return=msize` - -! newrow is 1 at the start of each new profile - -LET ib = row_expand[i=@ddb] -LET new1 = missing(ib,1) -LET newrow = if new1 ne 0 then 1 - -LET nk = `($data_z_var),return=isize` + `($rowvar)[m=@ngd]` -DEFINE SYMBOL nk = `nk` - - -! set up masks - -! Variables for the waterfall plots - -LET/TITLE="`($data_var),RETURN=title`" varplot = EXPNDI_BY(XSEQUENCE(($data_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Latitude"/UNITS="degrees_north" latplot = EXPNDI_BY(XSEQUENCE(($data_y_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Longitude"/UNITS="degrees_east" lonplot = EXPNDI_BY(XSEQUENCE(($data_x_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Time"/UNITS="`($data_t_var),return=units`" timplot = EXPNDI_BY(XSEQUENCE(($data_t_var)), XSEQUENCE(newrow), ($nk)) -LET/TITLE="Depth"/UNITS="m" zplot = EXPNDI_BY(($data_z_var), newrow, ($nk)) - -LET/TITLE="Depth"/UNITS="m" issurf = EXPNDI_BY(XSEQUENCE(newrow), XSEQUENCE(newrow), ($nk)) ! Surface locations - -LET ntic = 10 -PPL %range ($region_z_lo), ($region_z_hi), `ntic` -LET dlo = ($ppl$range_low) -LET dhi = ($ppl$range_high) - - -DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull1 -DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull2 - -DEFINE SYMBOL view1 = vfull1 -DEFINE SYMBOL view2 = vfull2 +GO LAS_insitu_waterfall_setup ! Get units and origin for time variable -let tunits = "`($data_t_var),return=units`" -let sstring = `strindex(tunits, "since")` - 2 -let time_units = substring(tunits, 1, `sstring`) -let slen = strlen(tunits) -let time_origin = substring(tunits, sstring+8, slen-sstring) - -IF ($original_time_var"0|*>1") THEN - LET attnames = ($original_time_var).attnames - IF `IS_ELEMENT_OF_STR_N (attnames, "time_origin") GT 0` THEN \ - LET time_origin = "`($original_time_var).time_origin`" -ENDIF - -LET amin = time[i=@min] -LET amax = time[i=@max] - -GO LAS_is_range amin amax -CANCEL SYMBOL is_time - -! Adjust if time too close together -let oneday = 1 -IF `STRINDEX(time_units, "sec") GT 0` THEN LET oneday = 24*60*60 -IF `STRINDEX(time_units, "min") GT 0` THEN LET oneday = 24*60 -IF `STRINDEX(time_units, "ho") GT 0` THEN LET oneday = 24 -IF `STRINDEX(time_units, "da") GT 0` THEN LET oneday = 1 - -IF `ax_lo-ax_hi LT oneday/2` THEN - IF `ax_lo GT 0` THEN - LET ax_lo = `ax_lo - oneday` - LET ax_hi = `ax_hi + oneday` - ELSE - LET ax_lo = `ax_lo + oneday` - LET ax_hi = `ax_hi - oneday` - ENDIF -ENDIF -DEFINE AXIS/t=`ax_lo`:`ax_hi`/npoints=1000/units=`time_units`/t0="`time_origin`" haxis - -LET xlo = ax_lo -LET xhi = ax_hi - -DEFINE AXIS/z=`dlo`:`dhi`/depth/npoints=100 vaxis -DEFINE SYMBOL vunits= `($data_z_var),return=units`AAA -IF `STRCMP("($vunits)", "AAA")` THEN SET AXIS/UNITS=`($data_z_var),return=units` vaxis - - -! Make a blank plot with the correct time axis on the horizal and depth -! axis on the vertical. - -DEFINE SYMBOL insitu_blankvar = blankvar -LET blankvar = 100+t[gt=haxis] + z[gz=vaxis] -SHADE/PAL=white/NOLAB/NOKEY/LEV=(0,1,1) blankvar -ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),return=units`" - -LET zmm = MINMAX(zplot) -IF `zmm[i=1] GT zmm[i=2]` THEN - LET zplotvar = -1*zplot -ELSE - LET zplotvar = zplot -ENDIF - -!Now make the ribbon plot. +GO define_dsg_taxis +! del in days. Generally the graticules on time axis are too few and far between to be useful. +IF `del LT 4*365` THEN CANCEL MODE graticule +! Now make the ribbon plot. DEFINE SYMBOL qualifiers = ($qualifiers)/noaxes ! First plot sets up plot symbols. The reset_labels and color-key labeled by dates ! expect the color plot to be an overlay. -! For LAS_results: -DEFINE SYMBOL AX_VERT_POSTV = down - -IF ($ribbon"0|0|1|*>1") THEN - PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/noaxes timplot, zplotvar - PLOT/OVER/VS/OVER/RIBBON/LINE/MISS=blank/SYM=19/THICK($qualifiers)/SET timplot, zplotvar, varplot - IF ($ferret_annotations%0|*>1%) THEN GO reset_labels - PPL RIBBON/OVER -ELSE +PPL COLOR,6,60,60,60 ! grey +PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_t_var), ($data_z_var) -! To make wiggly waterfall plots +PLOT/OVER/VS/OVER/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_t_var), ($data_z_var), ($data_var) + IF ($ferret_annotations%0|*>1%) THEN GO reset_labels + GO key_at_top +PPL RIBBON/OVER - define axis/x=-180:360:180/units=degrees xfull - define axis/y=90s:90n:90/units=degrees yfull - define axis/z=0:10000:5000/depth zfull +ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" -! valmid - a "nice" value roughly mid-range of the "surface" values - DEFINE SYMBOL nvals `($data_var)[i=@ngd]` - IF `($nvals) EQ 0` THEN - DEFINE SYMBOL valmin 0.0 - DEFINE SYMBOL valmax 0.0 - DEFINE SYMBOL valmid 0.0 - ELSE - DEFINE SYMBOL valmin `($data_var)[i=@min]` - DEFINE SYMBOL valmax `($data_var)[i=@max]` - LET vsurf = varplot * issurf - PPL %RANGE,`vsurf[i=@min]`,`vsurf[i=@max]`,5 ! range of "surface" values - DEFINE SYMBOL ninc `(($ppl$range_high) - ($ppl$range_low))/($ppl$range_inc)` - DEFINE SYMBOL valmid `($ppl$range_low) + INT(($ninc)/2)*($ppl$range_inc)` - ENDIF - DEFINE SYMBOL valrange `($valmax) - ($valmin)` ! full range - -! decide on a range to use for the length key - ppl %RANGE,($valmin),($valmax),10 - DEFINE SYMBOL scale_min ($ppl$range_low) - DEFINE SYMBOL scale_max ($ppl$range_high) - - IF `($valrange) EQ 0` THEN - DEFINE SYMBOL wscale `0.1 * (xhi - xlo)` - ELSE - DEFINE SYMBOL wscale `0.1 * (xhi - xlo)/($valrange)` - ENDIF - -! draw a blank,labelled rectangle - allow room for waterfalls at edges - DEFINE SYMBOL wleft `($wscale)*(($valmid) - ($valmin))` - DEFINE SYMBOL wright `($wscale)*(($valmax) - ($valmid))` - - FILL/VLIM=0:`dhi`/HLIM=`xlo`:`xhi`/NOKEY/NOLAB/LEV=(-100,-99,1) 0*x[gx=xfull]*z[gz=zfull] - PPL YLAB @ACDepth (meters) - -! X or Y coordinates of profiles and depths defined above, lonplot, latplot, zplot. -! Values are varplot the values - -! plot the waterfalls, if any - IF `($nvals) EQ 0` THEN - LABEL/NOUSER `(ppl$xlen)/2`,`(ppl$ylen)/2`,0,0,.25 @ACNo Valid Data - ELSE - ! ... vertical profile markers - PLOT/VS/LINE/color=black/OVER/NOLAB/i=1:($nk) lonplot, zplot - ! ... profile data - IF `($nvals)/($nprofiles) GT 50` THEN -! PLOT/VS/LINE/COLOR=red/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot - RIBBON/VS/LINE/palette=($ferret_palette"red")/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot, zplot - ELSE -! PLOT/VS/LINE/COLOR=red/SYM=1/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot - RIBBON/VS/LINE/SYM=1/palette=($ferret_palette"red")/OVER/NOLAB/i=1:($nk) lonplot + ($wscale)*(varplot - ($valmid)), zplot, zplot - ENDIF - ! ... scale indicator - DEFINE SYMBOL xmidsc (`(xhi + xlo)/2`) - DEFINE SYMBOL xlosc `($xmidsc) - ($wscale)*(($valmid) - ($scale_min))` - DEFINE SYMBOL xhisc `($xmidsc) + ($wscale)*(($scale_max) - ($valmid))` - DEFINE SYMBOL zmidsc `dhi/2` - DEFINE SYMBOL zlen `dhi/50` - DEFINE SYMBOL zlosc `($zmidsc) - ($zlen)/2` - DEFINE SYMBOL zhisc `($zmidsc) + ($zlen)/2` - PLOT/VS/LINE/COLOR=blue/THICK=2/OVER/NOLAB {($xlosc),($xlosc),($xlosc),($xhisc),($xhisc),($xhisc)},{($zlosc),($zhisc),($zmidsc),($zmidsc),($zlosc),($zhisc)} - ENDIF - -ENDIF ! NOT ribbon - -! Add any constraint labels as annotation notes. +! Add location labels as annotation notes. DEFINE SYMBOL longitude_lab = Longitude: ($region_x_lo):($region_x_hi) -DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) - -IF `($ferret_annotations%0|*>1%)` THEN - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - DEFINE SYMBOL note_num = `($note_num"0") + 1`; \ - DEFINE SYMBOL note_($note_num)_lab = ($mask_title_($mmask)); \ - ENDIF) -ELSE - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - DEFINE SYMBOL label_x = `-0.95*($ppl$xorg)` - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - LABEL/NOUSER `($label_x)`, `($label_y)`, -1, 0, 0.12, ($mask_title_($mmask)) ; \ - DEFINE SYMBOL label_y = `($label_y) - 0.2`; \ - ENDIF) -ENDIF +DEFINE SYMBOL latitude_lab = Latitude: ($region_y_lo):($region_y_hi) -! Add cruise information on the top +! Add dataset information on the top GO feature_labels ! if constraints are shown via constraint_0_lhs etc, define labels for those diff --git a/JavaSource/resources/ferret/scripts/key_at_top.jnl b/JavaSource/resources/ferret/scripts/key_at_top.jnl index a18015324..fdd95407f 100644 --- a/JavaSource/resources/ferret/scripts/key_at_top.jnl +++ b/JavaSource/resources/ferret/scripts/key_at_top.jnl @@ -10,13 +10,16 @@ IF ($its_GE"0|*>1") THEN EXIT/SCRIPT IF `($ferret_plot_key"1|0|*>1") EQ 0` THEN EXIT/SCRIPT +! If the setting is /NOKEY then quit out. +IF `STRINDEX(UPCASE("($qualifiers%0%)"), "NOKEY") GT 0` THEN EXIT/SCRIPT + DEFINE SYMBOL horizontal_key = 1 IF `key_label_size,RETURN=defined` THEN CANCEL VAR key_label_size -IF `x1,RETURN=defined` THEN THEN CANCEL VAR x1 -IF `x2,RETURN=defined` THEN THEN CANCEL VAR x2 -IF `y1,RETURN=defined` THEN THEN CANCEL VAR y1 -IF `y2,RETURN=defined` THEN THEN CANCEL VAR y2 +IF `x1,RETURN=defined` THEN CANCEL VAR x1 +IF `x2,RETURN=defined` THEN CANCEL VAR x2 +IF `y1,RETURN=defined` THEN CANCEL VAR y1 +IF `y2,RETURN=defined` THEN CANCEL VAR y2 LET key_label_size = 0.08 diff --git a/JavaSource/resources/ferret/scripts/list_a_variable.jnl b/JavaSource/resources/ferret/scripts/list_a_variable.jnl index 6ba87b90f..f673f8cba 100644 --- a/JavaSource/resources/ferret/scripts/list_a_variable.jnl +++ b/JavaSource/resources/ferret/scripts/list_a_variable.jnl @@ -101,6 +101,10 @@ IF `($ferret_points_zt%0|*>1%) AND ($frmt%0|/format=cdf>1|*>0%) AND ($data_count CANCEL ATTRIBUTE/OUTPUT (`($data_0_var),return=zaxis`).standard_name ENDIF +LET/UNITS="`($ferret_list_var),RETURN=units)`"\ + the_list_var = ($ferret_list_var) +!SET ATT/LIKE=($data_var) the_list_var + IF ($data_var_transform"0|*>1") THEN DEFINE attribute ($ferret_list_var).transform_history "($data_var)($data_var_transform)" SET ATTRIBUTE/OUTPUT ($ferret_list_var).transform_history diff --git a/JavaSource/resources/ferret/scripts/list_data.jnl b/JavaSource/resources/ferret/scripts/list_data.jnl index 478466a26..2b4c24bae 100644 --- a/JavaSource/resources/ferret/scripts/list_data.jnl +++ b/JavaSource/resources/ferret/scripts/list_data.jnl @@ -29,31 +29,35 @@ GO LAS_initial_setup 0 CANCEL SYMBOL frmt DEFINE SYMBOL frmt ($frmt)/($ferret_format%format=cdf|txt>heading|cdf>format=cdf|asc>width=1024|%) -IF ($ferret_format%0|asc>1|*>0) THEN DEFINE SYMBOL frmt ($frmt)/format=(5G12.5) +IF ($ferret_format%0|asc>1|*>0) THEN + DEFINE SYMBOL frmt ($frmt)/format=(5G12.5) + + IF ($ferret_data_format"0|tsv>1|csv>1|asc>1|*>0") THEN + DEFINE SYMBOL frmt ($frmt) = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") + SET LIST/PREC=7 + + IF ($ferret_points_zt%0|*>1%) THEN + LIST/APPEND/FILE="($result_ferret_listing_filename)" "Data Is Listed at fixed z-levels. Adding pressure to this listing" + DEFINE SYMBOL nzt = ($data_count) + DEFINE SYMBOL data_count = `($data_count) + 1` + DEFINE SYMBOL data_($nzt)_dataset_name = ($data_0_dataset_name) + DEFINE SYMBOL data_($nzt)_url = ($data_0_url) + USE ($data_0_url) + DEFINE SYMBOL data_($nzt)_name = `($ferret_points_zt),return=title` + DEFINE SYMBOL data_($nzt)_region = ($data_0_region) + DEFINE SYMBOL data_($nzt)_title = `($ferret_points_zt),return=title` + DEFINE SYMBOL data_($nzt)_units = `($ferret_points_zt),return=units` + DEFINE SYMBOL data_($nzt)_var = ($ferret_points_zt) + DEFINE SYMBOL data_($nzt)_t_hi = ($region_0_t_hi) + DEFINE SYMBOL data_($nzt)_t_lo = ($region_0_t_lo) + DEFINE SYMBOL data_($nzt)_x_hi = ($region_0_x_hi) + DEFINE SYMBOL data_($nzt)_x_lo = ($region_0_x_lo) + DEFINE SYMBOL data_($nzt)_y_hi = ($region_0_y_hi) + DEFINE SYMBOL data_($nzt)_y_lo = ($region_0_y_lo) + DEFINE SYMBOL data_($nzt)_z_hi = ($region_0_z_hi) + DEFINE SYMBOL data_($nzt)_z_lo = ($region_0_z_lo) + ENDIF -IF ($ferret_data_format%0|tsv>1|csv>1|asc>1|*>0%) THEN - DEFINE SYMBOL frmt ($frmt) = ($frmt)/($ferret_data_format%|tsv>format=tab|csv>format=comma|asc>heading=enhanced%) - SET LIST/PREC=7 - IF ($ferret_points_zt%0|*>1%) THEN - LIST/APPEND/FILE="($result_ferret_listing_filename)" "Data Is Listed at fixed z-levels. Adding pressure to this listing" - DEFINE SYMBOL nzt = ($data_count) - DEFINE SYMBOL data_count = `($data_count) + 1` - DEFINE SYMBOL data_($nzt)_dataset_name = ($data_0_dataset_name) - DEFINE SYMBOL data_($nzt)_url = ($data_0_url) - USE ($data_0_url) - DEFINE SYMBOL data_($nzt)_name = `($ferret_points_zt),return=title` - DEFINE SYMBOL data_($nzt)_region = ($data_0_region) - DEFINE SYMBOL data_($nzt)_title = `($ferret_points_zt),return=title` - DEFINE SYMBOL data_($nzt)_units = `($ferret_points_zt),return=units` - DEFINE SYMBOL data_($nzt)_var = ($ferret_points_zt) - DEFINE SYMBOL data_($nzt)_t_hi = ($region_0_t_hi) - DEFINE SYMBOL data_($nzt)_t_lo = ($region_0_t_lo) - DEFINE SYMBOL data_($nzt)_x_hi = ($region_0_x_hi) - DEFINE SYMBOL data_($nzt)_x_lo = ($region_0_x_lo) - DEFINE SYMBOL data_($nzt)_y_hi = ($region_0_y_hi) - DEFINE SYMBOL data_($nzt)_y_lo = ($region_0_y_lo) - DEFINE SYMBOL data_($nzt)_z_hi = ($region_0_z_hi) - DEFINE SYMBOL data_($nzt)_z_lo = ($region_0_z_lo) ENDIF ENDIF @@ -66,3 +70,6 @@ IF ($ferret_data_format"0|csv>1|*>0") THEN ELSE REPEAT/RANGE=1:($data_count"1")/NAME=outvar (GO list_a_variable `outvar-1`; CANCEL SYMBOL ferret_list_var) ENDIF + + +! End of file ------------ list_data.jnl -------------------------- diff --git a/JavaSource/resources/ferret/scripts/list_prop_prop.jnl b/JavaSource/resources/ferret/scripts/list_prop_prop.jnl index 228f6b05c..8eb52db2d 100644 --- a/JavaSource/resources/ferret/scripts/list_prop_prop.jnl +++ b/JavaSource/resources/ferret/scripts/list_prop_prop.jnl @@ -4,6 +4,9 @@ ! Author: ansley ! Date: 08-2013 +! Called by Trajectory_corr_file.jnl +! Make "show data" listings from a DSG dataset (trajectory, profile, or timeseries). + ! lists prop_prop_plot.jnl creates an ascii listing of the data from a ! property-property plot, using the data variable in symbol ferret_plot_var_0, ! the second variable from ferret_plot_var_1 and optionally colored by ferret_plot_var_2. @@ -16,11 +19,10 @@ ! 9/2017 If there is a fourth variable, list it too. ! 10/2017 Ensure that Time, Longitude, Latitude, Depth are written if available. ! 10/2017 List up to the total number of variables in the dataset data_0_var through data_xx_var. -! 2/2020 Check for existence of global attributes before using global_attnames. set mode verify:always -DEFINE SYMBOL frmt width=1024/norow +DEFINE SYMBOL frmt width=1024 IF ($ferret_data_format"0|csv>1|tsv>1|asc>1|*>0") THEN DEFINE SYMBOL frmt = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") @@ -43,151 +45,14 @@ CANCEL DATA `($data_0_var),RETURN=dsetnum` GO setup_prop_prop -IF ($ferret_plot_var_2"0|($feature_variable"A")|*>0") THEN CANCEL SYMBOL ferret_plot_var_2 - -! If the color-by variable is a duplicate of either variable 0 or 1, no need to list it. - -IF ($ferret_plot_var_2"0|($ferret_plot_var_0)>1|($ferret_plot_var_1)>1|*>0") THEN \ - CANCEL SYMBOL ferret_plot_var_2 - -! For that matter, if variable 0 matches variable 1, we can skip one of them. - -IF ($ferret_plot_var_1"0|($ferret_plot_var_0)>1|*>0") THEN \ - CANCEL SYMBOL ferret_plot_var_1 - -IF `($ferret_plot_var_1"0|*>1") EQ 0` THEN LET yvar = xvar - -! The variables must be the same size. Check and set up a nice message if not. - -LET xsize = `xvar,RETURN=isize` -LET ysize = `yvar,RETURN=isize` - -IF `xsize NE ysize` THEN - MESSAGE/ERROR **ERROR The variables must have the same dimensions: ($ferret_plot_var_0), ($ferret_plot_var_1) - EXIT/PROGRAM -ENDIF - -DEFINE SYMBOL timevar = time -IF ($time_done"0|*>1") THEN DEFINE SYMBOL timevar = time_ - -! Apply any constraints - -LET var_mask = 1+0*($timevar) -LET text_mask = {1} -LET ntext_masks = 0 - -IF ($constraint_0_lhs"0|*>1) THEN - GO prop_prop_constraints -ENDIF - - -LET feature_mask_obs = EXPND_BY_LEN(feature_mask,($rowvar),`($rowvar)[m=@sum]`) -DEFINE SYMBOL have_feature_mask = 1 - -LET constraints_mask = var_mask* text_mask* feature_mask_obs - - -! Set up to list the trajectory variable with the metadata - - -IF ($feature_variable"0|*>1") THEN - - LET gettype = ($feature_variable) - DEFINE SYMBOL trajtype = `gettype,RETURN=dtype` - IF ($trajtype"0|CHAR>1|*>0") THEN DEFINE SYMBOL is_string = 1 - - DEFINE SYMBOL trajshape = `($feature_variable),RETURN=shape` - IF `($trajshape"0|E>1|POINT>1|*>0)` THEN - - ! Expand all strings into obs axis - IF ($is_string"0|*>1") THEN - -! set var/name=($feature_variable)_expanding ($feature_variable) - let/like=($feature_variable) ($feature_variable)_expanding = ($feature_variable) - LET ($feature_variable)_xpnd = EXPND_BY_LEN_STR(($feature_variable)_expanding, ($rowvar), `($rowvar)[m=@sum]`) - - LET ii = i[g=($timevar)] - LET iindices = IF constraints_mask THEN ii - LET compress_mask = COMPRESSI(iindices) - LET nok = `compress_mask[i=@ngd]` - IF `STRINDEX("($feature_variable_in)", "'") EQ 1` THEN - GO LAS_unquote_string feature_variable_in - DEFINE SYMBOL feature_variable_in = feature_variable_in1 - ENDIF - - LET/TITLE="($feature_type)" ($feature_variable)_ = SAMPLEI (($feature_variable)_xpnd, compress_mask[i=1:`nok`]) - DEFINE SYMBOL feature_variable_in = ($feature_variable)_ - - ELSE - LET traj_obs = EXPND_BY_LEN(($feature_variable), ($rowvar), `($rowvar)[m=@sum]`) - IF `STRINDEX("($feature_variable_in)", "'") EQ 1` THEN - GO LAS_unquote_string feature_variable_in - DEFINE SYMBOL feature_variable_in = feature_variable_in1 - ENDIF - LET/TITLE="($feature_variable_in)" ($feature_variable_in) = constraints_mask*traj_obs - LET/TITLE="($feature_type)" ($feature_variable_in) = constraints_mask*traj_obs - ENDIF - ENDIF +! set up any constraint labels +GO set_constraint_labels +IF `($dsgshape"0|*>1") EQ 0` THEN + MESSAGE/ERROR **ERROR Expecting Discrete Sampling Geometries data + EXIT/PROGRAM ENDIF -IF ($color_by"0|*>1") THEN - DEFINE SYMBOL plot_arg = ($xvar), ($yvar), zvar - DEFINE SYMBOL ztype = `zvar,RETURN=dtype` - IF ($ztype"0|CHAR>1|*>0") THEN DEFINE SYMBOL is_string = 1 - - LET zsize = `zvar,RETURN=isize` - IF `zsize NE xsize` THEN - -! Is this a DSG file? If so is one of the variables on the sample-dimension (obs) axis -! and the other on the trajectory (or profile) axis? May need to expand a variable -! onto the obs axis -! If a variable on the M axis is a string, create a numeric ID variable, index 1,2,3, ... - - - DEFINE SYMBOL zshape = `zvar,RETURN=shape` - IF `($zshape"0|E>1|POINT>1|*>0)` THEN - - ! Expand all strings into obs axis - IF ($is_string"0|*>1") THEN - LET zvar = EXPND_BY_LEN_STR(zvar, ($rowvar), `($rowvar)[m=@sum]`) - ELSE - LET zvar = EXPND_BY_LEN(zvar, ($rowvar), `($rowvar)[m=@sum]`) - ENDIF - ENDIF - LET zsize = `zvar,RETURN=isize` - - IF `zsize NE xsize` THEN - MESSAGE/ERROR **ERROR The variables must have the same dimensions: ($ferret_plot_var_0), ($ferret_plot_var_2) - EXIT/PROGRAM - ENDIF - - DEFINE SYMBOL zvar = constraints_mask*zvar - - ENDIF - DEFINE SYMBOL color_by_title = `zvar,RETURN=title` - -ENDIF ! color-by 3rd var - -DEFINE SYMBOL xvar = constraints_mask* xvar -DEFINE SYMBOL yvar = constraints_mask* yvar - -! Will list the date strings to the accuracy of the time units, or the timelab_res property. - -DEFINE SYMBOL t_units_string = `($timevar).units` -LET nsince = `STRINDEX("($t_units_string)", "since")-1` -IF `nsince GT 0` THEN DEFINE SYMBOL tunits = `SUBSTRING("($t_units_string)", 1, nsince)` - -IF `($data_0_units"-99|text>-99|*>1") NE -99 AND STRINDEX( UPCASE("($ferret_plot_var_0)"), "TIME") GT 0` THEN \ - DEFINE SYMBOL tunits = ($data_0_units) - -DEFINE SYMBOL plot_arg = ($xvar) -IF `($data_count"0") GE 2` THEN DEFINE SYMBOL plot_arg = ($xvar), ($yvar) ! was ($xvar), ($xvar) ?? - -IF ($ferret_plot_var_1"0|*>1") THEN - IF `STRINDEX( UPCASE("($ferret_plot_var_1)"), "TIME") GT 0` THEN DEFINE SYMBOL tunits = ($data_1_units) - DEFINE SYMBOL plot_arg = ($xvar), ($yvar) -ENDIF ! set up any constraint labels GO set_constraint_labels @@ -196,223 +61,8 @@ GO set_constraint_labels LET size = `constraints_mask[i=@ngd]` - -LET nlist = 0 - -! Always list the trajectory id, e.g. cruise_expocode - -IF ($feature_variable_in"0|*>1") THEN DEFINE SYMBOL vars_out = ($feature_variable_in) -DEFINE SYMBOl comma = , - -LET has_time = `($timevar),RETURN=isready` -IF `IS_ELEMENT_OF_STR_N(varnames, "($timevar)") GT 0 OR has_time GT 0` THEN - -! Make a time axis from the time coordinates and use it to compute the date strings. -! Don't list the time variable itself. Hard to give it enough resolution to be useful. - - LET amin = ($timevar)[i=@MIN] - LET amax = ($timevar)[i=@MAX] - DEFINE SYMBOL is_time = 1 - GO LAS_is_range amin amax - - DEFINE AXIS/T=`ax_lo`:`ax_hi`:`del_ax`/T0="`($timevar).time_origin`"/UNITS=($tunits) haxis - - LET timesample = COMPRESSI(constraints_mask*($timevar)) - LET/TITLE="Time"/UNITS="`($timevar),RETURN=units`" Times = timesample - LET/TITLE="Date" Date = TAX_DATESTRING (Times[i=1:`size`], t[gt=haxis], "($ferret_timelab_res%($tunits)%)") - - LET nlist = 1 - DEFINE SYMBOL vars_out = ($vars_out), Date - -ENDIF ! dates, times - -! Define Longitude and Latitude variables at the masked locations -IF `IS_ELEMENT_OF_STR_N(varnames, "($timevar)") GT 0 OR has_time GT 0` THEN - - LET ii = i[g=($timevar)] - LET iindices = IF constraints_mask THEN ii - LET compress_mask = COMPRESSI(iindices) - LET nok = `compress_mask[i=@ngd]` - LET/TITLE="`longitude_,RETURN=title`"/UNITS="`longitude_,RETURN=units`" Longitude = SAMPLEI (longitude_, compress_mask[i=1:`nok`]) - LET/TITLE="`latitude_,RETURN=title`"/UNITS="`latitude_,RETURN=units`" Latitude = SAMPLEI (latitude_, compress_mask[i=1:`nok`]) - - LET nlist = `nlist + 2` - DEFINE SYMBOL vars_out = ($vars_out), Longitude, Latitude - -ENDIF ! longitude, latitude - -! If this is a Feature-type dataset of any type other than a Trajectory dataset, -! see if there is a Depth variable and list it too. - -! Was depth already included in the input variables? - -DEFINE SYMBOL have_depth = 0 -REPEAT/RANGE=1:($data_count)/name=v (\ -DEFINE SYMBOL iv = `v-1`; \ -IF ($data_($iv)_var%0|depth>1|*>0%) THEN define symbol have_depth = 1;\ -IF ($data_($iv)_var%0|depth_>1|*>0%) THEN define symbol have_depth = 1;\ -LET attnames = ($data_($iv)_var).attnames;\ -IF `IS_ELEMENT_OF_STR_N(attnames, "depth") GE 1` THEN define symbol have_depth = 1) - -LET global_attnames = ..attnames -LET nglobal_atts = ..nattrs - - -LET featr = 0 -IF `nglobal_atts GT 0` THEN - IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN LET featr = 1 -ENDIF - -DEFINE SYMBOL feature_type = none -IF `featr GT 0` THEN DEFINE SYMBOL feature_type = `..featureType` - -DEFINE SYMBOL depthvar = depth -IF ($depth_done"0|*>1") THEN DEFINE SYMBOL depthvar = depth_ - -IF `($feature_type%0|Trajectory>0|none>0|*>1%) AND (($have_depth) EQ 0) AND\ - IS_ELEMENT_OF_STR_N(varnames, "($depthvar)") GE 1` THEN - - LET ii = i[g=($timevar)] - LET iindices = IF constraints_mask THEN ii - LET compress_mask = COMPRESSI(iindices) - LET nok = `compress_mask[i=@ngd]` - LET/TITLE="`($depthvar),RETURN=title`"/UNITS="`($depthvar),RETURN=units`" Depth = SAMPLEI (($depthvar), compress_mask[i=1:`nok`]) - - LET nlist = `nlist + 1` - DEFINE SYMBOL vars_out = ($vars_out), Depth - -ENDIF - -! Define variables with titles - -IF ($ferret_plot_var_0"0|time_>0|($feature_variable)>0|longitude_>0|latitude_>0|*>1") THEN - - LET gettype = ($ferret_plot_var_0) - DEFINE SYMBOL vtype = `gettype,RETURN=dtype` - LET ii = i[g=($timevar)] - LET iindices = IF constraints_mask THEN ii - LET compress_mask = COMPRESSI(iindices) - LET nok = `compress_mask[i=@ngd]` - IF `STRINDEX("($data_0_var_in)", "'") EQ 1` THEN - GO LAS_unquote_string data_0_var_in - DEFINE SYMBOL data_0_var_in = ($data_0_var_in)1 - ENDIF - LET/TITLE="($data_0_title)"/UNITS="($data_0_units)" ($data_0_var_in) = SAMPLEI (($ferret_plot_var_0), compress_mask[i=1:`nok`]) - -! expand metadata variables onto the X axis - IF ($vtype"0|CHAR>1|*>0") THEN DEFINE SYMBOL is_string = 1 - DEFINE SYMBOL zshape = `($ferret_plot_var_0),RETURN=shape` - IF `($zshape"0|E>1|POINT>1|*>0)` THEN - ! Expand all strings into obs axis - IF ($is_string"0|*>1") THEN - LET ($ferret_plot_var_0)_xpnd = EXPND_BY_LEN_STR(($ferret_plot_var_0), ($rowvar), `($rowvar)[m=@sum]`) - ELSE - LET ($ferret_plot_var_0)_xpnd = EXPND_BY_LEN(($ferret_plot_var_0), ($rowvar), `($rowvar)[m=@sum]`) - ENDIF - IF `STRINDEX("($data_0_var_in)", "'") EQ 1` THEN - GO LAS_unquote_string data_0_var_in - DEFINE SYMBOL data_0_var_in = ($data_0_var_in)1 - ENDIF - LET/TITLE="($data_0_title)"/UNITS="($data_0_units)" ($data_0_var_in) = SAMPLEI (($ferret_plot_var_0)_xpnd, compress_mask[i=1:`nok`]) - ENDIF - - LET nlist = `nlist + 1` - IF `nlist LT 1` THEN LET nlist = 2 - DEFINE SYMBOL vars_out = ($vars_out), ($data_0_var_in) -ENDIF - -IF ($ferret_plot_var_1"0|time_>0|($feature_variable)>0|longitude_>0|latitude_>0|*>1") THEN - - LET gettype = ($ferret_plot_var_1) - DEFINE SYMBOL vtype = `gettype,RETURN=dtype` - LET ii = i[g=($timevar)] - LET iindices = IF constraints_mask THEN ii - LET compress_mask = COMPRESSI(iindices) - LET nok = `compress_mask[i=@ngd]` - IF `STRINDEX("($data_1_var_in)", "'") EQ 1` THEN - GO LAS_unquote_string data_1_var_in - DEFINE SYMBOL data_1_var_in = ($data_1_var_in)1 - ENDIF - LET/TITLE="($data_1_title)"/UNITS="($data_1_units)" ($data_1_var_in) = SAMPLEI (($ferret_plot_var_1), compress_mask[i=1:`nok`]) - - IF ($vtype"0|CHAR>1|*>0") THEN DEFINE SYMBOL is_string = 1 - -! expand metadata variables onto the X axis - DEFINE SYMBOL zshape = `($ferret_plot_var_1),RETURN=shape` - IF `($zshape"0|E>1|*>0)` THEN - ! Expand all strings into obs axis - IF ($is_string"0|*>1") THEN - LET ($ferret_plot_var_1)_xpnd = EXPND_BY_LEN_STR(($ferret_plot_var_1), ($rowvar), `($rowvar)[m=@sum]`) - ELSE - LET ($ferret_plot_var_1)_xpnd = EXPND_BY_LEN(($ferret_plot_var_1), ($rowvar), `($rowvar)[m=@sum]`) - ENDIF - IF `STRINDEX("($data_1_var_in)", "'") EQ 1` THEN - GO LAS_unquote_string data_1_var_in - DEFINE SYMBOL data_1_var_in = ($data_1_var_in)1 - ENDIF - LET/TITLE="($data_1_title)"/UNITS="($data_1_units)" ($data_1_var_in) = SAMPLEI (($ferret_plot_var_1)_xpnd, compress_mask[i=1:`nok`]) - ENDIF - - LET nlist = `nlist + 1` - DEFINE SYMBOL vars_out = ($vars_out), ($data_1_var_in) -ENDIF - -! color-by variable on the prop-prop plot: - -IF ($ferret_plot_var_2"0|time_>0|($feature_variable)>0|longitude_>0|latitude_>0|*>1") THEN - - LET gettype = ($ferret_plot_var_2) - DEFINE SYMBOL vtype = `gettype,RETURN=dtype` - IF ($vtype"0|CHAR>1|*>0") THEN DEFINE SYMBOL is_string = 1 - - LET ii = i[g=($timevar)] - LET iindices = IF constraints_mask THEN ii - LET compress_mask = COMPRESSI(iindices) - LET nok = `compress_mask[i=@ngd]` - IF `STRINDEX("($data_2_var_in)", "'") EQ 1` THEN - GO LAS_unquote_string data_2_var_in - DEFINE SYMBOL data_2_var_in = ($data_2_var_in)1 - ENDIF - LET/TITLE="($data_2_title)"/UNITS="($data_2_units)" ($data_2_var_in) = SAMPLEI (zvar, compress_mask[i=1:`nok`]) - -! expand metadata variables onto the X axis - DEFINE SYMBOL zshape = `($ferret_plot_var_2),RETURN=shape` - IF `($zshape"0|E>1|POINT>1|*>0)` THEN - ! Expand all strings into obs axis - IF ($is_string"0|*>1") THEN - LET ($ferret_plot_var_2)_xpnd = EXPND_BY_LEN_STR(($ferret_plot_var_2), ($rowvar), `($rowvar)[m=@sum]`) - ELSE - LET ($ferret_plot_var_2)_xpnd = EXPND_BY_LEN(($ferret_plot_var_2), ($rowvar), `($rowvar)[m=@sum]`) - ENDIF - IF `STRINDEX("($data_2_var_in)", "'") EQ 1` THEN - GO LAS_unquote_string data_2_var_in - DEFINE SYMBOL data_2_var_in = ($data_2_var_in)1 - ENDIF - LET/TITLE="($data_2_title)"/UNITS="($data_2_units)" ($data_2_var_in) = SAMPLEI (($ferret_plot_var_2)_xpnd, compress_mask[i=1:`nok`]) - ENDIF - - LET nlist = `nlist + 1` - DEFINE SYMBOL vars_out = ($vars_out), ($data_2_var_in) -ENDIF - -! Set up to list further variables -IF `($data_count"0") GE 4` THEN - REPEAT/RANGE=3:`($data_count)-1`/NAME=c (\ - DEFINE SYMBOL list_var = `c`; \ - GO set_proplist_var) -ENDIF - -! Make sure we havent ended the list with a comma. - -IF `STRLEN("($vars_out)") EQ STRRINDEX("($vars_out)", ",")` THEN - LET slen = `STRLEN("($vars_out)") - 1` - DEFINE SYMBOL vars_out = `SUBSTRING("($vars_out)", 1, slen)` -ENDIF - LIST/NOHEAD/NOROW/FILE/CLOBBER/FORMAT=("Total Number of Records", F10.0) `size` -DEFINE SYMBOL list_quals = APPEND - ! Constraint labels IF `($note_num"0") GT 0` THEN @@ -421,45 +71,24 @@ IF `($note_num"0") GT 0` THEN SAY/OUTFILE="($result_ferret_listing_filename)"/APPEND ($note_($qq)_lab) ) ENDIF -LET blank = " " -LIST/NOHEAD/NOROW/FILE/APPEND/FORMAT=(A) blank - -! the default is set under 1/4 of Ferret's memory allowing for LET definitions -LET use_size = 1000000*($ferret_memory)/4. -LET max_size = ($MAX_LIST_SIZE"`use_size`") +! Set up the list of variables to plot. +IF ($feature_variable"0|*>1") THEN DEFINE SYMBOL list_vars = ($feature_variable), -IF `size* nlist GT max_size` THEN - IF `($ferret_memory"25.6") LT 300` THEN SET MEM/SIZ=300 - LET use_size = 1000000*($ferret_memory)/4. -ENDIF - -IF `size* nlist LE max_size` THEN -! -! ... list in one big chunk -! - IF `($ferret_format"0|asc>1|*>0") + ($ferret_format"0|txt>1|*>0") GT 0` THEN - IF ($var_history"0|*>1") THEN LIST/($list_quals)/NOHEAD/FORMAT=(A) var_hist - DEFINE SYMBOL list_quals = APPEND - ENDIF - - LIST/i=1:`size`/($list_quals)/FILE/($frmt) ($vars_out) +! If one of the variables is the feature-id or a coordinate variable, skip it. They will already be listed. +DEFINE SYMBOL icount = 0 +REPEAT/RANGE=1:($data_count) (\ + IF ($ferret_plot_var_($icount)%|($feature_variable"A_not_any_var")>1|*>0%) THEN CYCLE ;\ + IF ($ferret_plot_var_($icount)%|($dsg_x_var"A_not_any_var")>1|*>0%) THEN CYCLE ;\ + IF ($ferret_plot_var_($icount)%|($dsg_y_var"A_not_any_var")>1|*>0%) THEN CYCLE ;\ + IF ($ferret_plot_var_($icount)%|($dsg_z_var"A_not_any_var")>1|*>0%) THEN CYCLE ;\ + IF ($ferret_plot_var_($icount)%|($dsg_t_var"A_not_any_var")>1|*>0%) THEN CYCLE ;\ + DEFINE SYMBOL list_vars = ($list_vars) ($ferret_plot_var_($icount)) ;\ + IF `($icount) LT ($data_count)-1` THEN DEFINE SYMBOL list_vars = ($list_vars), ;\ + DEFINE SYMBOL icount = `($icount)+1`;\ + ) -ELSE - LET nchunk = INT(size/ max_size) - IF `nchunk LT 2` THEN LET nchunk = 2 - LET ichunk = INT(size/ nchunk) - LET i1 = 1 - LET i2 = `ichunk` - REPEAT/RANGE=1:`nchunk+1` ( \ - LIST/($list_quals)/FILE/($frmt)/I=`i1`:`i2` ($vars_out); \ - CANC MEM/ALL; \ - DEFINE SYMBOL list_quals = APPEND/NOHEAD; \ - LET i1 = `i2+1`; \ - LET i2 = `i2+ichunk`; \ - IF `i1 GT size` THEN EXIT/LOOP; \ - IF `i2 GT size` then LET i2 = size) +LIST/CLOBBER/($frmt)/PREC=7/FILE="($result_ferret_listing_filename)" ($list_vars) -ENDIF ! ----- End of list_prop_prop.jnl ------------------------------------------------ diff --git a/JavaSource/resources/ferret/scripts/list_traj_data.jnl b/JavaSource/resources/ferret/scripts/list_traj_data.jnl index fb1aa5adc..e3ac8b5d8 100644 --- a/JavaSource/resources/ferret/scripts/list_traj_data.jnl +++ b/JavaSource/resources/ferret/scripts/list_traj_data.jnl @@ -6,8 +6,9 @@ ! 12/2016 set list precision to 7 ! ! -! Called by Trajectory_Data_Convert_File.jnl -! Write csv data: date/time, X, Y, Z, var1, var2, ... +! Called by Trajectory_Data_Convert_File.jnl for "SAVE AS" to write csv +! or tsv data from a DSG dataset (trajectory, profile, or timeseries): +! date/time, X, Y, Z, var1, var2, ... ! Cannot list out a pseudo-variable, e.g. Z. In the loop, ! check for pseutonames. If the variable name is a pseudo-var name, @@ -20,103 +21,61 @@ GO LAS_initialize_region 0 GO LAS_initialize_data 0 GO LAS_setup_dsg -LET skip_names = {"($feature_variable)", "($rowvar)", "longitude", "latitude", \ -"time", "tmonth", "day_of_year", "sample_number", "lon360"} -IF ($custom_skip_listnames"0|*>1") THEN LET skip_names = {"($feature_variable)", "($rowvar)", ($custom_skip_listnames)} +LET skip_names = {"($feature_variable)", "($rowvar)", "($dsg_x_var)", "($dsg_y_var)", \ +"($dsg_t_var)", "tmonth", "lon360"} + +IF ($dsg_z_var"0|*>1") THEN LET skip_names = {"($feature_variable)", "($rowvar)", "($dsg_x_var)", "($dsg_y_var)", \ +"($dsg_z_var)", "($dsg_t_var)", "tmonth", "lon360"} -DEFINE SYMBOL vars_out = ($feature_variable), datetime, latitude, longitude -LET nlist = 4 + +IF ($custom_skip_listnames"0|*>1") THEN LET skip_names = {"($feature_variable)", "($rowvar)", ($custom_skip_listnames)} ! make the list of variables to write. If lon/lat variables have been ! expanded onto the X axis they may have been redefined and the file ! variables included in skip_list_var. ! Check here for pseudo-variable names such as K; replace with a Ferret-legal name. +LET nlist = 0 +CANCEL SYMBOl comma + LET nvars = ..nvars LET varnames = ..varnames -repeat/range=1:`nvars`/name=ivar (\ - DEFINE SYMBOL ivar = `ivar`; \ - DEFINE SYMBOL vname = `varnames[i=($ivar)]`; \ - IF `STRINDEX("($skip_list_var%99%)", "($vname)") GT 0` THEN EXIT/CYCLE; \ +REPEAT/RANGE=1:`nvars`/name=ivar (\ + DEFINE SYMBOL ivar = `ivar` ;\ + DEFINE SYMBOL vname = `varnames[i=($ivar)]` ;\ + IF `STRINDEX("($skip_list_var%99%)", "($vname)") GT 0` THEN EXIT/CYCLE ;\ GO LAS_check_for_pseudoname ($vname);\ IF ($isit_pseudo"0|*>1") THEN ;\ - SET VAR/NAME=($isit_pseudo) '($vname)';\ - DEFINE SYMBOL vname = ($isit_pseudo);\ + SET VAR/NAME=($isit_pseudo) '($vname)' ;\ + DEFINE SYMBOL vname = ($isit_pseudo) ;\ ENDIF;\ - IF `IS_ELEMENT_OF_STR_N("($vname)", skip_names) EQ 0` THEN GO reshape_list_var ($vname); \ - IF `IS_ELEMENT_OF_STR_N("($vname)", skip_names) EQ 0` THEN DEFINE SYMBOL vars_out = ($vars_out), ($vname); \ - IF `IS_ELEMENT_OF_STR_N("($vname)", skip_names) EQ 0` THEN LET nlist = `nlist+1`; \ + IF `IS_ELEMENT_OF_STR_N("($vname)", skip_names) EQ 0` THEN DEFINE SYMBOL vars_out = ($vars_out)($comma) ($vname) ;\ + IF ($vars_out"0|*>1") THEN DEFINE SYMBOl comma = , ;\ + IF `IS_ELEMENT_OF_STR_N("($vname)", skip_names) EQ 0` THEN LET nlist = `nlist+1` ;\ ) -! expand the feature ids to the obs axis. -GO reshape_list_var ($feature_variable) - -! Do we want the date string or the date coordinate? List dates. +! Do we want the date string or the date coordinate? Or both? List dates. IF `($ferret_timelab_res"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_timelab_res = minute -DEFINE SYMBOL t_units_string = `TIME.units` -LET nsince = `STRINDEX("($t_units_string)", "since")-1` -IF `nsince GT 0` THEN DEFINE SYMBOl tunits = `SUBSTRING("($t_units_string)", 1, nsince)` - -! Make a time axis from the time coordinates and use it to compute the date strings. -LET amin = time[i=@MIN] -LET amax = time[i=@MAX] -DEFINE SYMBOL is_time = 1 -GO LAS_is_range amin amax -DEFINE AXIS/T=`ax_lo`:`ax_hi`:`del_ax`/T0="`TIME.time_origin`"/units=($tunits) haxis - -LET/TITLE="Time String" datetime = TAX_DATESTRING (time, t[gt=haxis], "($ferret_timelab_res%($tunits)%)") - -! the default is set under 1/4 of Ferret's memory allowing for LET definitions -LET use_size = 1000000*($ferret_memory)/4. -LET max_size = ($MAX_LIST_SIZE"`use_size`") - -! Size of the data variable -LET size = `obsXvar,RETURN=isize` - -IF `size* nlist GT max_size` THEN - IF `($ferret_memory"25.6") LT 300` THEN SET MEM/SIZ=300 - LET use_size = 1000000*($ferret_memory)/4. -ENDIF +SET MODE CALENDAR:($ferret_timelab_res) SET LIST/PREC=7 SET LIST/FILE="($result_ferret_listing_filename)" +! Size of the data variable +LET size = `($dsg_x_var),RETURN=isize` + +sp rm ($result_ferret_listing_filename) IF ($dataset_title_att"0|*>1") THEN LIST/NOHEAD/NOROW/FILE/CLOBBER/FORMAT=("($dataset_title_att)"/"Total Number of Records", F16.0) SIZE ELSE - LIST/NOHEAD/NOROW/FILE/APPEND/FORMAT=(Total Number of Records", F16.0) SIZE + LIST/NOHEAD/NOROW/FILE/CLOBBER/FORMAT=("Total Number of Records", F16.0) SIZE ENDIF DEFINE SYMBOL list_quals = APPEND -IF `size* nlist LE max_size` THEN -! -! ... list in one big chunk -! - IF `($ferret_format"0|asc>1|*>0") + ($ferret_format"0|txt>1|*>0") GT 0` THEN - IF ($var_history"0|*>1") THEN LIST/($list_quals)/NOHEAD/FORMAT=(A) var_hist - DEFINE SYMBOL list_quals = APPEND - ENDIF - - LIST/($list_quals)/FILE/($frmt) ($vars_out) +LIST/($list_quals)/FILE/($frmt) ($vars_out) -ELSE - LET nchunk = INT(size/ max_size) - IF `nchunk LT 2` THEN LET nchunk = 2 - LET ichunk = INT(size/ nchunk) - LET i1 = 1 - LET i2 = `ichunk` - REPEAT/RANGE=1:`nchunk+1` ( \ - LIST/($list_quals)/FILE/($frmt)/I=`i1`:`i2` ($vars_out); \ - CANC MEM/ALL; \ - DEFINE SYMBOL list_quals = APPEND/NOHEAD; \ - LET i1 = `i2+1`; \ - LET i2 = `i2+ichunk`; \ - IF `i1 GT size` THEN EXIT/LOOP; \ - IF `i2 GT size` then LET i2 = size) - -ENDIF -! End of script ---------- list_csv_data.jnl---------------------------- +! End of script ---------- list_traj_data.jnl---------------------------- diff --git a/JavaSource/resources/ferret/scripts/make_c_lab.jnl b/JavaSource/resources/ferret/scripts/make_c_lab.jnl index a53295953..b0ac59c0c 100644 --- a/JavaSource/resources/ferret/scripts/make_c_lab.jnl +++ b/JavaSource/resources/ferret/scripts/make_c_lab.jnl @@ -86,12 +86,24 @@ IF ($math_sym_convert"1|no_convert>0") THEN GO op_math_sym ($translate_math) ($o DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhs) ! Show time constraint as a formatted time +! Currently we do not have any products that do a constraint in time. + IF `($lhs"|time>1|TIME>1|*>0")` THEN IF `($timevar"0|*>1") EQ 0` THEN DEFINE SYMBOL timevar = time CANCEL SYMBOL rhsdate IF `($timeaxis"0|*>1") EQ 0` THEN - LET amin = ($timevar)[i=@MIN] - LET amax = ($timevar)[i=@MAX] + DEFINE SYMBOL shape `($timevar),RETURN=shape` + LET amin = ($timevar)[($shape)=@MIN] + LET amax = ($timevar)[($shape)=@MAX] + + ! Is this a multi-feature timeseries dataset? If so @MIN and @MAX are for each timeseries + DEFINE SYMBOL eshape `amin,RETURN=shape` + IF ($eshape"0|E>1|*>0") THEN + LET amin_featr = ($timevar)[($shape)=@MIN] + LET amax_featr = ($timevar)[($shape)=@MAX] + LET amin = `amin_featr[e=@min]` + LET amax = `amax_featr[e=@max]` + ENDIF DEFINE SYMBOL is_time = 1 GO LAS_is_range amin amax CANCEL SYMBOL is_time @@ -103,18 +115,19 @@ IF `($lhs"|time>1|TIME>1|*>0")` THEN DEFINE AXIS/T=`ax_lo`:`ax_hi`:`del_ax`/T0="`($data_t_var"time").time_origin`"/units=($tunits) timeaxis DEFINE SYMBOl timeaxis = timeaxis ENDIF + LET tt = t[gt=($timeaxis)] LET nt = `tt,RETURN=lsize` LET tn = tt[L=`nt`] DEFINE SYMBOL tn = `tn` IF `($rhs) GE tt[L=1] AND ($rhs) LE ($tn)` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[t=($rhs)], tt, "hours")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[t=($rhs)], tt, "minutes")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ELIF `($rhs) LT tt[L=1]` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[L=1], tt, "hours")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[L=1], tt, "minutes")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ELIF `($rhs) GT ($tn)` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( ($tn), tt, "hours")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( ($tn), tt, "minutes")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ENDIF IF ($rhsdate"0|*>1") THEN DEFINE SYMBOL rhs ($rhsdate) diff --git a/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl b/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl index b1101791f..f72982c1d 100644 --- a/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl +++ b/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl @@ -7,9 +7,15 @@ DEFINE SYMBOL ferret_thumb_qc2 = 1 ! Dont use finest-resolution map underlay. LET/UNITS="`longitude,RETURN=units`"/TITLE="`longitude,RETURN=title`" lon = longitude LET/UNITS="`latitude,RETURN=units`"/TITLE="`latitude,RETURN=title`" lat = latitude -LET amin = `min(lon[i=@MIN]-5, 180)` -LET amax = `max(lon[i=@MAX]+5, -180)` +DEFINE SYMBOL lonlatshape = `lon,RETURN=shape` +IF ($lonlatshape"|POINT>1|*>0") THEN + LET amin = `min(lon-5, 180)` + LET amax = `max(lon+5, -180)` +ELSE + LET amin = `min(lon[($lonlatshape)=@MIN]-5, 180)` + LET amax = `max(lon[($lonlatshape)=@MAX]+5, -180)` +ENDIF GO LAS_is_range amin amax LET xax_lo = ($ppl$range_low) @@ -19,8 +25,13 @@ LET xax_del = ($ppl$range_inc) LET varnames = ..varnames IF `IS_ELEMENT_OF_STR(varnames, "lon360") GT 0` THEN - LET amin = `min(lon[i=@MIN]-5, 360)` - LET amax = `max(lon[i=@MAX]+5, 0)` + IF ($lonlatshape"|POINT>1|*>0") THEN + LET amin = `min(lon-5, 360)` + LET amax = `max(lon+5, 0)` + ELSE + LET amin = `min(lon[($lonlatshape)=@MIN]-5, 360)` + LET amax = `max(lon[($lonlatshape)=@MAX]+5, 0)` + ENDIF GO LAS_is_range amin amax @@ -41,8 +52,14 @@ IF `ABS(xax_hi - xax_lo) LT 1` THEN DEFINE SYMBOL dm_labels = dm IF `ABS(xax_hi - xax_lo) LT 0.06` THEN DEFINE SYMBOL dm_labels = dms DEFINE AXIS/x=`xax_lo`:`xax_hi`:`del_ax`/units="($lon_units%degrees_east%)" haxis -LET amin = `max(lat[i=@MIN]-5, -90)` -LET amax = `min(lat[i=@MAX]+5, 90)` +IF ($lonlatshape"|POINT>1|*>0") THEN + LET amin = `max(lat-5, -90)` + LET amax = `min(lat+5, 90)` +ELSE + LET amin = `max(lat[($lonlatshape)=@MIN]-5, -90)` + LET amax = `min(lat[($lonlatshape)=@MAX]+5, 90)` +ENDIF + GO LAS_is_range amin amax LET yax_lo = ($ppl$range_low) @@ -77,15 +94,19 @@ GO LAS_fland ($land_palette) DEFINE SYMBOL symquals = /SIZE=0.12/THICK=1 STAT lon -LET lonconst = `($stat_std) LT 0.1` +LET lonconst = `($stat_std"|bad>0.01|*") LT 0.1` STAT lat -LET latconst = `($stat_std) LT 0.1` +LET latconst = `($stat_std"|bad>0.01|*") LT 0.1` IF `lonconst + latconst EQ 2` THEN DEFINE SYMBOL symquals = /SIZE=0.3/THICK=3 +! needed for annotations file +IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) +IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) + + IF ($zvar"0|*>1") THEN RIBBON/VS/OVER/NOLAB/KEY=HORIZ,CONT,CENT/SYM=17($symquals)/\ PALETTE=($ferret_palette"red")/LEVELS=($ferret_fill_levels"v") lon, lat, ($zvar) ELSE PLOT/VS/OVER/NOLAB/NOKEY/SYM=17($symquals)/COLOR=($lonlatcolor"red") lon, lat ENDIF - diff --git a/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl b/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl index e189742c6..a176b12e0 100644 --- a/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl +++ b/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl @@ -9,6 +9,7 @@ ! 11/2017 back off finding direction variables based on attributes for now ! 12/2017 changes for efficiency getting variable types ! 1/2018 Time will only be the independent variable - no vertical time axis. +! 8/2020 Updates for working with DSG datasets ! prop_prop_plot.jnl creates a property-property plot, using the ! data variable in symbol data_0_var and the second variable from @@ -28,8 +29,7 @@ GO LAS_initial_setup DEFINE SYMBOL its_prop_plot = 1 DEFINE SYMBOL its_insitu = 1 - -DEFINE SYMBOL ribbon = 1 +LET color_by_feature = 0 ! For LAS v8.0 relese, dont take into account any of these Ferret properties. ! This is a workaround for items 3 and 4 in ticket 1388; the issues will be @@ -39,7 +39,10 @@ CANCEL SYMBOL ferret_fill_levels CANCEL SYMBOL ferret_contour_levels CANCEL SYMBOL ferret_palette -!DEFINE SYMBOL ferret_fill_levels = v +! pale gray line for underlay +SET MODE linecolors:7 +PPL color, 7, 90, 90, 90 !gray + ! Initialize data and variables ! Set up masks for constraints @@ -47,10 +50,9 @@ CANCEL SYMBOL ferret_palette GO setup_prop_prop - ! Check for data types ! 3/16/17 Make this more robust, if there are regions etc on the ferret_plot_var_* -! variables the RETURN=dtypemay fail. +! variables the RETURN=dtype may fail. LET gettype = ($ferret_plot_var_0_small%($ferret_plot_var_0)%) DEFINE SYMBOL vtype = `gettype,RETURN=dtype` @@ -67,6 +69,7 @@ IF ($error_string"0|*>1") THEN EXIT/PROGRAM ENDIF + ! Open the window, apply size, scale options ! dont want to set the aspect ratio using xy region, so reset @@ -86,18 +89,9 @@ IF ($ferret_use_graticules"0|0|*>1) THEN SET MODE GRATICULE:(DASH=(0.1,0.04,0.1,0.04),COLOR=black) ENDIF -! This may be a polygon plot. Options for color, shape, size. - -DEFINE SYMBOL polycolor = ($ferret_symbol_color%black|default>black|black|red|blue|green|lightblue|purple|*>blue%) -DEFINE SYMBOL polysize = ($ferret_symbol_size%0.6|default>*0.6|*%) -DEFINE SYMBOL polyshape = ($ferret_symbol_shape%triangle|default>triangle|triangle|delta\ -|square|diamond|pentagon|hexagon|circle|star|plus|ex|*>triangle%) - -!DEFINE SYMBOL ferret_plot_title = " " - ! Set the plot argument. DEFINE SYMBOL plot_arg = ($xvar), ($yvar) - +DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var DEFINE SYMBOL qualifiers = ($qualifiers)/NOLAB IF `($ferret_thumb"0|*>1") AND ($data_count"0") LE 2` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=red @@ -137,7 +131,7 @@ IF `($ferret_thumb"0|0|*>1") AND \ DEFINE SYMBOL lonlatcolor = RED GO prop_prop_map_thumb -! notation with number of cruises, trajectories, or profiles and obs. +! notation with number of timeseries, trajectories, or profiles and obs. GO feature_labels ! Save the results @@ -169,194 +163,164 @@ ENDIF ! If this is a Watch Circle plot, set that up. ! This is a hack, which can be generalized with properties or attributes. +LET itsa_lon_prop = 0 +LET itsa_lat_prop = 0 +LET itsa_tim_prop = 0 +LET itsa_lon_plot = 0 +LET itsa_lat_plot = 0 +LET itsa_tim_plot = 0 +LET itsa_map_plot = 0 + + GO setup_watch_circle -IF `its_watch_circle EQ 0` THEN GO LAS_xytvar_setup +IF `its_watch_circle EQ 0` THEN + IF ($dsgshape"0|*>1") THEN + GO LAS_xytvar_setup + ELSE + GO LAS_xytvar_griddat_setup + ENDIF +ENDIF -IF ($put_label"0|*>1") THEN DEFINE SYMBOL all_missing = 1 +IF `($ngood_data"0|*") EQ -1` THEN + GO LAS_results box + EXIT/SCRIPT +ENDIF + +DEFINE SYMBOL xvar = constraints_mask*xvar +DEFINE SYMBOL yvar = constraints_mask*yvar +LET x_plot_var = ($xvar) +LET y_plot_var = ($yvar) +IF `($data_count"0") GT 2` THEN + DEFINE SYMBOL zvar = constraints_mask*zvar + LET z_plot_var = ($zvar) +ENDIF + + +! compute # points plotted after mask applied -DEFINE SYMBOL plot_arg = ($xvar), ($yvar), 0 +LET compute_good = ($xvar)* ($yvar) -LET compute_good = ($xvar)* ($yvar) -IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `compute_good[i=@ngd]` -IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `compute_good[i=@nbd]` -IF ($ribbon"0") THEN DEFINE SYMBOL plot_arg = ($xvar), ($yvar) IF `($data_count"0") GT 2` THEN - DEFINE SYMBOL plot_arg = ($xvar), ($yvar), ($zvar) - LET compute_good = ($xvar)* ($yvar)* ($zvar) - IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `compute_good[i=@ngd]` - IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `compute_good[i=@nbd]` + DEFINE SYMBOL ztyp = `($zvar),return=dtype` + IF `($ztyp"0|FLOAT>1|*>0") AND ($zshape"0|POINT>0|($shape)>1|*>0")` THEN \ + LET compute_good = ($xvar)* ($yvar)* ($zvar) ENDIF +STAT compute_good +DEFINE SYMBOL shape = `compute_good,RETURN=shape` +DEFINE SYMBOL ngood_data = ($stat_ngood) +DEFINE SYMBOL nbad_data = ($stat_nbad) -IF `($all_missing"0") EQ 0` THEN +IF ($put_label"0|*>1") THEN DEFINE SYMBOL all_missing = 1 +IF `($ngood_data) EQ 0` THEN DEFINE SYMBOL all_missing = 1 + +DEFINE SYMBOL plot_arg = ($xvar), ($yvar) +DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var +sh sym xvar, yvar, zvar +sh var xvar,yvar -! If a time axis was defined, set symbols in the original time units for the map scale file. -!IF ($timeaxis"0|haxis>1|*>0) THEN -! DEFINE SYMBOL xaxis_min = `ax_lo` -! DEFINE SYMBOL xaxis_max = `ax_hi` -!ENDIF -!IF ($timeaxis"0|vaxis>1|*>0) THEN -! DEFINE SYMBOL yaxis_min = `ax_lo` -! DEFINE SYMBOL yaxis_max = `ax_hi` -!ENDIF +IF `($data_count"0") GT 2` THEN DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var, z_plot_var -DEFINE SYMBOL qualifiers = ($qualifiers)/OVER -IF ($ribbon"0|*>1") THEN +IF `($all_missing"0") EQ 0` THEN !!!! or all the way to the bottom of this script ! ... let symbol size gradually increase as no. of obs gets small - DEFINE SYMBOL size_creep_factor `(($ngood_data)+300)/(($ngood_data)+100) - 1` ! [0,1] range - LET sym_factr = 0.9 + 1.5*($size_creep_factor) +DEFINE SYMBOL size_creep_factor `(($ngood_data)+300)/(($ngood_data)+100) - 1` ! [0,1] range +LET sym_factr = 0.9 + 1.5*($size_creep_factor) - DEFINE SYMBOL plot_command = PLOT/OVER/NOLAB/VS/sym=17/SIZE=`.12*sym_factr` - DEFINE SYMBOL underlay_command = PLOT/OVER/NOLAB/VS/sym=17/COLOR=6/SIZE=`.08*sym_factr` +DEFINE SYMBOL plot_command = PLOT/NOLAB/VS/sym=17/SIZE=`.12*sym_factr` +DEFINE SYMBOL underlay_command = PLOT/NOLAB/RIBBON/VS/sym=17/palette=gray_light/NOKEY/SIZE=`.08*sym_factr` +DEFINE SYMBOL underlay_vars = x_plot_var, y_plot_var, y_plot_var -! Fewer and larger symbols, use thicker line - IF `.12*sym_factr GT 0.3` THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=3 - DEFINE SYMBOL underlay_command = PLOT/OVER/NOLAB/VS/sym=17/COLOR=6/SIZE=`.08*sym_factr`/THICK=3 - ELIF `.12*sym_factr GT 0.16` THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=2 - DEFINE SYMBOL underlay_command = PLOT/OVER/NOLAB/VS/sym=17/COLOR=6/SIZE=`.08*sym_factr`/THICK=2 - ENDIF - DEFINE SYMBOL plot_end_command = PLOT/OVER - IF `($data_count"0") GT 2` THEN - IF ($color_by_levels"0|*>1") THEN DEFINE SYMBOL ferret_fill_levels = ($color_by_levels) - DEFINE SYMBOL plot_command = ($plot_command)/RIBBON/LEVELS=($ferret_fill_levels"v")/pal=default/MISSING=blank - DEFINE SYMBOL plot_end_command = RIBBON/OVER - ENDIF +! gray dashed line underlying trajectories or time series + +DEFINE SYMBOL under_line = /VS/LINE=6/DASH=(0.1,0.04,0.1,0.04)/NOLAB($vlim) x_plot_var, y_plot_var +IF `itsa_map_plot` THEN + DEFINE SYMBOL under_line = /pal=gray_light/DASH=(0.1,0.04,0.1,0.04)/NOLAB($vlim) x_plot_var + DEFINE SYMBOL underlay_command = ($underlay_command)/OVER +ENDIF + +! Set up gray dash line and underly of gray symbols as simple line plots not ribbon plots +! Make the time coordinate variable the first argument for the ribbon plot so the scaling is right. + +IF `itsa_tim_prop AND ($connect_dots"0|0|1|*>1")` THEN !! not a /VS plot. + DEFINE SYMBOL under_line = /COLOR=7/DASH=(0.1,0.04,0.1,0.04)/NOLAB($vlim) y_plot_var + DEFINE SYMBOL underlay_command = PLOT/NOLAB/sym=17/COLOR=7/NOKEY/SIZE=`.08*sym_factr`/THICK=1 + DEFINE SYMBOL underlay_vars = y_plot_var + + DEFINE SYMBOL plot_arg = ($data_0_var), ($data_1_var), z_plot_var ENDIF -IF `($ribbon"0") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/LINE + +! Fewer and larger symbols, use thicker line +IF `.12*sym_factr GT 0.3` THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=3 + DEFINE SYMBOL underlay_command = ($underlay_command)/THICK=3 +ELIF `.12*sym_factr GT 0.16` THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=2 + DEFINE SYMBOL underlay_command = ($underlay_command)/THICK=2 +ENDIF +DEFINE SYMBOL plot_end_command = PLOT +IF `($data_count"0") GT 2` THEN + IF ($color_by_levels"0|*>1") THEN DEFINE SYMBOL ferret_fill_levels = ($color_by_levels) + DEFINE SYMBOL plot_command = ($plot_command)/RIBBON/LEVELS=($ferret_fill_levels"v") + DEFINE SYMBOL plot_end_command = RIBBON +ENDIF LET x_plot_var = ($xvar) LET y_plot_var = ($yvar) +IF `($data_count"0") GT 2` THEN LET z_plot_var = ($zvar) + +LET have_constr = `constraints_mask,RETURN=isready` +IF `have_constr EQ 0` THEN LET constraints_mask = 1 -IF ($color_by_feature"0|*>1") THEN +IF `color_by_feature` THEN GO LAS_pp_colorby_feature ! put_label has been set if all data is missing or constraints return no data. +ELIF ($ferret_thumb"0|*>1") THEN + IF `itsa_tim_prop ` THEN + PLOT/color=red/sym=17/title=" "/set y_plot_var + ppl ylab "($ferret_title_1)" + go unlabel ($labnum_x) + go unlabel ($labnum_e) + go unlabel ($labnum_dset) + go unlabel ($labnum_datitl) + PPL PLOT + ELSE + PLOT/VS/color=red/sym=17/title=" "/set x_plot_var, y_plot_var + ppl xlab "($ferret_title_0)" + ppl ylab "($ferret_title_1)" + go unlabel ($labnum_x) + go unlabel ($labnum_e) + go unlabel ($labnum_dset) + go unlabel ($labnum_datitl) + PPL PLOT + ENDIF ELSE - IF ($color_by"0|*>1") THEN - IF ($rowvar"0|*>1") THEN - - LET pxvar = constraints_mask* ($ferret_plot_var_0) - IF ($pvar_reset"0|*>1") THEN LET pxvar = constraints_mask* ($pvar_reset) ! see LAS_xytvar_setup - LET qyvar = constraints_mask* ($ferret_plot_var_1) - - LET var_data = idvar - - DEFINE SYMBOL data_x_var = pxvar - DEFINE SYMBOL data_y_var = qyvar - DEFINE SYMBOL data_var = zvar - - LET ranger = MINMAX(pxvar) - - DEFINE SYMBOL range2 = `ranger[i=2]` - DEFINE SYMBOL range1 = `ranger[i=1]` - IF `($range2"|bad>1|*>0) OR ($range1"|bad>1|*>0)` THEN - LET tol1 = 0.1 - ELIF `ABS(($range2"|bad>1|*")) GT 1.e20 OR ABS(($range1"|bad>1|*")) GT 1.e20` THEN - LET tol1 = 0.1 - ELSE - LET tol1 = `0.1* (ranger[i=2] - ranger[i=1])` - IF `tol1 LT 1.e-6` THEN LET tol1 = 1.e-6 - ENDIF - - LET ranger = MINMAX(qyvar) - DEFINE SYMBOL range2 = `ranger[i=2]` - DEFINE SYMBOL range1 = `ranger[i=1]` - IF `($range2"|bad>1|*>0) OR ($range1"|bad>1|*>0)` THEN - LET tol1 = 0.1 - ELIF `ABS(($range2"|bad>1|*")) GT 1.e20 OR ABS(($range1"|bad>1|*")) GT 1.e20` THEN - LET tol1 = 0.1 - ELSE - LET tol2 = `0.1* (ranger[i=2] - ranger[i=1])` - IF `tol2 LT 1.e-6` THEN LET tol2 = 1.e-6 - ENDIF - - LET ranger = MINMAX(zvar) - DEFINE SYMBOL range2 = `ranger[i=2]` - DEFINE SYMBOL range1 = `ranger[i=1]` - IF `($range2"|bad>1|*>0) OR ($range1"|bad>1|*>0)` THEN - LET tol3 = 0.1 - ELIF `ABS(($range2"|bad>1|*")) GT 1.e20 OR ABS(($range1"|bad>1|*")) GT 1.e20` THEN - LET tol3 = 0.1 - ELSE - LET tol3 = `0.1* (ranger[i=2] - ranger[i=1])` - IF `tol3 LT 1.e-6` THEN LET tol2 = 1.e-6 - ENDIF - -! This script separates the cruises putting a gap between. -! Call if first 2 variables are longitude and latitude. Symbol -! connect_dots is set if the underlay is a map or if its a time series plot. - - IF ($connect_dots"0|*>1") THEN - DEFINE SYMBOL data_x_var = ($data_0_var)* constraints_mask - DEFINE SYMBOL data_y_var = ($data_1_var)* constraints_mask - GO setup_dsg_variables 200000 tol1 tol2 tol3 - LET constraints_mask_var = SEPARATE(constraints_mask, ($rowvar), 0) - LET feature_size = `($rowvar),return=msize` - IF `feature_size EQ 1` THEN LET constraints_mask_var = constraints_mask - - DEFINE SYMBOL xvar = ($data_x_var)* constraints_mask_var - DEFINE SYMBOL yvar = ($data_y_var)* constraints_mask_var - LET x_plot_var = ($xvar) - IF ($lon_units"0|*>1") THEN LET/units=($lon_units) x_plot_var = ($xvar) - LET y_plot_var = ($yvar) - DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var, ($data_var)* constraints_mask_var - ENDIF - - LET pvar = ($data_x_var) - LET qvar = ($data_y_var) - LET dvar = ($data_var) - - ELSE ! IF ($rowvar) - LET nout_lonlat = `zvar[i=@ngd]` ! ?? - DEFINE SYMBOL nout_lonlat = `nout_lonlat` - ENDIF ! IF ($rowvar) - ! Get color-plot qualifiers DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") - IF ($ferret_plot_key"0|0|nokey>1|*>0") THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY - DEFINE SYMBOL dokey = 0 - ELSE - IF `STRINDEX(UPCASE("($qualifiers)"), "/KEY") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY - DEFINE SYMBOL dokey = 1 - ENDIF + IF `($ngood_data"0") GT 0` THEN + IF ($ferret_plot_key"0|0|nokey>1|*>0") THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY + DEFINE SYMBOL dokey = 0 + ELSE + IF `STRINDEX(UPCASE("($qualifiers)"), "/KEY") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY + DEFINE SYMBOL dokey = 1 + ENDIF -! Dont use the palette coming in. Its for variable 0 - DEFINE SYMBOL qualifiers = ($qualifiers)/PALETTE=($ferret_palette"default|*>*) + IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT - IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT + ENDIF DEFINE SYMBOL color_by_title = `zvar,RETURN=title` - ELSE ! IF ($color_by) + ELSE DEFINE SYMBOL qualifiers = ($qualifiers)/palette=($polycolor) -! Need to separate the different trajectories for 2-variable time series or map plots - IF ($connect_dots"0|*>1") THEN - DEFINE SYMBOL data_x_var = ($data_0_var) - DEFINE SYMBOL data_y_var = ($data_1_var) - DEFINE SYMBOL data_var = ($data_y_var) !just so its defined. - GO setup_dsg_variables 200000 tol1 tol2 tol3 - LET constraints_mask_var = SEPARATE(constraints_mask, ($rowvar), 0) - LET feature_size = `($rowvar),return=msize` - IF `feature_size EQ 1` THEN LET constraints_mask_var = constraints_mask - - DEFINE SYMBOL xvar = ($data_x_var)* constraints_mask_var - DEFINE SYMBOL yvar = ($data_y_var)* constraints_mask_var - LET x_plot_var = ($xvar) - IF ($lon_units"0|*>1") THEN LET/units=($lon_units) x_plot_var = ($xvar) - LET y_plot_var = ($yvar) - DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var, ($data_var)* constraints_mask_var - ENDIF - ENDIF ! IF ($color_by) IF `($ferret_annotations%0|*>1%) EQ 0` THEN @@ -365,13 +329,26 @@ ELSE ENDIF ! on lat/lon plots, draw a gray line on the cruise tracks. - IF `($connect_dots"0|0|1|*>1")` THEN PLOT/NOAX/VS/OVER/LINE=6/DASH=(0.1,0.04,0.1,0.04)/NOLAB x_plot_var, y_plot_var + IF `itsa_map_plot OR ($watch_plot"0|*>1") AND ($connect_dots"0|0|1|*>1") ` THEN PLOT/OVER($under_line) + + if ($watch_plot"0|*>1") THEN DEFINE SYMBOL underlay_command = ($underlay_command)/over/nolab/noaxis + +! on time plots, draw a gray line. This is the first plot, drawing the time axis + IF `itsa_tim_prop ` THEN PLOT($under_line) -! ?? show locations where the color-by variable is missing... - IF `($data_count"0") GT 2` THEN ($underlay_command) x_plot_var, y_plot_var +! show locations where the color-by variable is missing. This way all missing data +! is underneath good data but PLOT/RIBBON/MISSING=gray can plot lots of missing pts over +! valid ones from data already on the page + + PPL COLOR,6,60,60,60 ! grey + IF `($data_count"0") GT 2 AND itsa_map_plot EQ 0 AND ($watch_plot"0|*>1") EQ 0` THEN + ($underlay_command)/set ($underlay_vars) + IF ($ax_label_x"0|*>1") THEN PPL xlab ($ax_label_x) + IF ($ax_label_y"0|*>1") THEN PPL ylab ($ax_label_y) + PPL PLOT + ENDIF DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/SET - DEFINE SYMBOL poly_command POLYGON($qualifiers) ! If the color-by variable has units of "count", set up color levels and palette appropriately. @@ -390,26 +367,24 @@ ELSE DEFINE SYMBOL qualifiers = ($qualifiers)/levels=($ferret_fill_levels)/KEY=CENTER/palette=($ferret_palette) ENDIF - IF ($ribbon"0") THEN - ($plot_command)($qualifiers) ($plot_arg) - IF `($ferret_annotations%0|*>1%) AND ($dokey"0|1>1|*>1")` THEN GO key_at_top - ($ax_label_resize) - PPL ($plot_end_command) - ELSE - GO polymark ($poly_command) ($plot_arg), ($polyshape), ($polysize) - IF ($ferret_annotations%0|*>1%) THEN GO key_at_top - ($ax_label_resize) - PPL POLYGON/OVER - ENDIF -ENDIF ! color-by-trajectory or not... + IF `STRINDEX("($qualifiers)", "palette") EQ 0` THEN \ + DEFINE SYMBOL qualifiers = ($qualifiers)/palette=($ferret_palette"default|*>*) + + IF `STRINDEX("($qualifiers)", "OVER") GT 0` THEN DEFINE SYMBOL plot_end_command ($plot_end_command)/OVER + ($plot_command)($qualifiers) ($plot_arg) + IF `($ferret_annotations%0|*>1%) AND ($dokey"0|1>1|*>1")` THEN GO key_at_top + ($ax_label_resize) + PPL ($plot_end_command) + +ENDIF ! color-by-feature or not... + ! This allows for auto-levels on prop-prop plots. IF ($color_by"0|*>1") THEN - LET data_range = minmax(constraints_mask*zvar) + LET data_range = MINMAX(constraints_mask*zvar) DEFINE SYMBOL data_plotted_min = `data_range[i=1],prec=7` DEFINE SYMBOL data_plotted_max = `data_range[i=2],prec=7` ENDIF - IF `($color_by_title"0|*>1") AND ($ferret_annotations%0|*>1%) EQ 0` THEN \ LABEL/NOUSER `($ppl$width)-($ppl$xorg)-0.2`, -0.7, 1, 0, 0.12 Colored by ($color_by_title) @@ -422,18 +397,28 @@ IF `($color_by_title"0|*>1") AND ($ferret_annotations%0|*>1%) EQ 0` THEN \ LET p = ($xvar) ! for regression line LET q = ($yvar) -LET do_rsquare = 1 -DEFINE SYMBOL line_color = blue ! regression line -IF ($polycolor%0|blue>1|*>0%) THEN DEFINE SYMBOL line_color = red +IF `itsa_map_plot or itsa_tim_prop` THEN DEFINE SYMBOL do_rsquare = 0 -GO LAS_regressx +! ~ 85 points gives a confidence of 0.8 -IF `(p[i=@NGD] LE 1)` THEN DEFINE SYMBOL do_rsquare = 0 +IF `($do_rsquare"1|0|*>1) AND ($ngood_data"0") LT 85` THEN + DEFINE SYMBOL do_rsquare = 0 + IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/COLOR=blue moveable + DEFINE SYMBOL rsqlab = Too few points to compute + LET wid = `LABWID("($rsqlab)", 0.1)` + LABEL/NOUSER -0.5,-0.42,-1, 0, 0.1, Too few points to compute + LABEL/NOUSER -0.5,-0.6,-1, 0, 0.1, regression line +ENDIF + +DEFINE SYMBOL line_color = blue ! regression line +IF ($polycolor%0|blue>1|*>0%) THEN DEFINE SYMBOL line_color = red ! Note do_rsquare is set in LAS_xytvar_setup, where plots with time, lon, or ! lat axes are set to NOT draw the regression line. + IF ($do_rsquare"1|0|*>1) THEN + GO LAS_regressx ! Note that qhat in the regress script is defined as ! LET qhat = slope*p + intercep @@ -441,19 +426,25 @@ IF ($do_rsquare"1|0|*>1) THEN LET qhatmasked = slope*pmasked + intercep - LET pminmax = MINMAX(pmasked) - LOAD pminmax - DEFINE SYMBOL P1 = `pminmax[i=1]` - DEFINE SYMBOL P2 = `pminmax[i=2]` - LET p1 = `pminmax[i=1]` - LET p2 = `pminmax[i=2]` + DEFINE SYMBOL shape = `p,RETURN=shape` + LET amin = p[($shape"X")=@min] + LET amax = p[($shape"X")=@max] + + + DEFINE SYMBOL P1 = `amin[m=@min]` + DEFINE SYMBOL P2 = `amax[m=@max]` + LET p1 = ($p1) + LET p2 = ($p2) LET qminmax = MINMAX(qhatmasked) - LOAD qminmax - DEFINE SYMBOL q1 = `qminmax[i=1]` - DEFINE SYMBOL q2 = `qminmax[i=2]` - LET q1 = `qminmax[i=1]` - LET q2 = `qminmax[i=2]` + + DEFINE SYMBOL shape = `qhatmasked,RETURN=shape` + LET amin = qhatmasked[($shape"X")=@min] + LET amax = qhatmasked[($shape"X")=@max] + DEFINE SYMBOL q1 = `amin[m=@min]` + DEFINE SYMBOL q2 = `amax[m=@max]` + LET q1 = ($q1) + LET q2 = ($q2) ! Are any of these values bad? If so just skip drawing the slope line. IF `($p1"0|bad>0|*>1") + ($p2"0|bad>0|*>1") + ($q1"0|bad>0|*>1") + ($q2"0|bad>0|*>1") EQ 4` THEN @@ -484,8 +475,13 @@ IF ($do_rsquare"1|0|*>1) THEN ENDIF -ENDIF ! all_missing or not... +ELSE ! all_missing, make a nominal plot so LAS_results has something to work with + plot/vs/nolab/noax/sym=dot/vlim=-1:1/hlim=-1:1 {-2,2}, {-2,2} + +ENDIF + +show data/att; pause ! notation with number of cruises, trajectories, or profiles and obs. GO feature_labels @@ -499,7 +495,8 @@ IF `($n_right_labels"0") GT 0 OR ($n_left_labels"0") GT 0` THEN GO labels_above_ ! If it's a color-by-ID plot, make the webrowset file for the cruise key -IF ($color_by_feature"0|*>1") THEN GO feature_key + +IF `color_by_feature EQ 1` THEN GO feature_key ! Save the results @@ -511,8 +508,6 @@ IF ($note_num"0|*>1") THEN ) ENDIF - GO LAS_results box ! ----- End of prop_prop_plot.jnl ------------------------------------------------ - diff --git a/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl b/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl index 73320690d..bc5056e38 100644 --- a/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl +++ b/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl @@ -77,3 +77,5 @@ IF ($ferret_annotate_with"0|*>1") THEN ENDIF !-----------------End of set_constraint_labels --------------------------------- + +pause diff --git a/JavaSource/resources/ferret/scripts/set_linesym.jnl b/JavaSource/resources/ferret/scripts/set_linesym.jnl index b276b2255..3c1ffde8a 100644 --- a/JavaSource/resources/ferret/scripts/set_linesym.jnl +++ b/JavaSource/resources/ferret/scripts/set_linesym.jnl @@ -50,10 +50,18 @@ ELSE let ngood = plotvar[($getgood)] let nbad = plotvar[($getbad)] + + IF ($dsgshape"0|*>1") THEN + stat plotvar + LET ngood = ($stat_ngood) + let nbad = ($stat_nbad) + ENDIF + ENDIF ! curvilinear or not LET npoints = ngood + nbad -list npoints + + LET nminpts = 120 IF ($itsa_multi_lineplot"0|*>1") THEN LET nminpts = 15 diff --git a/JavaSource/resources/ferret/scripts/setup_dsg_variables.jnl b/JavaSource/resources/ferret/scripts/setup_dsg_variables.jnl index f3a151202..b6b4f5da5 100644 --- a/JavaSource/resources/ferret/scripts/setup_dsg_variables.jnl +++ b/JavaSource/resources/ferret/scripts/setup_dsg_variables.jnl @@ -1,32 +1,16 @@ ! setup_dsg_variables.jnl ! -! Redefine data_var, data_x_var, data_y_var -! * Insert gaps between cruises -! * Fix longitudes crossing the dateline. -! See piecewise_linear_decimation.jnl which calls this script -! and computes piecewise linear decimation -! 8/2016 *acm* If the Ferret property traj_discrete has been set, check -! whether the distance between points is large; if so plot as discrete -! points connected with a thin line. -! 4/3/2017 *acm* Additions for point data types -! 2/2020 Check for existence of global attributes before using global_attnames. +! Reworking for DSG-enabled Ferret -IF `($rowvar"0|*>1") EQ 0` THEN EXIT/SCRIPT +! set npts -IF `($data_var_in"0|*>1") EQ 0` THEN DEFINE SYMBOL data_var_in = ($data_var) -IF `($data_x_var_in"0|*>1") EQ 0` THEN DEFINE SYMBOL data_x_var_in = ($data_x_var) -IF `($data_y_var_in"0|*>1") EQ 0` THEN DEFINE SYMBOL data_y_var_in = ($data_y_var) -IF `($data_t_var_in"0|*>1") EQ 0` THEN DEFINE SYMBOL data_t_var_in = ($data_t_var) +LET npts = ($numobs) -DEFINE SYMBOL nfeatures = `($rowvar),RETURN=msize` -IF ($feature_type"0|point>1|*>0") THEN DEFINE SYMBOL nfeatures = 0 +! Need this? Previuosly the script toyed with this logic: +! If the Ferret property traj_discrete has been set, check whether the +! distance between points is large; if so plot as discrete points connected +! with a thin line. -IF ($nfeatures"0|0|*>1") THEN - LET mmax = `($rowvar)[m=1:($nfeatures)@sum]` ! 1st m cruises - LET npts = mmax -ELSE - LET npts = `($data_var),RETURN=isize` -ENDIF ! Check data type @@ -34,164 +18,6 @@ LET gettype = ($data_var) DEFINE SYMBOL vtype = `gettype,RETURN=dtype` DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") -! Replace the last datum in each trajectory with the bad-value. -! For the longitudes, also fix the crossings of the dateline. - -LET lon_with_gaps = ($data_x_var) -LET lat_with_gaps = ($data_y_var) -LET time_with_gaps = ($data_t_var) -LET var_with_gaps = ($data_var) - -IF `($data_count) GT 1` THEN LET var_1_with_gaps = ($data_1_var) -IF `($data_count) GT 2` THEN LET var_2_with_gaps = ($data_2_var) -IF `($data_count) GT 3` THEN LET var_3_with_gaps = ($data_3_var) -IF `($data_count) GT 4` THEN LET var_4_with_gaps = ($data_4_var) -IF `($data_count) GT 5` THEN LET var_5_with_gaps = ($data_5_var) - -LET varnames = ..varnames -IF `IS_ELEMENT_OF_STR(varnames, "time") GT 0` THEN set att/like=time time_with_gaps - -IF ($data_z_var"0|*>1") THEN LET vert_with_gaps = ($data_z_var) - -IF ($feature_type"0|point>1|*>0") THEN EXIT/SCRIPT - -! Function separate puts gaps between cruises and also removes jumps in longitude -! where it crosses the dateline. Set ngood and nbad before adding these gaps. -! Prop-prop plots compute ngood elsewhere, taking into account constraints. - -IF `($its_prop_plot"0|0|1|*>1") EQ 0` THEN - IF `($is_string"0") NE 1` THEN - STAT ($data_var) - DEFINE SYMBOL ngood_data = ($stat_ngood) - DEFINE SYMBOL nbad_data = ($stat_nbad) - ELSE - DEFINE SYMBOL zshape = `($data_var),RETURN=shape` - IF `($zshape"0|E>1|POINT>1|*>0)` THEN - DEFINE SYMBOL ngood_data = `($data_var),return=size` - DEFINE SYMBOL nbad_data = 0 - ELSE - DEFINE SYMBOL ngood_data = `($data_var)[i=@ngd]` - DEFINE SYMBOL nbad_data = `($numobs) - ($ngood_data)` - ENDIF - ENDIF -ENDIF - -DEFINE SYMBOL n_gaps = `($nfeatures) - 1` - -IF ($data_x_is_lon"0|*>1") THEN - LET/units="`($data_x_var),return=units` "/title="`($data_x_var),return=title`" lon_with_gaps = SEPARATE(($data_x_var)[i=1:`npts`], ($rowvar), 1) -ELSE - LET/units="`($data_x_var),return=units` "/title="`($data_x_var),return=title`" lon_with_gaps = SEPARATE(($data_x_var)[i=1:`npts`], ($rowvar), 0) -ENDIF - -LET/units="`($data_y_var),return=units` "/title="`($data_y_var),return=title`" lat_with_gaps = SEPARATE(($data_y_var)[i=1:`npts`], ($rowvar), 0) - -LET/units="`($data_t_var),return=units` "/title="`($data_t_var),return=title`" time_with_gaps = SEPARATE(($data_t_var)[i=1:`npts`], ($rowvar), 0) - -IF ($data_z_var"0|*>1") THEN \ - LET/units="`($data_z_var),return=units` "/title="`($data_z_var),return=title`" vert_with_gaps = SEPARATE(($data_z_var)[i=1:`npts`], ($rowvar), 0) - - -LET/units="`($data_var),return=units`" var_with_gaps = SEPARATE(($data_var)[i=1:`npts`], ($rowvar), 0) -IF ($is_string) THEN LET/units="`($data_var),return=units` "/title="`($data_var),return=title`" var_with_gaps = SEPARATE_STR(($data_var)[i=1:`npts`], ($rowvar), 0) - -IF `($data_count) GT 1` THEN - LET/units="`($data_1_var),return=units`" var_1_with_gaps = SEPARATE(($data_1_var)[i=1:`npts`], ($rowvar), 0) - DEFINE SYMBOL data_var_1 = var_1_with_gaps -ENDIF - -IF `($data_count) GT 2` THEN - LET/units="`($data_2_var),return=units`" var_2_with_gaps = SEPARATE(($data_2_var)[i=1:`npts`], ($rowvar), 0) - DEFINE SYMBOL data_var_2 = var_2_with_gaps -ENDIF - -IF `($data_count) GT 3` THEN - LET/units="`($data_3_var),return=units`" var_3_with_gaps = SEPARATE(($data_3_var)[i=1:`npts`], ($rowvar), 0) - DEFINE SYMBOL data_var_3 = var_3_with_gaps -ENDIF - -IF `($data_count) GT 4` THEN - LET/units="`($data_4_var),return=units`" var_4_with_gaps = SEPARATE(($data_4_var)[i=1:`npts`], ($rowvar), 0) - DEFINE SYMBOL data_var_4 = var_4_with_gaps -ENDIF - -IF `($data_count) GT 5` THEN - LET/units="`($data_5_var),return=units`" var_5_with_gaps = SEPARATE(($data_5_var)[i=1:`npts`], ($rowvar), 0) - DEFINE SYMBOL data_var_5 = var_5_with_gaps -ENDIF - -! keep original attributes (e.g. time origin may be needed later) -LET varnames = ..varnames -IF `IS_ELEMENT_OF_STR(varnames, "time") GT 0` THEN set att/like=time time_with_gaps - -LET npts = `lat_with_gaps,RETURN=isize` - -DEFINE SYMBOL data_var = var_with_gaps -DEFINE SYMBOL data_x_var = lon_with_gaps -DEFINE SYMBOL data_y_var = lat_with_gaps -DEFINE SYMBOL data_t_var = time_with_gaps ! this was commented out. Why? - -IF `IS_ELEMENT_OF_STR_N(varnames, "sample_number") GT 0` THEN - LET sample_number_gaps = SEPARATE(sample_number[i=1:`npts`], ($rowvar), 0) - LET gap_var = IF sample_number_gaps[i=@ddf] NE 1 THEN 1 ELSE 0 - -!!! test code for pick up the pen if a delta-distance - LET deg2rad = 4*atan(1)/180 - LET cos_corr = COS(deg2rad*(($region_y_hi)+(($region_y_lo)) )/2) - LET difx = lon_with_gaps[i=@shf:1]-lon_with_gaps - LET dify = lat_with_gaps[i=@shf:1]-lat_with_gaps - let distsq = cos_corr* (difx*difx+dify*dify) - LET gap_var = IF sample_number_gaps[i=@ddf] NE 1 OR distsq GT 100 THEN 1 ELSE 0 -!!! end of test code - DEFINE SYMBOL have_gap_var = 1 -ENDIF - -IF ($data_z_var"0|*>1") THEN DEFINE SYMBOL data_z_var = vert_with_gaps - -! If the Ferret property traj_discrete has been set, check whether the -! distance between points is large; if so plot as discrete points connected -! with a thin line. - -IF ($ferret_traj_discrete"0|*>1") THEN - - go earth_distance ($region_y_lo), ($region_x_lo), ($region_y_hi), ($region_x_hi), diagonal - define symbol diagonal = `diagonal` - - let lat_2 = lat_with_gaps[i=@shf:1] - let lon_2 = lon_with_gaps[i=@shf:1] - - go earth_distance lat_with_gaps, lon_with_gaps, lat_2, lon_2, delta_diff - - LET rel_dist = delta_diff/ ($diagonal) - LET mask = IF rel_dist GT 0.02 THEN 1 - - IF `mask[i=@ngd]/ lon_with_gaps[i=@ngd] GT 0.1` THEN - DEFINE SYMBOL thinline = 1 - DEFINE SYMBOL qualifiers ($qualifiers)/SYM=26/SIZ=0.08/THICK=3 - ENDIF - -ENDIF ! ferret_traj_discrete - -LET nout_lonlat = `($data_var)[i=@ngd]` -DEFINE SYMBOL nout_lonlat = `nout_lonlat` - -! Is the data pre-decimated? If so set up things for the annotations and exit. - - -LET global_attnames = ..attnames -LET nglobal_atts = ..nattrs - -LET deci = 0 -IF `nglobal_atts GT 0` THEN - IF `IS_ELEMENT_OF_STR_N(global_attnames, "decimation") ` THEN LET deci = 1 -ENDIF - -IF `deci GT 0` THEN - DEFINE SYMBOL decimation_fraction = ($ferret_decimation_fraction"0.03257") - DEFINE SYMBOL piecewise_decimation = 1 - LET ngood_sampled = `($ngood_data)` - EXIT/SCRIPT -ENDIF ! End of file ------------ setup_dsg_variables.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl b/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl index 74f20e337..3c4ee774b 100644 --- a/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl +++ b/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl @@ -17,14 +17,16 @@ LET vnames = ..varnames ! Define symbols associated with the region and data and perform any ! initialization needed for this dataset. -! Initialize +! Initialize mask +LET constraints_mask = 1 -!!! Plot time only as the independent variable. If they -!!! have sent in time as the dependent var, swap it. +! Plot time only as the independent variable. If they +! have sent in time as the dependent var, swap it. -IF ($data_1_var"0|*>1") THEN GO LAS_var_lon_lat_time ($data_1_var) +use ($DATA_0_URL) +IF ($data_1_var"0|*>1") THEN GO LAS_var_lon_lat_z_time ($data_1_var) IF `($var_is_time"0") AND ($its_prop_plot"0|0|*>1")` THEN @@ -34,6 +36,7 @@ IF `($var_is_time"0") AND ($its_prop_plot"0|0|*>1")` THEN DEFINE SYMBOL data_sw_units = ($data_0_units) DEFINE SYMBOL data_sw_url = ($data_0_url) DEFINE SYMBOL data_sw_var = ($data_0_var) + DEFINE SYMBOL data_sw_name = ($data_0_name) DEFINE SYMBOL data_0_dataset_url = ($data_1_url) DEFINE SYMBOL data_0_region = ($data_1_region) @@ -41,6 +44,7 @@ IF `($var_is_time"0") AND ($its_prop_plot"0|0|*>1")` THEN DEFINE SYMBOL data_0_units = ($data_1_units) DEFINE SYMBOL data_0_url = ($data_1_url) DEFINE SYMBOL data_0_var = ($data_1_var) + DEFINE SYMBOL data_0_name = ($data_1_name) DEFINE SYMBOL data_1_dataset_url = ($data_sw_url) DEFINE SYMBOL data_1_region = ($data_sw_region) @@ -48,6 +52,44 @@ IF `($var_is_time"0") AND ($its_prop_plot"0|0|*>1")` THEN DEFINE SYMBOL data_1_units = ($data_sw_units) DEFINE SYMBOL data_1_url = ($data_sw_url) DEFINE SYMBOL data_1_var = ($data_sw_var) + DEFINE SYMBOL data_1_name = ($data_sw_name) + + CANCEL SYMBOL data_sw* + +ENDIF + + +! Plot depth only on the vertical axis. If they +! have sent in depth as the independent var, swap it. + + +IF ($data_0_var"0|*>1") THEN GO LAS_var_lon_lat_z_time ($data_0_var) + +IF `( ($var_is_dep"0") OR ($var_is_ht"0") ) AND ($its_prop_plot"0|0|*>1")` THEN + + DEFINE SYMBOL data_sw_dataset_url = ($data_0_url) + DEFINE SYMBOL data_sw_region = ($data_0_region) + DEFINE SYMBOL data_sw_title = ($data_0_title) + DEFINE SYMBOL data_sw_units = ($data_0_units) + DEFINE SYMBOL data_sw_url = ($data_0_url) + DEFINE SYMBOL data_sw_var = ($data_0_var) + DEFINE SYMBOL data_sw_name = ($data_0_name) + + DEFINE SYMBOL data_0_dataset_url = ($data_1_url) + DEFINE SYMBOL data_0_region = ($data_1_region) + DEFINE SYMBOL data_0_title = ($data_1_title) + DEFINE SYMBOL data_0_units = ($data_1_units) + DEFINE SYMBOL data_0_url = ($data_1_url) + DEFINE SYMBOL data_0_var = ($data_1_var) + DEFINE SYMBOL data_0_name = ($data_1_name) + + DEFINE SYMBOL data_1_dataset_url = ($data_sw_url) + DEFINE SYMBOL data_1_region = ($data_sw_region) + DEFINE SYMBOL data_1_title = ($data_sw_title) + DEFINE SYMBOL data_1_units = ($data_sw_units) + DEFINE SYMBOL data_1_url = ($data_sw_url) + DEFINE SYMBOL data_1_var = ($data_sw_var) + DEFINE SYMBOL data_1_name = ($data_sw_name) CANCEL SYMBOL data_sw* @@ -101,6 +143,8 @@ IF ($error_status"0|*>1") THEN EXIT/PROGRAM ENDIF + + ! Here is variable 0 title DEFINE SYMBOL ferret_title_0 = ($ferret_plot_title"($data_0_var)") IF `(STRINDEX("($ferret_title_0%0%)", "Time") GT 0) AND (STRINDEX("($ferret_title_0%0%)", " since ") GT 0)` THEN \ @@ -116,46 +160,11 @@ LET/TITLE="($ferret_title_0)" xvar = XSEQUENCE(($($fer_sym)_var)) IF ($its_trajectory_corr"0|*>1") THEN LET/TITLE="($ferret_title_0)" xvar = ($($fer_sym)_var) -DEFINE SYMBOL vshape = `($($fer_sym)_var),RETURN=SHAPE` -IF `STRCMP("($vshape)", "E") EQ 0` THEN - LET ne_var = `($($fer_sym)_var),RETURN=msize` - DEFINE AXIS/x=1:`ne_var`:1 exaxis - LET xxex = x[gx=exaxis] - LET/TITLE="($ferret_title_0)" xvar = RESHAPE(($($fer_sym)_var), xxex) -ENDIF - -! Is it a varible on the E axis of a DSG file? - -DEFINE SYMBOL vshape = `($($fer_sym)_var_0),RETURN=shape` -IF `($vshape"0|E>1|*>0)` THEN -! Is there a rowsize variable? -! Is it a Profile or Trajectory dataset? +! Is it a varible from a DSG file? +IF ($nfeatures"0|*>1") THEN GO LAS_setup_dsg - IF ($rowvar"0|*>1") THEN DEFINE SYMBOL rowvar = rowsize - -! Expand trajectory variable into obs axis - DEFINE SYMBOL vtype = 0 - DEFINE SYMBOL vtype = `xvar,RETURN=dtype` - DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") - - IF ($is_string"0|0|*>1") THEN - LET/TITLE="($ferret_title_0)" xvar = EXPND_BY_LEN_STR(($ferret_plot_var_0), ($rowvar),`($rowvar)[m=@sum]`) - - IF ($its_prop_plot"0|*>1") THEN - IF `STRINDEX("($ferret_plot_var_0)", "WOCE") GT 0` THEN - SET VAR/NAME = xvar_0 xvar - LET/TITLE="($ferret_title_0)" xvar = STRFLOAT(xvar_0) - SET ATT/LIKE=xvar_0 xvar - ELSE ! cannot use a string as plot argument - LET mvar_0 = _m[ge=($ferret_plot_var_0)] - LET/TITLE="($ferret_title_0)" xvar = EXPND_BY_LEN(mvar_0, ($rowvar),`($rowvar)[m=@sum]`) - ENDIF - ENDIF - ELSE - LET/TITLE="($ferret_title_0)" xvar = EXPND_BY_LEN(($ferret_plot_var_0), ($rowvar),`($rowvar)[m=@sum]`) - ENDIF - LET nx_var = `($rowvar)[m=@sum]` + LET/TITLE="($ferret_title_0)" xvar = ($ferret_plot_var_0) ENDIF ! Initialize the second variable. @@ -180,7 +189,6 @@ IF ($error_status"0|*>1") THEN EXIT/PROGRAM ENDIF - ! Here is variable 1 title DEFINE SYMBOL ferret_title_1 = ($ferret_plot_title"($data_1_var)") IF `(STRINDEX("($ferret_title_1%0%)", "Time") GT 0) AND (STRINDEX("($ferret_title_1%0%)", " since ") GT 0)` THEN \ @@ -226,6 +234,7 @@ ENDIF ! Could analyze the axes, see if, without striding, they are in fact ! the same length, and if so apply striding to all grids. This is a rare ! case; not doing this now. + LET nshape = STRLEN ("($vshape)") IF `($data_count"0") GE 2 AND ($its_prop_plot"0") AND nshape GT 1` THEN SET DATA ($data_0_url) @@ -245,47 +254,10 @@ IF `($data_count"0") GE 2 AND ($its_prop_plot"0") AND nshape GT 1` THEN ENDIF ENDIF - - -DEFINE SYMBOL vshape = `($($fer_sym)_var_1),return=SHAPE` -IF `STRCMP("($vshape)", "E") EQ 0` THEN - LET ne_var = `($($fer_sym)_var),RETURN=msize` - DEFINE AXIS/x=1:`ne_var`:1 exaxis - LET xxex = x[gx=exaxis] - LET/TITLE="($ferret_title_0)" yvar = RESHAPE(($($fer_sym)_var_1), xxex) -ENDIF - -! Is it a varible on the E axis of a DSG file? - -DEFINE SYMBOL vshape = `($($fer_sym)_var_1),RETURN=shape` -IF `($vshape"0|E>1|*>0)` THEN - -! Is it a Profile or Trajectory dataset? - IF `($rowvar"0|*>1") EQ 0` THEN GO LAS_setup_dsg - IF ($rowvar"0|*>1") THEN DEFINE SYMBOL rowvar = rowsize - -! Expand trajectory variable into obs axis - DEFINE SYMBOL vtype = 0 - DEFINE SYMBOL vtype = `yvar,RETURN=dtype` - DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") - - IF ($is_string"0|0|*>1") THEN - LET yvar = EXPND_BY_LEN_STR(($ferret_plot_var_1), ($rowvar),`($rowvar)[m=@sum]`) - - IF ($its_prop_plot"0|*>1") THEN - IF `STRINDEX("($ferret_plot_var_1)", "WOCE") GT 0` THEN - SET VAR/NAME = yvar_0 yvar - LET/TITLE="($ferret_title_1)" yvar = STRFLOAT(yvar_0) - SET ATT/LIKE=yvar_0 yvar - ELSE ! cannot use a string as plot argument - LET mvar_1 = _m[ge=($ferret_plot_var_1)] - LET/TITLE="($ferret_title_1)" yvar = EXPND_BY_LEN(mvar_1, ($rowvar),`($rowvar)[m=@sum]`) - ENDIF - ENDIF - - ELSE - LET/TITLE="($ferret_title_1)" yvar = EXPND_BY_LEN(($ferret_plot_var_1), ($rowvar),`($rowvar)[m=@sum]`) - ENDIF +! Is it a varible from a DSG file? +IF ($nfeatures"0|*>1") THEN + GO LAS_setup_dsg + LET/TITLE="($ferret_title_1)" yvar = ($ferret_plot_var_1) ENDIF IF ($its_prop_plot"0|*>1") THEN @@ -363,36 +335,10 @@ IF `($data_count"0") GE 3` THEN ! color by 3rd variable DEFINE SYMBOL ferret_plot_var_2 = ($($fer_sym)_var) DEFINE SYMBOL ferret_plot_var = ($($fer_sym)_var) - LET/TITLE="($ferret_title_2)" zvar = XSEQUENCE(($ferret_plot_var_2)) - -! Is it a varible on the E axis of a DSG file? - - DEFINE SYMBOL vshape = `($ferret_plot_var_2),RETURN=shape` - IF `($vshape"0|E>1|*>0)` THEN - -! Is it a Profile or Trajectory dataset? - IF `($rowvar"0|*>1") EQ 0` THEN GO LAS_setup_dsg - IF ($rowvar"0|*>1") THEN DEFINE SYMBOL rowvar = rowsize - -! Expand trajectory variable into obs axis - DEFINE SYMBOL vtype = 0 - DEFINE SYMBOL vtype = `zvar,RETURN=dtype` - DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") - - IF ($is_string"0|0|*>1") THEN - LET zvar = EXPND_BY_LEN_STR(($ferret_plot_var_2), ($rowvar),`($rowvar)[m=@sum]`) - -! Set string var to a sequence number, unless its a qc_flag or region id. - - IF `(($data_2_var_in"0|region_ID>1|qc_flag>1|*>0") EQ 0) AND ($its_prop_plot"0|*>1")` THEN - LET mvar_2 = _m[ge=($ferret_plot_var_2)] - LET zvar = EXPND_BY_LEN(mvar_2, ($rowvar),`($rowvar)[m=@sum]`) - ELSE - LET zvar = EXPND_BY_LEN(($ferret_plot_var_2), ($rowvar),`($rowvar)[m=@sum]`) - ENDIF - ELSE - LET zvar = EXPND_BY_LEN(($ferret_plot_var_2), ($rowvar),`($rowvar)[m=@sum]`) - ENDIF + LET/TITLE="($ferret_title_2)" zvar = ($ferret_plot_var_2) + + IF `($its_trajectory_corr"0|*>1") EQ 0` THEN + LET/TITLE="($ferret_title_1)" zvar = XSEQUENCE(($ferret_plot_var_2)) ELSE @@ -402,16 +348,23 @@ IF `($data_count"0") GE 3` THEN ! color by 3rd variable DEFINE SYMBOL vtype = `gettype,RETURN=dtype` DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") -! If string, set to all-missing. (But custom scripts may do more later, e.g. for SOCAT) +! If string, set to all-missing, or for DSG data, to index values (But custom scripts may do more later, e.g. for SOCAT) IF `($is_string) AND ($its_listing"0|*>1") EQ 0` THEN DEFINE SYMBOL zvar_is_string = 1 - LET zvar = 1./0 + 0*xvar - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = ($data_2_title) is not numeric. Plot without color. - CANCEL SYMBOL ferret_plot_var + LET zvar = 1./0 + 0*xvar + IF `($nfeatures"0|*") NE 0` THEN + DEFINE SYMBOL zshape = `($ferret_plot_var_2),return=shape` + DEFINE SYMBOL zshape = ($zshape"|POINT>E|*") + LET zvar = _($zshape"|X>i|Y>j|Z>k|T>l|E>m|F>n")[g($zshape)=($ferret_plot_var_2)] + ELSE + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL note_($note_num)_lab = ($data_2_title) is not numeric. Plot without color. + CANCEL SYMBOL ferret_plot_var + ENDIF ENDIF ENDIF + ! what about woce flags?? DEFINE SYMBOL zvar = zvar @@ -491,9 +444,24 @@ IF `($its_listing"0|1|*>0") EQ 0 AND ($ferret_plot_key"0|date_key>1|*>0")` THEN LET tunits = SUBSTRING("`($ferret_plot_var_($color_vnum)).units`",1,`since_loc`) DEFINE SYMBOL tunits = `tunits` ENDIF - DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($ferret_plot_var_($color_vnum)).time_origin`"/units=($tunits) time_axis - IF ($tunits"0|seconds>1|*>0") THEN \ - DEFINE AXIS/T=`tmin`:`tmax`:3600/T0="`($ferret_plot_var_($color_vnum)).time_origin`"/units=($tunits) time_axis + + IF ($dsg_t_var"0|*>1") THEN ! dsg dataset: get the time data + + let tvar = XSEQUENCE(($dsg_t_var)) + LET tmin = tvar[i=@MIN] + LET tmax = tvar[i=@MAX] + DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($dsg_t_var).time_origin`"/units=($tunits) time_axis + IF ($tunits"0|seconds>1|*>0") THEN \ + DEFINE AXIS/T=`tmin`:`tmax`:3600/T0="`($dsg_t_var).time_origin`"/units=($tunits) time_axis + + ELSE + + DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($ferret_plot_var_($color_vnum)).time_origin`"/units=($tunits) time_axis + IF ($tunits"0|seconds>1|*>0") THEN \ + DEFINE AXIS/T=`tmin`:`tmax`:3600/T0="`($ferret_plot_var_($color_vnum)).time_origin`"/units=($tunits) time_axis + + ENDIF + DEFINE SYMBOL datekey = 1 DEFINE SYMBOL ferret_key_annotate = 0 @@ -512,34 +480,43 @@ DEFINE SYMBOL yvar = yvar ! Apply any constraints - LET npts = `xvar,return=isize` +IF ($feature_type"0|*>1") THEN + GO setup_dsg_constraints + +! constraints_mask will be applied later, in prop_prop_plot. + LET constraints_mask = text_mask * var_mask + +ELSE + + LET npts = `xvar,return=isize` ! Initialize mask variables -LET var_mask = 1+0*x[gx=xvar,i=1:`nx_var`] + LET var_mask = 1+0*x[gx=xvar,i=1:`nx_var`] -IF `($subset_mask"0|*>1") EQ 0` THEN LET subset_mask = {1} -LET text_mask = {1} -LET ntext_masks = 0 + IF `($subset_mask"0|*>1") EQ 0` THEN LET subset_mask = {1} + LET text_mask = {1} + LET ntext_masks = 0 -IF ($constraint_0_lhs"0|*>1) THEN - GO prop_prop_constraints -ENDIF + IF ($constraint_0_lhs"0|*>1) THEN + GO prop_prop_constraints + ENDIF -LET constraints_mask = text_mask * var_mask -IF ($have_feature_mask"0|*>1") THEN LET constraints_mask = text_mask * var_mask * feature_mask_obs + LET constraints_mask = text_mask * var_mask + IF ($have_feature_mask"0|*>1") THEN LET constraints_mask = text_mask * var_mask * feature_mask_obs -IF ($color_by"0|*>1") THEN + IF ($color_by"0|*>1") THEN - DEFINE SYMBOL zvar = constraints_mask*zvar - DEFINE SYMBOL color_by_title = `zvar,RETURN=title` + DEFINE SYMBOL zvar = constraints_mask*zvar + DEFINE SYMBOL color_by_title = `zvar,RETURN=title` - DEFINE SYMBOL plot_arg = ($xvar), ($yvar), ($zvar) + DEFINE SYMBOL plot_arg = ($xvar), ($yvar), ($zvar) -ENDIF ! color-by 3rd var + ENDIF ! color-by 3rd var -DEFINE SYMBOL xvar = constraints_mask*xvar -DEFINE SYMBOL yvar = constraints_mask*yvar + DEFINE SYMBOL xvar = constraints_mask*xvar + DEFINE SYMBOL yvar = constraints_mask*yvar +ENDIF ! Set up annotations for the space-time region if this is a correletion plot ! from gridded variables. Do PLOT/SET to get Ferret's formatted version diff --git a/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl b/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl index 94aeda99a..55fbe582c 100644 --- a/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl +++ b/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl @@ -117,20 +117,21 @@ let q_var = q + pqmask ! Define axes for both variables using the range in the data !--------- -LET amin = p_var[i=@MIN] -LET amax = p_var[i=@MAX] -LET bmin = q_var[i=@MIN] -LET bmax = q_var[i=@MAX] +LET amin = p_var[t=@MIN] +LET amax = p_var[t=@MAX] +LET bmin = q_var[t=@MIN] +LET bmax = q_var[t=@MAX] +list amin,amax,bmin,bmax -LET locx = ($deploy_lon)[i=1] -LET locy = ($deploy_lat)[i=1] +LET locx = ($deploy_lon)[e=1] +LET locy = ($deploy_lat)[e=1] ! Compute radius of circle: max excursion from the deployment location. ! The plot range is the max of this size and the watch circle radius -LET radii = ((p_var - locx)^2 + (q_var - locy)^2)^0.5 -LET wc_rad_compute = radii[i=@max] +LET radii = ((p_var - (`locx`))^2 + (q_var - (`locy`))^2)^0.5 +LET wc_rad_compute = radii[t=@max] LET wc_rad = wc_rad_compute LET axis_add = wc_rad_compute @@ -208,7 +209,7 @@ PPL SHADE PLOT/VS/OVER/NOLAB/THICK=3/sym=21/SIZ=0.2/color=lightblue locx, locy PLOT/VS/OVER/NOLAB/THICK=3/sym=27/SIZ=0.18/color=black locx, locy -PLOT/VS/OVER/NOLAB/LINE/k=1:628/COLOR=6/pal=rnb locx + wc_rad*cos(k/100), locy + wc_rad*sin(k/100) +PLOT/VS/OVER/NOLAB/LINE/k=1:628/COLOR=6/pal=rnb `locx` + `wc_rad`*cos(k/100), `locy` + `wc_rad`*sin(k/100) ! If put_label was defined, something caused one or both variables to be all BAD. IF ($put_label"0|*>1") THEN @@ -269,4 +270,6 @@ DEFINE SYMBOL yvar = constraints_mask*yvar LET p = ($xvar) LET q = ($yvar) +define symbol watch_plot = 1 + ! End of file setup_watch_circle.jnl-------------------------- From 5a322095dcf9867f40e988cc6d75b2202a23ceba Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Wed, 26 Aug 2020 14:36:04 -0700 Subject: [PATCH 02/15] scripts for color-by-time on Trajectory plots --- .../ferret/scripts/define_dsg_taxis.jnl | 69 +++++++++++++++++++ .../feature_initialize_plot_settings.jnl | 44 ++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl create mode 100644 JavaSource/resources/ferret/scripts/feature_initialize_plot_settings.jnl diff --git a/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl b/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl new file mode 100644 index 000000000..3cac1eb52 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl @@ -0,0 +1,69 @@ +! define_dsg_taxis +! Set up a time axis based on the time data in a DSG file, +! with fewer points, and with a larger range if the range is quite short. + + +DEFINE SYMBOL shape = `($data_t_var),RETURN=shape` +DEFINE SYMBOL indx = ($shape"0|POINT>0|X>i|Z>k|T>l|E>m|*>0") + +IF ($indx"0|0|*>1") THEN + LET t1 = ($data_t_var)[($indx)=@MIN] + LET t2 = ($data_t_var)[($indx)=@MAX] + IF ($indx"|m>0|*>1") THEN + LET tmin = `t1[e=@min]` + LET tmax = `t2[e=@max]` + ELSE + LET tmin = `t1` + LET tmax = `t2` + ENDIF +ELSE + +! single point in time + LET t1 = ($data_t_var) + LET t2 = t1 + LET tmin = t1 + LET tmax = t1 +ENDIF + + +! Adjust if start and end times are too close together +LET oneday = 1 + +LET since_loc = STRINDEX("`($data_t_var).units`","since") - 2 +IF `since_loc GT 1` THEN + LET tunits = SUBSTRING("`($data_t_var).units`",1,`since_loc`) + DEFINE SYMBOL tunits = `tunits` +ENDIF +LET time_units = "($tunits)" + +IF `STRINDEX(time_units, "sec") GT 0` THEN LET oneday = 24*60*60 +IF `STRINDEX(time_units, "min") GT 0` THEN LET oneday = 24*60 +IF `STRINDEX(time_units, "ho") GT 0` THEN LET oneday = 24 +IF `STRINDEX(time_units, "da") GT 0` THEN LET oneday = 1 + +LET del = `(tmax-tmin)/oneday` + +IF `del LT 1` THEN + IF `tmin GT 0` THEN + LET tmin = `tmin - oneday` + LET tmax = `tmax + oneday` + ELSE + LET tmin = `tmin + oneday` + LET tmax = `tmax - oneday` + ENDIF +ENDIF + +DEFINE AXIS/T=`tmin`:`tmax`:1/T0="`($data_t_var).time_origin`"/units=($tunits) taxis +LET ttvar = t[gt=taxis] +LET nt = `ttvar,RETURN=lsize` + +! If the units are seconds since, we don't need that much resolution for this. Make it hours. + +IF `($tunits"0|seconds>1|*>0") AND nt GT 100*3600` THEN \ +DEFINE AXIS/T=`tmin`:`tmax`:3600/T0="`($data_t_var).time_origin`"/units=($tunits) taxis + +! Keep the axis from being super dense. +if `nt gt 2000` THEN \ +DEFINE AXIS/T=`tmin`:`tmax`/NPOINTS=2000/T0="`($data_t_var).time_origin`"/units=($tunits) taxis + +! End of script ------------ define_dsg_taxis.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/feature_initialize_plot_settings.jnl b/JavaSource/resources/ferret/scripts/feature_initialize_plot_settings.jnl new file mode 100644 index 000000000..11ff06a6c --- /dev/null +++ b/JavaSource/resources/ferret/scripts/feature_initialize_plot_settings.jnl @@ -0,0 +1,44 @@ +! feature_initialize_plot_settings.jnl +! +! plot settings such as color palettes that are defined on startup +! and which may be reset later. + +! Is there a custom palette? This may be reset in custom_dataset_definitions.jnl below + +IF `($ferret_insitu_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_insitu_palette) +IF `($ferret_Point_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Point_palette) +IF `($ferret_Profile_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Profile_palette) +IF `($ferret_Timeseries_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Timeseries_palette) +IF `($ferret_TrajectoryProfile_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_TrajectoryProfile_palette) +IF `($ferret_Trajectory_palette"0|*>1")` THEN DEFINE SYMBOL ferret_palette = ($ferret_Trajectory_palette) + + +! Mark whether there are color levels set on first entry. +! Compute automatic open-ended levels. +IF `($num) EQ 0` THEN + IF ($ferret_fill_levels"0|*>1") THEN DEFINE SYMBOL input_fill_levels = 1 + IF ($ferret_poly_levels"0|*>1") THEN + DEFINE SYMBOL ferret_fill_levels ($ferret_poly_levels) + DEFINE SYMBOL input_fill_levels = 1 + ENDIF + + LET its_plot = `STRINDEX(UPCASE("($operation_ID)"), "PLOT") GT 0` + IF `STRLEN("($ferret_view)") EQ 2 AND its_plot GT 0` THEN + IF ($ferret_fill_levels"1|closed>0|*>1") THEN GO LAS_auto_levels + ENDIF + IF `STRLEN("($ferret_view)") EQ 2 AND STRINDEX("($operation_ID)", "poly") GT 0` THEN + IF ($ferret_fill_levels"1|closed>0|*>1") THEN GO LAS_auto_levels + ENDIF + IF ($ferret_fill_levels"0|closed>1|*>0") THEN CANCEL SYMBOL ferret_poly_levels + IF ($ferret_fill_levels"0|closed>1|*>0") THEN CANCEL SYMBOL input_fill_levels + IF ($ferret_fill_levels"0|closed>1|*>0") THEN CANCEL SYMBOL ferret_fill_levels + + IF `($ferret_poly_levels"0|*>1") EQ 0` THEN \ + IF ($ferret_fill_levels"0|*>1") THEN DEFINE SYMBOL ferret_poly_levels ($ferret_fill_levels) +ENDIF + +! When prop-prop plot colored by feature this is the max polygon color/shapes we use. +DEFINE SYMBOL feature_max_labels = 200 + +!---------------- end of feature_initialize_plot_settings.jnl ------------------------- + From aee114afd5d2cdddae626fbf7a5e0f289a50a9da Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Thu, 24 Sep 2020 17:21:09 -0700 Subject: [PATCH 03/15] initial placement of watermarks in images --- .../ferret/scripts/LAS_open_window.jnl | 22 +++++++++++++++++-- .../ferret/scripts/set_full_margins.jnl | 21 ++++++++++++------ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl index a3017460c..0ad9e9a0e 100644 --- a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl @@ -19,11 +19,26 @@ ! - If no margins (WMS style plot) is requested, set that up, ! including the /NOYADJUST plot qualifier. +! For watermarks: +! If there is a Ferret property wmark_image +! then add that to the plot. +! Here I have made the nominal choice to use 50% opacity and place +! it 5 pixels from the uppermost left-hand corner. It can also be scaled +! using the /wmscale= qualifier. +! +! If wmark is set, the viewports defined here and in set_full_margins.jnl +! are changed to allow some extra spacing in the Y direction. IF `($set_window_quals"0|*>1") EQ 0` THEN \ DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5") CANCEL MODE LOGO +let wmark = 0 +IF ($ferret_wmark_image"0|*>1") THEN + LET wmark = 1 + DEFINE SYMBOL set_window_quals = ($set_window_quals)/\ + wmark="($ferret_wmark_image)"/wmscale=0.5/wmopac=50 /wmxloc=5/wmyloc=5 +ENDIF IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/FONT=verdana @@ -53,6 +68,7 @@ SET WINDOW($set_window_quals) IF `($ferret_margins"1|0|1|false>0|true>1") EQ 0` THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:1 WMSview + IF `wmark` THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:.8 WMSview SET VIEW WMSview IF `STRLEN("($ferret_view)") LT 2` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/NOYADJUST @@ -60,17 +76,19 @@ ELSE ! For 2D plots, make room for the colorbar labels which sometimes get cut off. IF `STRLEN("($ferret_view)") GE 2` THEN DEFINE VIEW/X=0:0.95/Y=0:1 xspace + IF `wmark` THEN DEFINE VIEW/X=0:0.95/Y=0:.8 xspace + IF `wmark` THEN DEFINE VIEW/X=0:0.95/Y=0:.5 xspace SET VIEW xspace ELSE ! For 1D plots we may be doing a line key in a new viewport, so set the initial viewport. SET VIEW full IF ($ferret_view"0|z>1|*>0") THEN DEFINE SYMBOL win_aspect = 0.8 - SET WIN/ASPECT=($win_aspect):axis ELSE DEFINE SYMBOL win_aspect = 0.4 - SET WIN/ASPECT=($win_aspect):axis ENDIF + SET WIN/ASPECT=($win_aspect)/:axis + IF `wmark` THEN SET WIN/ASPECT=($win_aspect)/wmark="($ferret_wmark_image)" ENDIF ENDIF diff --git a/JavaSource/resources/ferret/scripts/set_full_margins.jnl b/JavaSource/resources/ferret/scripts/set_full_margins.jnl index a09735573..a90deda22 100644 --- a/JavaSource/resources/ferret/scripts/set_full_margins.jnl +++ b/JavaSource/resources/ferret/scripts/set_full_margins.jnl @@ -17,7 +17,16 @@ DEFINE SYMBOL text_size = ($ferret_text_size"0.09") CAN view LET y_up = 0.92 -IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN LET y_up = 0.9 +LET y_up_t = 0.99 +IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN + LET y_up = 0.9 + LET y_up_t = 0.99 +ENDIF + +IF `wmark` THEN + LET y_up = `y_up - 0.04` + LET y_up_t = `y_up_t - 0.6` +ENDIF DEFINE VIEW/AXES/X=0.08:0.99/y=0.08:`y_up` full_view DEFINE VIEW/AXES/X=0.08:0.99/y=0.08:`y_up` full_view2 @@ -50,16 +59,14 @@ IF ($ferret_view%0|xt>1|*>0%) THEN ENDIF IF ($ferret_view%0|t>1|*>0%) THEN -! DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:0.99 full_view ! for tics outside the plot box -! DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:0.99 full_view2 - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:0.99 full_view - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:0.99 full_view2 + DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view + DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view2 ENDIF ! Thumbnail plots need bigger axis labels. Make the margins bigger. IF ($ferret_view%0|x>1|y>1|z>1|*>0%) THEN - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:0.99 full_view - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:0.99 full_view2 + DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view + DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view2 ENDIF SET VIEW full_view From 526c27cdadfffd16fbcdc8f90fded0f926c2f33b Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Thu, 24 Sep 2020 17:21:37 -0700 Subject: [PATCH 04/15] redo the update of scripts for DSG-enabled PyFerret. --- .../ferret/scripts/LAS_annotations_xml.jnl | 3 +- .../ferret/scripts/LAS_define_etopo.jnl | 23 +- .../scripts/LAS_draw_multi_line_plot.jnl | 28 +-- .../ferret/scripts/LAS_initial_setup.jnl | 12 +- .../ferret/scripts/LAS_initialize_data.jnl | 6 - .../scripts/LAS_initialize_data_std.jnl | 12 +- .../ferret/scripts/LAS_initialize_dataset.jnl | 9 +- .../scripts/LAS_initialize_feature_id.jnl | 30 ++- .../ferret/scripts/LAS_initialize_region.jnl | 9 +- .../resources/ferret/scripts/LAS_is_range.jnl | 29 +-- .../ferret/scripts/LAS_pp_colorby_feature.jnl | 26 +-- .../scripts/LAS_pp_set_region_labels.jnl | 3 +- .../resources/ferret/scripts/LAS_results.jnl | 36 +--- .../scripts/LAS_set_plot_qualifiers.jnl | 7 +- .../ferret/scripts/LAS_setup_dsg.jnl | 20 -- .../ferret/scripts/LAS_xytvar_setup.jnl | 1 + .../ferret/scripts/Plot_2D_Profile.jnl | 2 +- .../scripts/Timeseries_station_plot.jnl | 197 +++++++----------- .../ferret/scripts/Trajectory_2D_poly.jnl | 3 - .../scripts/Trajectory_Data_Convert_File.jnl | 5 +- .../ferret/scripts/define_dsg_taxis.jnl | 24 +-- .../ferret/scripts/dsg_find_roles.jnl | 6 +- .../feature_initialize_data_insitu.jnl | 3 - .../ferret/scripts/feature_labels.jnl | 7 +- .../ferret/scripts/insitu_waterfall_xz.jnl | 27 ++- .../ferret/scripts/insitu_waterfall_yz.jnl | 27 ++- .../ferret/scripts/insitu_waterfall_zt.jnl | 26 +-- .../resources/ferret/scripts/key_at_top.jnl | 3 - .../ferret/scripts/list_a_variable.jnl | 11 +- .../ferret/scripts/list_csv_data.jnl | 18 +- .../ferret/scripts/list_csv_define_var.jnl | 66 ++---- .../resources/ferret/scripts/list_data.jnl | 29 --- .../ferret/scripts/list_prop_prop.jnl | 21 -- .../resources/ferret/scripts/make_c_lab.jnl | 23 +- .../ferret/scripts/prop_prop_map_thumb.jnl | 39 +--- .../ferret/scripts/prop_prop_plot.jnl | 163 +++------------ .../resources/ferret/scripts/reset_labels.jnl | 28 +-- .../ferret/scripts/set_constraint_labels.jnl | 2 - .../resources/ferret/scripts/set_linesym.jnl | 13 +- .../ferret/scripts/setup_prop_prop.jnl | 9 +- .../ferret/scripts/setup_watch_circle.jnl | 21 +- 41 files changed, 296 insertions(+), 731 deletions(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl b/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl index 00399d6f6..81bd0a79c 100644 --- a/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl @@ -32,8 +32,7 @@ DEFINE SYMBOL out = GO write_to_xml ! orthogonal axis labels - -IF `($longitude_lab%0|*>1%)+($latitude_lab%0|*>1%)+($depth_lab%0|*>1%)+($time_lab%0|*>1%)+($year_lab%0|*>1%)+($ens_lab%0|*>1%)+($forecast_lab%0|*>1%) GT 0` THEN \ +IF `($longitude_lab%0|*>1%)+($latitude_lab%0|*>1%)+($depth_lab%0|*>1%)+($time_lab%0|*>1%)+($ens_lab%0|*>1%)+($forecast_lab%0|*>1%) GT 0` THEN \ GO annotation_orthogonal_axes ! variable and dataset labels diff --git a/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl b/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl index d607397d1..79ae016a8 100644 --- a/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl @@ -2,7 +2,7 @@ ! See if there are etopo2 and etopo1 in the same ! directory as etopo5 ! 11/2017 Add topo015 as an option, define topo*url symbols -! 7/2020 Do not look for topo50 dataset as a local file. + DEFINE SYMBOL topo20_url = etopo20 DEFINE SYMBOL topo5_url = etopo5 @@ -14,27 +14,28 @@ LET epath = "`rose,RETURN=dsetpath`" LET eloc = STRINDEX(epath,"etopo") LET justpath = SUBSTRING(epath,1,eloc-1) -IF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc") EQ 0` THEN - DEFINE SYMBOL topo2_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc +IF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc") EQ 0` THEN + DEFINE SYMBOL topo2_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc ELSE LET e2file = STRCAT(justpath, "etopo2.nc") IF `TEST_OPENDAP(e2file) EQ 0` THEN DEFINE SYMBOL topo2_url = `e2file` ENDIF -IF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc") EQ 0` THEN - DEFINE SYMBOL topo1_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc -ELIF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc") EQ 0` THEN - DEFINE SYMBOL topo1_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc +IF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc") EQ 0` THEN + DEFINE SYMBOL topo1_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc +ELIF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc") EQ 0` THEN + DEFINE SYMBOL topo1_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc ELSE LET e1file = STRCAT(justpath, "etopo1.nc") IF `TEST_OPENDAP(e2file) EQ 0` THEN DEFINE SYMBOL topo1_url = `e1file` ENDIF -IF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc") EQ 0` THEN - DEFINE SYMBOL topo_015_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc +IF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc") EQ 0` THEN + DEFINE SYMBOL topo_015_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc +ELIF `TEST_OPENDAP("/home/data/topography/topo15_compressed.nc") EQ 0` THEN + DEFINE SYMBOL topo_015_url = /home/data/topography/topo15_compressed.nc ENDIF CANCEL DATA etopo5 -! --------------- End of LAS_define_etopo --------------------------- - +! --------------- End of LAS_define_etopo --------------------------- \ No newline at end of file diff --git a/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl b/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl index 5307ea9d0..cdce82914 100644 --- a/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl @@ -9,13 +9,10 @@ ! 11/2017 *acm* Dont label plots with units of "units" or "none" ! 12/2017 *acm* Apply positive=down attribute if all variables in a ! units-group have that setting. -! 10/2019 *acm* For time plots if there's a year-label needed, save symbol -! to be added to the annotations -! 10/2019 *acm* Fix use of plot_pos_down_* symbols so vertical axis doesn't -! get incorrectly flipped. set mode ver:always + LET xvf = ($1%0.1%) LET xvl = ($2%0.9%) @@ -139,14 +136,6 @@ REPEAT/RANGE=2:`($nunit_grp"1")`/NAME=m (\ LET maxlablen = `MAX(maxlablen, STRLEN("($PPL$YMIN1)"))`;\ LET maxlablen = `MAX(maxlablen, STRLEN("($PPL$YMAX1)"))`) -! Set a year-label for the annotations if Ferret has added an upper-left year label -IF `(($have_year_lab"0|*>1") EQ 0) AND ($labnum_year%0|*>1%)` THEN - DEFINE SYMBOL n_left_labels = `($n_left_labels"0") + 1` - DEFINE SYMBOL upper_left_($n_left_labels) = ($lab($labnum_year)) - DEFINE SYMBOL year_lab = ($lab($labnum_year)) - DEFINE SYMBOL have_year_lab = 1 -ENDIF - ! Draw any other plot axes scaled for each set of variables with common units ! Plot axis with first set of units will be on the left. ! Draw the plots for other sets of variables as /SYM=dot/COLOR=8 (COLOR=white) so that @@ -179,7 +168,7 @@ REPEAT/RANGE=1:`($nunit_grp"1")`/NAME=m (\ GO LAS_get_lines_min_max `vplotnum`;\ PPL %range `vlimylo`, `vlimyhi`, 10;\ DEFINE SYMBOL qualifiers_g($vm) = /VLIM=($ppl$range_low):($ppl$range_high);\ - IF ($plot_pos_down_($vm)"0|0|1|*>1") THEN DEFINE SYMBOL qualifiers_g($vm) = /VLIM=($ppl$range_high):($ppl$range_low);\ + IF ($plot_pos_down"($vm)|0|1|*>1") THEN DEFINE SYMBOL qualifiers_g($vm) = /VLIM=($ppl$range_high):($ppl$range_low);\ IF `($vm) GT 0` THEN;\ PLOT/AXES=0,0,0,1($qualifiers_g($vm))/SYM=dot/COLOR=8/NOLAB {0,1};\ LET do_lab = ($group_label_($vm)"0|NONE>0|none>0|units>0|*>1");\ @@ -205,18 +194,6 @@ SET VIEW v0_v($vpname)($vm) IF ($ferret_view"1|t>0|*>1") THEN SET MODE GRATICULE:(DASH,COLOR=($graticuleColor)) -! Draw the first line to capture the year-label if any. Draw again below with /NOLAB and other qualifiers. -! Set a year-label for the annotations if Ferret has added an upper-left year label - -PLOT ($ferret_plot_var_($vm)) - -IF `(($have_year_lab"0|*>1") EQ 0) AND ($labnum_year%0|*>1%)` THEN - DEFINE SYMBOL n_left_labels = `($n_left_labels"0") + 1` - DEFINE SYMBOL upper_left_($n_left_labels) = ($lab($labnum_year)) - DEFINE SYMBOL year_lab = ($lab($labnum_year)) - DEFINE SYMBOL have_year_lab = 1 -ENDIF - PLOT($qualifiers)($qualifiers_0)($qualifiers_g($vm))($axqual)/COLOR=($leg_color($vm))/NOLAB ($ferret_plot_var_($vm)) LET do_lab = ($group_label_($vm)"0|NONE>0|none>0|units>0|*>1") @@ -269,3 +246,4 @@ DEFINE SYMBOL xaxis_min = ($xax_min_save) DEFINE SYMBOL xaxis_max = ($xax_max_save) ! --------------- End of LAS_draw_multi_line_plot --------------------------- + diff --git a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl index 9d52e3064..4b611d68a 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl @@ -12,6 +12,11 @@ SET MODE VERIFY:ALWAYS +! Put into the debug output what PyFerret/Ferret is running, and when. + +SHOW SYMBOL ferret_version, ferret_platform, program_name, current_date +SHOW MEMORY + DEFINE SYMBOL initialize_script_arg = ($1"2") ! Make sure to do the SET REDIRECT just once. @@ -21,12 +26,7 @@ DEFINE SYMBOL initial_setup_done = 1 ! Put the output into the log file so that FshowGO will list ! the tree of GO script calls. -SET REDIRECT/CLOBBER/TEE/file="($result_debug_filename)" STDOUT,STDERR - -! Put into the debug output what PyFerret/Ferret is running, and when. - -SHOW SYMBOL ferret_version, ferret_platform, program_name, current_date -SHOW MEMORY +SET REDIRECT/APPEND/TEE/file="($result_debug_filename)" STDOUT,STDERR IF `($initialize_script_arg) EQ 0` THEN EXIT/SCRIPT diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl index c7857e566..e04dde840 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl @@ -24,12 +24,6 @@ IF `($ferret_start_memory"0") GT 0` THEN SET MEM/SIZ=($ferret_start_memory) IF `($data_initialization_script"0|*>1") EQ 0` THEN \ DEFINE SYMBOL data_initialization_script LAS_initialize_data_std GO ($data_initialization_script) ($1) -IF ($error_string"0|*>1") THEN - IF `STRINDEX(($data_url), "_expr_") GT 0 AND STRINDEX(($data_url), "analysed_") GT 0` THEN\ - DEFINE SYMBOL error_string = Failed setting up computation for `($data_($num)_var).long_name`. Try a smaller region. - MESSAGE/ERROR **ERROR ($error_STRING) - EXIT/PROGRAM -ENDIF GO LAS_unquote_string data_title diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl index 60d29c705..f226466b8 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl @@ -30,9 +30,7 @@ ! in the dataset configuration as ferret_init_commands, whose the value is a set ! of Ferret commands separated by semicolons. ! -! 10/4/2016 fixes so init scripts still work -! 1/ 2020 improved error messages on initializing dataset -! 1/20/2020 For multiple variables (e.g. a csv listing of vars) do not run init script multiple times +! 10/4/2016 fixes so init scripts still work ! GO LAS_initialize_dataset ($1"0") @@ -49,13 +47,7 @@ IF ($error_status"0|ERROR>1|*>1") THEN EXIT/PROGRAM ENDIF -! Generally don't want to run init scripts more than once; variables -! have been renamed. - -IF `($ferret_init_script"0|*>1") AND ($init_script_done"0") EQ 0` THEN - GO ($ferret_init_script) ($dset($1"0")) - DEFINE SYMBOL init_script_done = 1 -ENDIF +IF ($ferret_init_script"0|*>1") THEN GO ($ferret_init_script) ($dset($1"0")) IF ($ferret_init_commands"0|*>1") THEN ($ferret_init_commands) diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl index babf385fc..dac4008e9 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl @@ -40,11 +40,8 @@ IF ($fer_last_error"0|0|1|*>1") THEN IF `($error_status"0|*>1") EQ 0` THEN ! if errors not yet set. DEFINE SYMBOL error_status = ERROR DEFINE SYMBOL error_type = DATA - DEFINE SYMBOL error_string = The source file -- ($data_url) did not open uccessfully. - IF `STRINDEX(($data_url), "_expr_") GT 0 AND STRINDEX(($data_url), "analysed_") GT 0` THEN\ - DEFINE SYMBOL error_string = Failed setting up computation for `($data_($num)_var).long_name`. Try a smaller region. - ENDIF - + DEFINE SYMBOL error_string = The ($data_var) source file -- ($data_url) did not open uccessfully. + ENDIFs EXIT/SCRIPT ENDIF @@ -220,7 +217,7 @@ ENDIF ! Check for single quotes and remove them. They are ! not needed on units strings -GO LAS_unquote_string data_($num)_units +GO LAS_unquote_string lhs data_($num)_units IF ($data_units"0|*>1") THEN DEFINE SYMBOL data_units (($data_($num)_units)) diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl index 65f291237..1509c1ca3 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl @@ -1,6 +1,5 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! LAS_initialize_feature_id.jnl -! ACM 8/2020 version for DSG datasets ! ! Define variables and symbols based on feature (trajecotory or profile) ! identification variables @@ -20,19 +19,32 @@ IF `($ferret_memory"25.6") LT 200` THEN SET MEM/siz=200 DEFINE SYMBOL feature_max_labels = 200 LET featurevar = ($rowvar) -IF `($have_feature_nums"0|*>1") EQ 0` THEN LET feature_numbers = _m[ge=featurevar] +!If undefined, set up the feature_numbers variable +DEFINE AXIS/X=1:`nfeatures`:1 xfeature_axis + +IF `($have_feature_nums"0|*>1") EQ 0` THEN LET feature_numbers = x[gx=xfeature_axis] ! rind is direction of rowsize, defined in feature_initialize -LET longest = `rowsize[e=@max]` + 2 +LET longest = `featurevar[($rind)=@max]` + 2 + +LET data_var_c = EXPNDI_BY_Z_COUNTS(longitude, xsequence(featurevar),`longest`) +LET id_by_c = EXPNDI_ID_BY_Z_COUNTS(xsequence(featurevar),`longest`) ! If dsg file then these symbols are set up. IF `($data_($num)_var"0|($feature_variable)>1|*>0") AND ($rowvar"0|*>1")` THEN - DEFINE SYMBOL data_var = feature_numbers + LET data_var_expnd = EXPND_BY_LEN(feature_numbers,($rowvar), `($rowvar)[M=@sum]`) + LET data_var_id = RESHAPE (data_var_expnd, ($dsgshape_var)) + IF ($feature_type"0|*>1") THEN SET VAR/TITLE="($feature_type) ID" data_var_id + DEFINE SYMBOL data_var = data_var_id EXIT/SCRIPT ENDIF IF `($its_prop_prop_plot"0|*>1") EQ 0` THEN - DEFINE SYMBOL data_var = feature_numbers + LET data_var_expnd = EXPND_BY_LEN(feature_numbers, XSEQUENCE(featurevar), `featurevar[M=@sum]`) + LET data_var_id = RESHAPE (data_var_expnd, ($dsgshape_var)) + IF ($feature_type"0|*>1") THEN SET VAR/TITLE="($feature_type) ID" data_var_id + DEFINE SYMBOL data_var = data_var_id + EXIT/SCRIPT ENDIF @@ -42,13 +54,19 @@ ENDIF IF ($ferret_traj_list"0|*>1") THEN LET subset_ids = {($ferret_traj_list)} + LET n_subset = `subset_ids,RETURN=isize` ! Define a mask to use on the entire list of values: plot or not to plot ! the polygons on the prop-prop plot. LET subm_ids = IF ELEMENT_INDEX(traj_numbers,subset_ids) THEN 1 IF `($subset_mask"0|*>1") EQ 0` THEN LET subset_mask = subm_ids + 0*x[x=1:`ntrajs`] ! put it on a non-abstract axis. - SET DATA/FMASK=subset_mask ($num) + +! apply mask as data_var_c* subset_mask + + LET n_subset = `subset_mask[I=@NGD]` + DEFINE SYMBOL features_shown = `n_subset` + DEFINE SYMBOL prof_traj_shown = `n_subset` ELSE ! There may be a subset already defined from ferret_feature_list diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl index 8a5f5cf59..802754d64 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl @@ -25,7 +25,6 @@ ! second in comparisons etc. Keep this behavior. ! ! 10/2017 Expand the map if the region is super skinny, only for insitu data -! 2/2020 Check for existence of global attributes before using global_attnames. DEFINE SYMBOL num ($1"0") DEFINE SYMBOL region_name data_($num)_region @@ -65,14 +64,8 @@ IF `($win_aspect"0|*>1") EQ 0` THEN DEFINE SYMBOL win_aspect = 1 SET DATA "($data_0_url)" LET global_attnames = ..attnames -LET nglobal_atts = ..nattrs -LET featr = 0 -IF `nglobal_atts GT 0` THEN - IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN LET featr = 1 -ENDIF - -IF `featr GT 0` THEN +IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN IF `($win_aspect) LT 0.3` THEN DEFINE SYMBOL win_aspect = 0.3 diff --git a/JavaSource/resources/ferret/scripts/LAS_is_range.jnl b/JavaSource/resources/ferret/scripts/LAS_is_range.jnl index cf97d70e3..70441fa5a 100644 --- a/JavaSource/resources/ferret/scripts/LAS_is_range.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_is_range.jnl @@ -4,38 +4,25 @@ ! Given a min and max variables defined, see if they are valid data ! and use them to define axis min,max, delta. If min and max are not ! valid then return nominal 0:100 and set an error flag. -! 8/19 *acm* more bad-value handling -! 2/25/2020 ACM robust method usin Ferret/PyFerret internal method -! to set range for constant-valued data LET baddat = 0 CANCEL SYMBOL dm_labels -IF ($1"0|bad>1|*>0") THEN - let ok = 0 -ELSE - LET ok = IFV (($1)) THEN 1 ELSE 0 -ENDIF - +LET ok = IFV (($1)) THEN 1 ELSE 0 IF `ok` THEN DEFINE SYMBOL ax_lo = `($1)` ELSE DEFINE SYMBOl ax_lo = bad ENDIF - -IF ($2"0|bad>1|*>0") THEN - let ok = 0 -ELSE - LET ok = IFV (($2)) THEN 1 ELSE 0 -ENDIF - +LET ok = IFV (($2)) THEN 1 ELSE 0 IF `ok` THEN DEFINE SYMBOL ax_hi = `($2)` ELSE DEFINE SYMBOl ax_hi = bad ENDIF + IF `($ax_lo"0|bad>1|*>0") OR ($ax_hi"0|bad>1|*>0")` THEN LET ax_lo = 0 LET amin = 0 @@ -101,19 +88,15 @@ ELSE ! PPL %RANGE `ax_lo`, `ax_hi`, 50 PPL %RANGE `ax_lo`, `ax_hi`, 30 IF `($ppl$range_low) EQ ($ppl$range_high)` THEN - CANCEL SYMBOL yaxis* ! Ferret adds +/- a bit for const value plots - PLOT/SET {($ppl$range_low), ($ppl$range_high)} - LET ax_lo = ($yaxis_min) - LET ax_hi = ($yaxis_max) - PPL %RANGE `ax_lo`, `ax_hi`, 30 + LET del_ax = `(ax_hi - ax_lo)/10` ELSE LET ax_lo = ($ppl$range_low) LET ax_hi = ($ppl$range_high) + LET del_ax = ($ppl$range_inc) ENDIF - LET del_ax = ($ppl$range_inc) + say `ABS(ax_hi - ax_lo)` IF `ABS(ax_hi - ax_lo) LT 1` THEN DEFINE SYMBOL dm_labels = dm IF `ABS(ax_hi - ax_lo) LT 0.06` THEN DEFINE SYMBOL dm_labels = dms ENDIF ! End of file ------------ LAS_is_range.jnl-------------------------- - diff --git a/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl b/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl index 55e2b4e2f..c1d21c18b 100644 --- a/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl @@ -19,10 +19,7 @@ IF `($data_1_var"0|*>1") EQ 0` THEN EXIT/PROGRAM ENDIF - -let nmasked_var = XSEQUENCE(constraints_mask) -LET n_in_mask = nmasked_var[i=@ngd] - +LET n_in_mask = constraints_mask[i=@ngd] IF `n_in_mask eq 0` THEN DEFINE SYMBOL put_label = 1 EXIT/SCRIPT @@ -69,14 +66,6 @@ DEFINE SYMBOL fersym_command = PLOT/VS/NOLAB/NOKEY/ribbon/miss=blank/PALETTE=($f ! Start the plot. Draw an underlay of dashed-line plot for time series and map trajctory plots - -IF `itsa_tim_prop` THEN - LET tmin = p[L=@min] - LET tmax = p[L=@max] - LET t1 = `tmin[e=@min]` - LET t2 = `tmax[e=@max]` -ENDIF - IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` THEN set data/fmask=subset_mask 1 @@ -86,10 +75,10 @@ IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` T PLOT/VS/SYM=dot($hlim)($vlim)/RIBBON/NOKEY/NOLAB/PALETTE=white {0,1}, {0,1}, {0,1} ! underlay to draw the axes... (Need /hlim, /vlim for expanded axes?) IF `itsa_tim_prop AND ($connect_dots"0|0|1|*>1")` THEN \ - PLOT/t=`t1`:`t2`/NOLAB/DASH=(0.1,0.04,0.1,0.04)/color=6 q + PLOT/NOLAB/DASH=(0.1,0.04,0.1,0.04)/color=6 yvar IF `itsa_map_plot AND ($connect_dots"0|0|1|*>1")` THEN \ - PLOT/OVER/NOLAB/VS/RIBBON/DASH=(0.1,0.04,0.1,0.04)/pal=gray p,q, 0*q + PLOT/OVER/NOLAB/VS/RIBBON/DASH=(0.1,0.04,0.1,0.04)/pal=gray xvar, yvar, 0*yvar PPL COLOR,6,100,0,100 !restore default line-6 color @@ -137,11 +126,6 @@ IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` T LET yplt_var = XSEQUENCE(($yvar)) LET zplt_var = XSEQUENCE(ids_on_obs) - -! LET xplt_var = ($xvar) -! LET yplt_var = ($yvar) -! LET zplt_var = ($zvar) - DEFINE SYMBOL plot_arg = xplt_var, yplt_var, zplt_var LET ishape = 1 @@ -163,7 +147,7 @@ IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` T SET DATA/fmask=mask_for_shape 1;\ ;\ DEFINE SYMBOL color_command = GO polymark ($poly_command)/LEVELS=(`c1`,`cn+1`,1) ($plot_arg), ($shape($ishape)), ($poly_scale) ;\ - IF ($py_syms"0") THEN DEFINE SYMBOL color_command = ($pysym_command)/sym=($pyshape($ishape))/E=`c1`:`cn`/LEVELS=(`c1`,`cn+1`,1) ($plot_arg);\ + IF ($py_syms"0") THEN DEFINE SYMBOL color_command = ($pysym_command)/sym=($pyshape($ishape))/LEVELS=(`c1`,`cn+1`,1) ($plot_arg);\ ;\ ($color_command); \ ;\ @@ -183,6 +167,8 @@ ELSE ! all features, do as a PLOT not a POLY command, much faster DEFINE SYMBOL ngood_data = `p[i=@ngd]` ENDIF + + ! If location(s) of a crossover has been sent, mark them. ! This might be one point, or two, comma-separated. diff --git a/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl b/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl index fa7cdc1b3..a18c6e94e 100644 --- a/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl @@ -166,8 +166,7 @@ IF `($have_time_lab"0|*>1") EQ 0` THEN ENDIF ! Do we need a YEAR label? If its a 1-D Time plot then we do - -IF `($its_prop_prop_plot"0|*>1") OR ($its_tsplot"0|*>1")` THEN +IF ($its_prop_prop_plot"0|*>1") THEN LET L_time = `($ferret_plot_var),return=Lsize` IF `(($have_year_lab"0|*>1") EQ 0) AND (L_time GT 1)` THEN IF `(STRCMP("($fview%A%)", "T") EQ 0) AND ($region_t_lo"0|*>1") AND ($do_t"0")` THEN diff --git a/JavaSource/resources/ferret/scripts/LAS_results.jnl b/JavaSource/resources/ferret/scripts/LAS_results.jnl index d54aa92c7..3eaf23c48 100644 --- a/JavaSource/resources/ferret/scripts/LAS_results.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_results.jnl @@ -16,7 +16,6 @@ ! 10/2017 fixes for map-scale file, monthly time axis such as monthly_navy_winds ! 11/2017 add report map resolution to the log if this was a map plot ! 10/2018 changing animation product to make all the frames in one PyFerret session -! 5/2020 Define time_map_var to access time units etc without loading so much data. ! ....................................................................................... ! ! LAS_results.jnl creates the result files. @@ -48,17 +47,15 @@ ELSE ENDIF ENDIF ENDIF - ! Annotate if the selection resulted in no data ngood_data is defined for insitu datasets - IF `($ngood_data"-1|*>1") NE -1` THEN - IF `($ngood_data) EQ 0` THEN annotate/norm/x=0.52/y=0.92/halign=0/siz=0.14 "No Valid Data in the selection" + IF `($ngood_data) EQ 0` THEN annotate/norm/x=0.02/y=0.92/halign=-1/siz=0.1 "No Valid Data in the selection" ELSE IF `($ferret_annotations"0|*>1") AND ($plotvar_is_basemap"0|*>1") EQ 0 AND ($no_novalid_lab"0|*>1") NE 1` THEN stat the_plot_var IF `($stat_ngood"0|0|*>1") EQ 0` THEN \ - annotate/norm/x=0.52/y=0.92/halign=0/siz=0.14 "No Valid Data in the selection" + annotate/norm/x=0.02/y=0.92/halign=-1/siz=0.1 "No Valid Data in the selection" ENDIF ENDIF @@ -218,7 +215,7 @@ IF ($insitu_blankvar"0|*>1) THEN SHADE($insitu_blankvar_qual) ($insitu_blankvar) ELSE IF ($ax_horiz"0|T>1|*>0") THEN SET DATA 1 - LET time_map_var = ($data_0_var)[($region_full)] + LET time_map_var = ($data_0_var) IF ($insitu_blankvar"0|*>1) THEN LET time_map_var = ($insitu_blankvar) LET tt= t[GT=time_map_var] @@ -280,10 +277,9 @@ IF ($insitu_blankvar"0|*>1) THEN SHADE($insitu_blankvar_qual) ($insitu_blankvar) DEFINE SYMBOL vaxis_tstart = `TAX_DATESTRING(t1, tt, "seconds")` DEFINE SYMBOL vaxis_tend = `TAX_DATESTRING(t2, tt, "seconds")` - LET time_map_var = ($data_0_var)[($region_full)] - DEFINE SYMBOL vaxis_tunits = `time_map_var,RETURN=tunits` - DEFINE SYMBOL vaxis_torigin = `time_map_var,RETURN=t0` - DEFINE SYMBOL vaxis_tcalendar = `time_map_var,RETURN=calendar` + DEFINE SYMBOL vaxis_tunits = `($data_0_var),RETURN=tunits` + DEFINE SYMBOL vaxis_torigin = `($data_0_var),RETURN=t0` + DEFINE SYMBOL vaxis_tcalendar = `($data_0_var),RETURN=calendar` LET syms_names = {"VAXIS_TSTART", "VAXIS_TEND", "VAXIS_TUNITS", "VAXIS_TORIGIN", "VAXIS_TCALENDAR"} LET syms_vals = {"($VAXIS_TSTART)", "($VAXIS_TEND)", "($VAXIS_TUNITS)", "($VAXIS_TORIGIN)", "($VAXIS_TCALENDAR)"} LIST/APPEND/FILE="($result_map_scale_filename)"/NOHEAD/NOROWLAB syms_names, syms_vals @@ -430,25 +426,5 @@ IF ($ferret_annotations%0|*>1%) THEN GO LAS_annotations_xml ! Result "colorbar" is the legend of the plot_image...only for Google Earth IF ($result_colorbar_filename%0|*>1%) THEN GO colorbar - -! Result ref_map is a ref map. Save to result_ref_map_filename - -IF ($ferret_use_ref_map%0|false>0|*>1%) THEN - CAN VIEW - SET VIEW full - GO std_refmap ($region_0_x_lo) ($region_0_x_hi) ($region_0_y_lo) ($region_0_y_hi) $1%box% ($ref_magnify%0%) ($ref_xcompress%0%) ($ref_ycompress%0%) - FRAME/FORMAT=gif/FILE="($result_ref_map_filename)" - -ENDIF - -! If this was a map plot, report on the topo resolution used -IF ($fland_area"0|*>1") THEN - SAY _________________Map plot: Region and topo file used: - SAY _________________Map plot: XY region ($region_xy) - SAY _________________Map plot: $fland_area ($fland_area) - SAY _________________Map plot: topo file ($topo_url) -ENDIF - - ! End of file ------------LAS_results.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl b/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl index 2b2fb165b..fe632575e 100644 --- a/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl @@ -200,9 +200,6 @@ ENDIF ! end of options for twoDplot ! Do not set a /COLOR qualifier for multi-line plots ! Default is blue for line, vector, contour plots. ! Line-color is red for difference plots. -! -! IF there is already a /color in the qualifers don't add /COLOR -! unless the ferret_line_color symbol is set to override everything ! IF `($line_drawn"0|*>1") EQ 0` THEN \ DEFINE SYMBOL line_drawn = `($oneDplot"0|*>1") OR ($itsa_vector_plot"0|*>1") OR ($plot_type"0|CONTOUR>1|*>0")` @@ -213,9 +210,7 @@ IF `($line_drawn"0") AND ($itsa_multi_lineplot"0|*>1") EQ 0 AND ($nstations"1") IF ($ferret_line_color"0|multi>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR ELSE - LET has_color = STRINDEX("`UPCASE("($qualifiers)")`", "/COLOR") - IF `has_color EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color%blue|default>blue|black|red|blue|green|lightblue|purple|*%) - IF ($ferret_line_color%0|*>1%) THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color) + DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color%blue|default>blue|black|red|blue|green|lightblue|purple|*%) ENDIF ENDIF ! skipped color setting if its a multi-line plot diff --git a/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl b/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl index 0f5a56e86..cb9bd7c79 100644 --- a/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl @@ -3,12 +3,6 @@ SAY _________________ START LAS_setup_dsg: clock seconds: ($clock_secs) - -LET nglobal_atts = ..nattrs -IF `nglobal_atts EQ 0` THEN - GO LAS_error_msg Expecting Distributed Sampling Geometries file. No Global Attributes found. -ENDIF - LET global_attnames = ..attnames LET varnames = ..varnames LET nvars = ..nvars @@ -29,7 +23,6 @@ IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN ENDIF ! cf_role and sample_dimension are not included in DSG point datasets. -! rowsize isn't either. Set one up which is 1 for each point IF ($feature_type"0|point>1|*>0") THEN @@ -38,19 +31,6 @@ IF ($feature_type"0|point>1|*>0") THEN IF ($data_0_x_var"0|*>1") THEN DEFINE SYMBOL data_x_var = ($data_0_x_var) IF ($data_0_y_var"0|*>1") THEN DEFINE SYMBOL data_y_var = ($data_0_y_var) -! Define an E-direction "rowsize" variable that's 1 for each point - - LET getshape = '($data_0_var)' - DEFINE SYMBOL shape = `getshape,RETURN=shape` - IF ($shape"point>1|*>0") THEN - LET rowvar = 1 - ELSE - DEFINE SYMBOL ishape = ($shape"|X>i|Y>j|Z>k|T>l|E>m|F>n") - LET npts = `($data_0_var),return=($ishape)size` - LET rowvar = 1 + 0* _e[e=1:`npts`] - ENDIF - DEFINE SYMBOL rowvar = rowvar - EXIT/SCRIPT ENDIF diff --git a/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl index 6bb5bf794..a14ad6bce 100644 --- a/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl @@ -57,6 +57,7 @@ IF ($variable_1_lab"0|*>1") THEN IF `itsa_lon_plot OR itsa_lat_plot` THEN CANCEL SYMBOL ax_label_y ENDIF + ! If the axis labels are long, make the text size smaller LET labfac = 1. if `(labwid("($ax_label_x)", 0.12) / ($ppl$xlen)) GT 1` THEN LET labfac = ($ppl$xlen)/labwid("($ax_label_x)",0.12) diff --git a/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl b/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl index c1bbae368..e6256fed6 100644 --- a/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl +++ b/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl @@ -1,7 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Author: ACM -! 10/14 Call one of the Waterfall Plots in XZ, YZ, or ZT. +! 10/14 Call one of the Waterfal Plots in XZ, YZ, or ZT. ! ! ! Set the gif filename, changing it from .gif to the name from this request diff --git a/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl b/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl index 2e5cb0e88..f03bec738 100644 --- a/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl +++ b/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl @@ -132,16 +132,24 @@ IF `nstations EQ 1` THEN LET num_colors = ($data_count) show mode linecolors IF `num_colors LE 12` THEN +! Redefine color order to blue, red, green, lightblue, purple +! and add more + DEFINE SYMBOL nlinecolors = 13 SET MODE LINECOLORS:13 - PPL COLOR,7,100,50,0 ! orange - PPL COLOR,8,0,55,0 ! dark green - PPL COLOR,9,60,0,100 ! purple - PPL COLOR,10,100,60,70 ! pink - PPL COLOR,11,80,70,60 ! tan - PPL COLOR,12,100,75,0 ! yellow - - PPL COLOR,($nlinecolors),90,90,90 !gray + ppl color, 2, 0, 0, 100 ! blue + ppl color, 3, 100, 0, 0 ! red + ppl color, 4, 0, 100, 0 ! green + ppl color, 5, 0, 100, 100 ! lightblue + ppl color, 6, 100, 0, 100 ! purple + PPL color, 7, 100, 50, 0 ! orange + PPL color, 8, 0, 55, 0 ! dark green + PPL color, 9, 60, 0, 100 ! purple + PPL color, 10, 100, 60, 70 ! pink + PPL color, 11, 80, 70, 60 ! tan + PPL color, 12, 100, 75, 0 ! yellow + + PPL color, ($nlinecolors), 90, 90, 90 !gray DEFINE SYMBOL gryclr = ($nlinecolors) ELSE @@ -163,20 +171,24 @@ ELSE DEFINE SYMBOL gryclr = ($nlinecolors) - DEFINE SYMBOL qualifiers = ($qualifiers)/color ENDIF +DEFINE SYMBOL qualifiers = ($qualifiers)/color + + IF `($data_count) GT 1 AND nstations EQ 1` THEN DEFINE SYMBOL itsa_multi_lineplot = 1 + + ! For 1-variable, 1-station plots, turn on horizontal graticule lines, unless graticules ! have been turned off explicitly. Ignore choice of white - its in the menu ! but useless for line plots. IF `($data_count) EQ 1` THEN IF `(nstations GE max_labeled_stations) AND ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1)` THEN - IF ($ferret_use_graticules"0|black>1") THEN + IF ($ferret_use_graticules"0|black>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) DEFINE SYMBOL ferret_use_graticules = 1 ELSE @@ -186,9 +198,10 @@ IF `($data_count) EQ 1` THEN ENDIF ENDIF -IF `($data_count) GT 1 AND nstations GT 1` THEN +! IF `($data_count) GT 1 AND nstations GT 1` THEN +IF `($data_count) GT 1` THEN IF ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1) THEN - IF ($ferret_use_graticules"0|black>1") THEN + IF ($ferret_use_graticules"0|black>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) DEFINE SYMBOL ferret_use_graticules = 1 ELSE @@ -219,19 +232,22 @@ GO set_linesym ! Open the window, apply size, scale options +! +!c for now, we're just making one plot per page: multi-station for one var or multi-var for one station +!c Later, define multi viewports for multi-var plots each station or multi-station plots each var. -IF `($data_count) EQ 1 OR nstations EQ 1` THEN +!c IF `($data_count) EQ 1 OR nstations EQ 1` THEN DEFINE SYMBOL win_aspect = 0.4 -ELSE - DEFINE SYMBOL win_aspect = `0.4 + nstations/max_separate_stations` - -! ? Adjust the aspect ratio to make the plots more uniformly -! shaped as there are more and more on the page? - - LET aspects = {0.4,0.45,0.575,0.7,0.825, 0.95, 1.075, 1.2} - DEFINE SYMBOL win_aspect = `aspects[i=($data_count)]` - -ENDIF +!cELSE +!c DEFINE SYMBOL win_aspect = `0.4 + nstations/max_separate_stations` +!c +!c! ? Adjust the aspect ratio to make the plots more uniformly +!c! shaped as there are more and more on the page? +!c +!c LET aspects = {0.4,0.45,0.575,0.7,0.825, 0.95, 1.075, 1.2} +!c DEFINE SYMBOL win_aspect = `aspects[i=($data_count)]` +!c +!cENDIF GO LAS_open_window @@ -299,109 +315,41 @@ IF `($data_count) EQ 1` THEN DEFINE VIEW/AXES/X=0.08:0.99/YLIM=`vylo+0.05`:0.96 full_view SET VIEW full_view PLOT($qualifiers)($axset) ($data_var) - +paus ELSE -! Multi-variable plot of one station - IF `nstations EQ 1` THEN - sh sym data*var* - SET VAR/NAME=($data_0_var)_in ($data_0_var) - LET/LIKE=($data_0_var)_in/d=($dsetnum) ($data_0_var) = ($data_0_var)_in[gt=tt_all] - SET VAR/NAME=($data_1_var)_in ($data_1_var) - LET/LIKE=($data_1_var)_in/d=($dsetnum) ($data_1_var) = ($data_1_var)_in[gt=tt_all] - SET VAR/NAME=($data_2_var)_in ($data_2_var) - LET/LIKE=($data_2_var)_in/d=($dsetnum) ($data_2_var) = ($data_2_var)_in[gt=tt_all] - DEFINE SYMBOL ferret_view = t - DEFINE SYMBOL ferret_plot_var_0 = ($ferret_plot_var) - GO LAS_draw_multi_line_plot - -! Multi-station plots of each variable - ELSE - - - LET vxlo = 0.1 - LET vxhi = 0.9 - - LET vylo = 0.16 ! 0.2 >> 0.16 - LET vyhi = 0.94 - - - ! Draw the time axis and feature-ids just once at the bottom of the page. - - LET y2 = `vyhi` - LET del = (vyhi-vylo)/($data_count) - LET y1 = `y2 - del` + 0.05 - IF `($data_count) LE 3` THEN LET y1 = `y1 + 0.05` - - REPEAT/RANGE=1:($data_count)/NAME=s (\ - DEFINE SYMBOL s = `s`;\ - DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`y1`:`y2` vp_`s`;\ - DEFINE SYMBOL y1_($s) = `y1`;\ - DEFINE SYMBOL y2_($s) = `y2`;\ - LET y1 = `y1 - del`; LET y2 = `y2 - del`) - - ! Adjust the aspect window so that multiple variables each have space similar - ! to what is used for 2 viewports and leaving enough at the bottom for the line key - - IF `($data_count) GT 2` THEN - - LET yy2 = `vyhi` - LET yy1 = `yy2 - (vyhi-vylo)/2` + 0.1 - DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`yy1`:`yy2` vp_test - set view vp_test - plot ($data_0_var) - LET y_frac = ($ppl$ylen)/($ppl$xlen) - DEFINE SYMBOL win_aspect = `0.2 + (($data_count)+1)* y_frac` - DEFINE SYMBOL ferret_size = `($ferret_size)* (1+0.2*(($data_count)-2))` - CANCEL SYMBOL set_window_quals - CANCEL WINDOW/all - GO LAS_open_window - ENDIF - - ! Set up to draw a gray horizontal line through the middle of the plot - - LET t_all = t[gt=taxis_all] - LET tpts = {`t1`, `t2`} - - DEFINE SYMBOL draw_gray = `($data_count) GT 1` - - DEFINE SYMBOL axset = /axes=0,0,1,0 - - REPEAT/RANGE=1:`($data_count)-1`/name=ivar (\ - DEFINE SYMBOL ivar = `ivar`;\ - DEFINE SYMBOL idata `ivar-1`;\ - DEFINE SYMBOL plotvar = ($data_($idata)_var);\ - SET VIEW vp_($ivar);\ - PLOT($qualifiers)($axset)/NOLAB ($plotvar);\ - ANNOTATE/NORM/XPOS=0.02/YPOS=1.05/HALIGN=-1/SIZE=0.12 "@AC($data_($idata)_title)";\ - ANNOTATE/NOUSER/XPOS=`-0.5*($ppl$yorg)`/YPOS=`($ppl$ylen)/2`/HALIGN=0/SIZE=0.1/angle=90 "@AC($data_($idata)_units)";\ - ) - - SET VIEW vp_($data_count) - DEFINE SYMBOL axset = /axes=0,1,1,0 - - DEFINE SYMBOL ivar = ($data_count);\ - DEFINE SYMBOL idata `($ivar)-1`;\ - DEFINE SYMBOL plotvar = ($data_($idata)_var);\ - - PLOT($qualifiers)($axset)/set ($plotvar) - ppl ylab " " - ppl title " " - IF ($labnum_x"0|*>1") THEN GO unlabel ($labnum_x) - IF ($labnum_y"0|*>1") THEN GO unlabel ($labnum_y) - IF ($labnum_z"0|*>1") THEN GO unlabel ($labnum_z) - IF ($labnum_t"0|*>1") THEN GO unlabel ($labnum_t) - IF ($labnum_e"0|*>1") THEN GO unlabel ($labnum_e) - IF ($labnum_dset"0|*>1") THEN GO unlabel ($labnum_dset) - IF ($labnum_datitl"0|*>1") THEN GO unlabel ($labnum_datitl) - IF ($labnum_year"0|*>1") THEN GO unlabel ($labnum_year) - - PPL PLOT - ANNOTATE/NORM/XPOS=0.02/YPOS=1.05/HALIGN=-1/SIZE=0.12 "@AC($data_($idata)_title)" - ANNOTATE/NOUSER/XPOS=`-0.5*($ppl$yorg)`/YPOS=`($ppl$ylen)/2`/HALIGN=0/SIZE=0.1/angle=90 "@AC($data_($idata)_units)" - - ENDIF ! nstations +! multi-var. + +! Multi-variable plots: +! If with multiple stations: FOR NOW plot just the first station. + + IF `nstations GT 1` THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/M=1 + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL first_feature_only = 1 ! will make adjustments in annotations + + GO dsg_feature_name + DEFINE SYMBOL first_feature_id = `feature_name[m=1]` + DEFINE SYMBOL note_($note_num)_lab = NOTE: multiple stations and multiple variables requested: showing first station + ENDIF + + DEFINE SYMBOL iv = 0 + REPEAT/RANGE=1:($data_count)/NAME=v (\ + DEFINE SYMBOL plot_arg = ($plot_arg) ($data_($iv)_var);\ + IF `v LT ($data_count)` THEN DEFINE SYMBOL plot_arg = ($plot_arg), ;\ + DEFINE SYMBOL iv = `($iv)+1` ) + + PLOT($qualifiers)/COLOR/set ($plot_arg) + IF ($labnum_datitl"0|*>1") THEN go unlabel ($labnum_datitl) + + +DEFINE SYMBOL ngood_data = `data_good[m=@sum]` +DEFINE SYMBOL nbad_data = `data_bad[m=@sum]` + +LET nstations = `nfeatures` +DEFINE SYMBOL nstations = `nstations` + PPL PLOT ENDIF ! Add labels at the top for the location of overlaid lines @@ -413,9 +361,6 @@ GO labels_above_plot GO feature_labels -! if constraints are shown via constraint_0_lhs etc, define labels for those -GO set_constraint_labels - ! Save the results ! The script wants to get the time-axis end points. diff --git a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl index 1683ac233..e8f3bfdd2 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl @@ -271,9 +271,6 @@ ENDIF GO labels_above_plot -! if constraints are shown via constraint_0_lhs etc, define labels for those -GO set_constraint_labels - ! Draw extra points, e.g. moorings as dots. Do this last so these ! marks will be on top of everything else. diff --git a/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl b/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl index 424c370e9..23ed39452 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl @@ -17,10 +17,11 @@ GO LAS_initial_setup 0 -DEFINE SYMBOL frmt width=1024 ! /norow? +DEFINE SYMBOL frmt width=1024 IF ($ferret_data_format"0|csv>1|tsv>1|asc>1|*>0") THEN DEFINE SYMBOL frmt = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") + ENDIF CANCEL MODE INTERPOLATE ! important when evaluating the size limits @@ -29,5 +30,3 @@ SET LIST/FILE="($result_ferret_listing_filename)" GO list_traj_data - -! End of file ------------ Trajectory_Data_Convert_File.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl b/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl index 3cac1eb52..d0b2ff9fd 100644 --- a/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl +++ b/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl @@ -6,26 +6,16 @@ DEFINE SYMBOL shape = `($data_t_var),RETURN=shape` DEFINE SYMBOL indx = ($shape"0|POINT>0|X>i|Z>k|T>l|E>m|*>0") -IF ($indx"0|0|*>1") THEN - LET t1 = ($data_t_var)[($indx)=@MIN] - LET t2 = ($data_t_var)[($indx)=@MAX] - IF ($indx"|m>0|*>1") THEN - LET tmin = `t1[e=@min]` - LET tmax = `t2[e=@max]` - ELSE - LET tmin = `t1` - LET tmax = `t2` - ENDIF +LET t1 = ($data_t_var)[($indx)=@MIN] +LET t2 = ($data_t_var)[($indx)=@MAX] +IF ($indx"|m>0|*>1") THEN + LET tmin = `t1[e=@min]` + LET tmax = `t2[e=@max]` ELSE - -! single point in time - LET t1 = ($data_t_var) - LET t2 = t1 - LET tmin = t1 - LET tmax = t1 + LET tmin = `t1` + LET tmax = `t2` ENDIF - ! Adjust if start and end times are too close together LET oneday = 1 diff --git a/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl b/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl index 1057f5a73..3429b51b4 100644 --- a/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl +++ b/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl @@ -35,11 +35,9 @@ IF `IS_ELEMENT_OF_STR(var_attnames, "axis")` THEN ENDIF -! Put the name in quotes in case it's a pseudo-var such as K -LET getshape = '($vname)' -IF `STRINDEX("($vname)", "(") GT 0` THEN LET getshape = ($vname) +! Put the name in quotes in caes it's a pseudo-var such as K -DEFINE SYMBOL shape = `getshape,RETURN=shape` +DEFINE SYMBOL shape = `'($vname)',RETURN=shape` IF ($shape"0|E>0|POINT>0|*>1") THEN DEFINE SYMBOL ishape = ($shape"|X>i|Y>j|Z>k|T>l|*>nothing") IF ($ishape"nothing>1|*>0") THEN diff --git a/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl b/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl index 4c99d2da9..67bfa308c 100644 --- a/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl +++ b/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl @@ -25,7 +25,6 @@ IF ($fview"0|T>1|*>0") THEN DEFINE SYMBOL use_as = /feature=timeseries IF ($data_($num)_var"0|1|*>1") THEN DEFINE SYMBOL data_var ($data_($num)_var) IF ($data_($num)_title"0|1|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title) - ! Remove any quotes surrounding data_title string GO LAS_unquote_string data_title @@ -87,8 +86,6 @@ IF `IS_ELEMENT_OF_STR(global_attnames, "title") GT 0` THEN DEFINE SYMBOL dataset_title_att = `..title` ENDIF -DEFINE SYMBOL dset($num) = `($data_var),RETURN=dsetnum` - GO feature_initialize_plot_settings diff --git a/JavaSource/resources/ferret/scripts/feature_labels.jnl b/JavaSource/resources/ferret/scripts/feature_labels.jnl index 5e39920c8..ed353398e 100644 --- a/JavaSource/resources/ferret/scripts/feature_labels.jnl +++ b/JavaSource/resources/ferret/scripts/feature_labels.jnl @@ -11,6 +11,7 @@ IF `($feature_type"0|*>1") EQ 0` THEN EXIT/SCRIPT + IF ($feature_type"0|point>1|*>0") THEN DEFINE SYMBOL note_num = `($note_num"0") + 1` DEFINE SYMBOL note_($note_num)_lab = ($ngood_data) points shown @@ -22,14 +23,14 @@ ENDIF ! ($ngood_data) and perhaps ($nbad_data) have already been computed. -IF `($prof_traj_shown"0|*>1") EQ 0` THEN DEFINE SYMBOL prof_traj_shown = ($nfeatures) +DEFINE SYMBOL prof_traj_shown = ($nfeatures) IF `($have_feature_mask"0|*>1") EQ 0` THEN DEFINE SYMBOL maskdir = `feature_mask,RETURN=shape` IF ($maskdir"0|POINT>1|*>0") THEN DEFINE SYMBOL prof_traj_shown = 1 ELSE - IF `($prof_traj_shown) EQ ($nfeatures)` THEN DEFINE SYMBOL prof_traj_shown = `feature_mask[($maskdir)=@sum]` + IF ($prof_traj_shown"1|*>0") THEN DEFINE SYMBOL prof_traj_shown = `feature_mask[($maskdir)=@sum]` ENDIF ENDIF @@ -86,5 +87,3 @@ ENDIF! first_feature_only !---------------- end of feature_labels.jnl ------------------------- - -pause diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl index 62ec53358..c2068943c 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl @@ -1,7 +1,6 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! $Header$ ! insitu_waterfall_xz.jnl -! ACM 8/2020 version for DSG datasets ! ! Creates a XZ Waterfall plot ! @@ -21,18 +20,35 @@ DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var !DEFINE SYMBOL ribbon = 0 ! wiggly waterfall plots, still colored if there is a color palette. DEFINE SYMBOL its_insitu = 1 -! Open the dataset, analyze the DSG dataset, set up plot variables.8/19/2020 +! Open the dataset, analyze the DSG dataset, set up plot variables and +! Z-axis for plotting. GO LAS_insitu_waterfall_setup +! Make a blank plot with the correct X axis on the horizal and depth +! axis on the vertical. + +LET ntic = 10 + +PPL %range ($region_x_lo), ($region_x_hi), `ntic` +LET xlo = ($ppl$range_low) +LET xhi = ($ppl$range_high) + ! First plot sets up plot symbols. The reset_labels and color-key labeled by dates ! expect the color plot to be an overlay. -PPL COLOR,6,60,60,60 ! grey -PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_x_var), ($data_z_var) +DEFINE AXIS/x=`xlo`:`xhi`/npoints=100/units="`($data_x_var),RETURN=units`" haxis + +DEFINE SYMBOL insitu_blankvar = blankvar +LET blankvar = 100+x[gx=haxis] + z[gz=vaxis] +DEFINE SYMBOL insitu_blankvar_qual = /PAL=white/NOLAB/NOKEY/LEV=(0,1,1)($vlim) +SHADE($insitu_blankvar_qual) blankvar ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" +PPL COLOR,6,60,60,60 ! grey +PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_x_var), ($data_z_var) + PLOT/OVER/VS/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_x_var), ($data_z_var), ($data_var) IF ($ferret_annotations%0|*>1%) THEN GO reset_labels GO key_at_top @@ -47,9 +63,6 @@ DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) ! Add dataset information on the top GO feature_labels -! if constraints are shown via constraint_0_lhs etc, define labels for those -GO set_constraint_labels - ! restore key-annotation setting: keys not annotated KEYMARK 0 diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl index 8bd98f991..5263d668c 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl @@ -1,7 +1,6 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! $Header$ ! insitu_waterfall_yz.jnl -! ACM 8/2020 version for DSG datasets ! ! Creates a YZ Waterfall plot ! @@ -18,18 +17,31 @@ SET MODE verify:always ! allows for debugging DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var DEFINE SYMBOL its_insitu = 1 -! Open the dataset, analyze the DSG dataset, set up plot variables. +! Open the dataset, analyze the DSG dataset, set up plot variables and +! Z-axis for plotting. GO LAS_insitu_waterfall_setup -! First plot sets up plot symbols. The reset_labels and color-key labeled by dates -! expect the color plot to be an overlay. +! Make a blank plot with the correct Y axis on the horizal and depth +! axis on the vertical. -PPL COLOR,6,60,60,60 ! grey -PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_y_var), ($data_z_var) +LET ntic = 10 +PPL %range ($region_y_lo), ($region_y_hi), `ntic` +LET ylo = ($ppl$range_low) +LET yhi = ($ppl$range_high) + +DEFINE AXIS/y=`ylo`:`yhi`/npoints=100/units="`($data_y_var),RETURN=units`" haxis + +DEFINE SYMBOL insitu_blankvar = blankvar +LET blankvar = 100+y[gy=haxis] + z[gz=vaxis] +DEFINE SYMBOL insitu_blankvar_qual = /PAL=white/NOLAB/NOKEY/LEV=(0,1,1)($vlim) +SHADE($insitu_blankvar_qual) blankvar ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" +PPL COLOR,6,60,60,60 ! grey +PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_y_var), ($data_z_var) + PLOT/OVER/VS/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_y_var), ($data_z_var), ($data_var) IF ($ferret_annotations%0|*>1%) THEN GO reset_labels GO key_at_top @@ -43,9 +55,6 @@ DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) ! Add feature information on the top GO feature_labels -! if constraints are shown via constraint_0_lhs etc, define labels for those -GO set_constraint_labels - ! restore key-annotation setting: keys not annotated KEYMARK 0 diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl index 36b3edeab..cc6e48765 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl @@ -5,7 +5,6 @@ ! Creates a ZT Waterfall plot ! 10/2017 Fix for different-shaped data. Check that variable time_units defined before using. ! 4/2018 Ferret updates require that the time-variable has units of seconds since origin. -! ACM 8/2020 version for DSG datasets ! ! Set the gif filename, changing it from .gif to the name from this request ! Set up to write info to the debug log so that FshowGO can be used @@ -22,7 +21,8 @@ DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var DEFINE SYMBOL its_insitu = 1 -! Open the dataset, analyze the DSG dataset, set up plot variables. +! Open the dataset, analyze the DSG dataset, set up plot variables and +! Z-axis for plotting. GO LAS_insitu_waterfall_setup @@ -32,23 +32,28 @@ GO define_dsg_taxis ! del in days. Generally the graticules on time axis are too few and far between to be useful. IF `del LT 4*365` THEN CANCEL MODE graticule + +! Make a blank plot with the correct time axis on the horizal and depth +! axis on the vertical. + +DEFINE SYMBOL insitu_blankvar = blankvar +LET blankvar = 100+t[gt=taxis] + z[gz=vaxis] +DEFINE SYMBOL insitu_blankvar_qual = /PAL=white/NOLAB/NOKEY/LEV=(0,1,1)($vlim) +SHADE($insitu_blankvar_qual) blankvar + +ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" + ! Now make the ribbon plot. DEFINE SYMBOL qualifiers = ($qualifiers)/noaxes -! First plot sets up plot symbols. The reset_labels and color-key labeled by dates -! expect the color plot to be an overlay. - PPL COLOR,6,60,60,60 ! grey -PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_t_var), ($data_z_var) - +PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_t_var), ($data_z_var) PLOT/OVER/VS/OVER/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_t_var), ($data_z_var), ($data_var) IF ($ferret_annotations%0|*>1%) THEN GO reset_labels GO key_at_top PPL RIBBON/OVER -ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" - ! Add location labels as annotation notes. DEFINE SYMBOL longitude_lab = Longitude: ($region_x_lo):($region_x_hi) @@ -57,9 +62,6 @@ DEFINE SYMBOL latitude_lab = Latitude: ($region_y_lo):($region_y_hi) ! Add dataset information on the top GO feature_labels -! if constraints are shown via constraint_0_lhs etc, define labels for those -GO set_constraint_labels - ! restore key-annotation setting: keys not annotated KEYMARK 0 diff --git a/JavaSource/resources/ferret/scripts/key_at_top.jnl b/JavaSource/resources/ferret/scripts/key_at_top.jnl index fdd95407f..458100cdc 100644 --- a/JavaSource/resources/ferret/scripts/key_at_top.jnl +++ b/JavaSource/resources/ferret/scripts/key_at_top.jnl @@ -10,9 +10,6 @@ IF ($its_GE"0|*>1") THEN EXIT/SCRIPT IF `($ferret_plot_key"1|0|*>1") EQ 0` THEN EXIT/SCRIPT -! If the setting is /NOKEY then quit out. -IF `STRINDEX(UPCASE("($qualifiers%0%)"), "NOKEY") GT 0` THEN EXIT/SCRIPT - DEFINE SYMBOL horizontal_key = 1 IF `key_label_size,RETURN=defined` THEN CANCEL VAR key_label_size diff --git a/JavaSource/resources/ferret/scripts/list_a_variable.jnl b/JavaSource/resources/ferret/scripts/list_a_variable.jnl index f673f8cba..31a3a71d5 100644 --- a/JavaSource/resources/ferret/scripts/list_a_variable.jnl +++ b/JavaSource/resources/ferret/scripts/list_a_variable.jnl @@ -12,9 +12,6 @@ ! and don't rename them according to the subset. ! Also write the URL of the original dataset. ! 12/2016 set list precision to 7 -! 4/2019 Implement the property ferret_points_zt (e.g. SPURS prawler profiles). -! For plots, it's a graphical ZT plot. For data listings, add the pressure -! variable to the listing or file. ! ! Called by list_data.jnl Initialize and write a single variable, appending ! it to the ascii or netCDF output file. @@ -93,13 +90,7 @@ SET DATA/SAVE SET DATA ($data_num) LET attlist = ($data_var_nq).attnames -! When the Ferret property ferret_points_zt is defined, also list the -! pressure variable pointed to by the symbol ($ferret_points_zt) - -IF `($ferret_points_zt%0|*>1%) AND ($frmt%0|/format=cdf>1|*>0%) AND ($data_count%0|1|*>0)` THEN - DEFINE SYMBOL ferret_list_var = ($data_0_var), ($ferret_points_zt) - CANCEL ATTRIBUTE/OUTPUT (`($data_0_var),return=zaxis`).standard_name -ENDIF +sh sym ferret_list_var LET/UNITS="`($ferret_list_var),RETURN=units)`"\ the_list_var = ($ferret_list_var) diff --git a/JavaSource/resources/ferret/scripts/list_csv_data.jnl b/JavaSource/resources/ferret/scripts/list_csv_data.jnl index b1ec22f30..bf5a5b24c 100644 --- a/JavaSource/resources/ferret/scripts/list_csv_data.jnl +++ b/JavaSource/resources/ferret/scripts/list_csv_data.jnl @@ -6,8 +6,6 @@ ! 4/2013 ACM Implement the Ferret property ferret_start_memory ! 12/2013 ACM If the view includes an E direction, list the ensemble member. ! 7/20/2017 ACM -- See GitHub issue 3 fix below. -! 1/21/2020 ACM As part of issue 1770 skip over variables that duplicate ones -! already listed. ! ! Called by list_data.jnl ! Write csv data: date/time, X, Y, Z, var1, var2, ... @@ -202,28 +200,18 @@ IF `STRINDEX("($ferret_view)", "e") GT 0` THEN ENDIF ENDIF -LET/units="($data_($var_num)_units)"/TITLE="`($data_0_var),RETURN=title`" ($data_0_var_orig) = ($ferret_list_var_0) +LET/units="($data_($var_num)_units)"/TITLE="`($data_0_var),RETURN=title`" ($data_0_var_orig) = ($ferret_list_var_($var_num)) DEFINE SYMBOL vars_out = ($tlist) ($xlist) ($ylist) ($zlist) ($elist) ($data_0_var_orig) -LET csv_icount = 1 -DEFINE SYMBOL var_num = 0 - -! Build up the list of variables to write -! Skip any that were marked as duplicates of ones already in the list. - IF `($data_count"1") GT 1` THEN - REPEAT/RANGE=1:`($data_count"1")-1`/NAME=outvar \ (DEFINE SYMBOL var_num = `outvar`; \ - IF ($csv_skip_($var_num)"0") THEN EXIT/CYCLE ;\ LET/units="($data_($var_num)_units)"/TITLE="`($data_($var_num)_var),RETURN=title`" ($data_($var_num)_var_orig) = ($ferret_list_var_($var_num)); \ - DEFINE SYMBOL vars_out = ($vars_out), ($data_($var_num)_var_orig);\ - LET csv_icount = `csv_icount+1`) - + DEFINE SYMBOL vars_out = ($vars_out), ($data_($var_num)_var_orig) ) ENDIF LET ndims = `STRLEN("($ferret_view)")` -LET nlist = ndims + csv_icount +LET nlist = ndims + ($data_count) ! the default is set under 1/4 of Ferret's memory allowing for LET definitions LET use_size = 1000000*($ferret_memory)/4. diff --git a/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl b/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl index 513e10975..a86d3d55f 100644 --- a/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl +++ b/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl @@ -4,71 +4,30 @@ ! Initialize data and define 1-d list of variable to write out ! Save the original variable name and use it in the listing. -! 1/21/20 issue 1770 -! If a variable was already renamed in an init script then -! workaround was incorrect when handling naming here. -! 4/20 Make sure we don't try to access variables in dataset -! via ..varnames before the dataset has been initialized. - DEFINE SYMBOL var_num = $1 GO LAS_initialize_region ($var_num) - DEFINE SYMBOL data_($var_num)_var_orig ($data_($var_num)_var) - -! Is a variable repeated in the list? If so then ($data_($var_num)_var)_csv is already -! set up so we can skip writing it - -IF `($data_($var_num)_var)_csv,RETURN=isready` THEN - DEFINE SYMBOL csv_skip_($var_num) = 1 - EXIT/SCRIPT -ENDIF - -! Second instance of an init-script variable -IF `($data_($var_num)_var)_csv_($session_PID),RETURN=isready` THEN - DEFINE SYMBOL csv_skip_($var_num) = 1 - EXIT/SCRIPT -ENDIF - - GO LAS_initialize_data ($var_num) + LET varnames = ..varnames -! If a variable has already been renamed in an init script +! If a variable has already been renamed, in an init script ! then we need to work around that. -LET renamed_($var_num) = 0 -IF ($ferret_init_script"0|*>1") THEN - - LET renamed_($var_num) = `IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)") GT 0 AND \ - IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)_in") GT 0` - IF `renamed_($var_num) EQ 0` THEN LET renamed_($var_num) = `IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)") EQ 0` +! variable has not been renamed. We can rename it here, and then +! write the output using the original name. -ENDIF - -IF `renamed_($var_num)` THEN - - IF `($data_($var_num)_var)_csv_($session_PID),RETURN=isready` THEN - DEFINE SYMBOL ferret_plot_var_($var_num) = skip_var_($var_num) - EXIT/script - ENDIF +IF `IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)") NE 0` THEN + SET VAR/NAME=($data_($var_num)_var)_in ($data_($var_num)_var) + DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_in + GO LAS_initialize_data ($var_num) +! data_($num)_var was renamed. Use original-name plus an underscore when writing. +ELSE DEFINE SYMBOL data_($var_num)_var_orig = ($data_($num)_var)_ - LET/title="`($data_($num)_var),return=title`"/units="`($data_($num)_var),RETURN=units`" \ - ($data_($var_num)_var)_csv_($session_PID) = ($data_($num)_var)[($region_full)] - DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_csv_($session_PID) - DEFINE SYMBOL ferret_plot_var = ($data_($var_num)_var) -ELSE - - IF `(($data_($var_num)_var)_csv),RETURN=isready` THEN - DEFINE SYMBOL ferret_plot_var_($var_num) = skip_var_($var_num) - EXIT/script - ENDIF - - SET VAR/NAME=($data_($var_num)_var)_csv ($data_($var_num)_var) - DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_csv + LET/title="`($data_($num)_var),return=title`"/units="`($data_($num)_var),return=units`" ($data_($var_num)_var)_init = ($data_($num)_var)[($region_full)] + DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_init DEFINE SYMBOL ferret_plot_var = ($data_($var_num)_var) - GO LAS_initialize_data ($var_num) - ENDIF DEFINE SYMBOL ferret_plot_var_($var_num) =($ferret_plot_var) @@ -79,4 +38,3 @@ IF `($var_num) GT 0` THEN if `($size_($var_num)) NE ($size_0)` THEN MESSAGE/ERRO IF `($var_num) GT 0` THEN if `($size_($var_num)) NE ($size_0)` THEN exit/program ! End of script ---------- list_csv_define_var.jnl---------------------------- - diff --git a/JavaSource/resources/ferret/scripts/list_data.jnl b/JavaSource/resources/ferret/scripts/list_data.jnl index 2b4c24bae..37ccb0fba 100644 --- a/JavaSource/resources/ferret/scripts/list_data.jnl +++ b/JavaSource/resources/ferret/scripts/list_data.jnl @@ -11,9 +11,6 @@ ! 8/ 9/2007 ACM Allow for multiple variables, appending each to the file ! until all are written. ! 12/2016 set list precision to 7 -! 4/2019 Implement the property ferret_points_zt (e.g. SPURS prawler profiles). -! For plots, it's a graphical ZT plot. For data listings, add the -! pressure variable to the listing or file. ! ! list_data.jnl creates a listing, CDF or ASCII (based on std_list.jnl) ! Assumes symbol ferret_format which will be one of "cdf" "txt" "tsv" "csv" "asc" @@ -35,29 +32,6 @@ IF ($ferret_format%0|asc>1|*>0) THEN IF ($ferret_data_format"0|tsv>1|csv>1|asc>1|*>0") THEN DEFINE SYMBOL frmt ($frmt) = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") SET LIST/PREC=7 - - IF ($ferret_points_zt%0|*>1%) THEN - LIST/APPEND/FILE="($result_ferret_listing_filename)" "Data Is Listed at fixed z-levels. Adding pressure to this listing" - DEFINE SYMBOL nzt = ($data_count) - DEFINE SYMBOL data_count = `($data_count) + 1` - DEFINE SYMBOL data_($nzt)_dataset_name = ($data_0_dataset_name) - DEFINE SYMBOL data_($nzt)_url = ($data_0_url) - USE ($data_0_url) - DEFINE SYMBOL data_($nzt)_name = `($ferret_points_zt),return=title` - DEFINE SYMBOL data_($nzt)_region = ($data_0_region) - DEFINE SYMBOL data_($nzt)_title = `($ferret_points_zt),return=title` - DEFINE SYMBOL data_($nzt)_units = `($ferret_points_zt),return=units` - DEFINE SYMBOL data_($nzt)_var = ($ferret_points_zt) - DEFINE SYMBOL data_($nzt)_t_hi = ($region_0_t_hi) - DEFINE SYMBOL data_($nzt)_t_lo = ($region_0_t_lo) - DEFINE SYMBOL data_($nzt)_x_hi = ($region_0_x_hi) - DEFINE SYMBOL data_($nzt)_x_lo = ($region_0_x_lo) - DEFINE SYMBOL data_($nzt)_y_hi = ($region_0_y_hi) - DEFINE SYMBOL data_($nzt)_y_lo = ($region_0_y_lo) - DEFINE SYMBOL data_($nzt)_z_hi = ($region_0_z_hi) - DEFINE SYMBOL data_($nzt)_z_lo = ($region_0_z_lo) - ENDIF - ENDIF ENDIF @@ -70,6 +44,3 @@ IF ($ferret_data_format"0|csv>1|*>0") THEN ELSE REPEAT/RANGE=1:($data_count"1")/NAME=outvar (GO list_a_variable `outvar-1`; CANCEL SYMBOL ferret_list_var) ENDIF - - -! End of file ------------ list_data.jnl -------------------------- diff --git a/JavaSource/resources/ferret/scripts/list_prop_prop.jnl b/JavaSource/resources/ferret/scripts/list_prop_prop.jnl index 8eb52db2d..58f9d20ca 100644 --- a/JavaSource/resources/ferret/scripts/list_prop_prop.jnl +++ b/JavaSource/resources/ferret/scripts/list_prop_prop.jnl @@ -45,32 +45,11 @@ CANCEL DATA `($data_0_var),RETURN=dsetnum` GO setup_prop_prop -! set up any constraint labels -GO set_constraint_labels - IF `($dsgshape"0|*>1") EQ 0` THEN MESSAGE/ERROR **ERROR Expecting Discrete Sampling Geometries data EXIT/PROGRAM ENDIF - -! set up any constraint labels -GO set_constraint_labels - -! apply mask to list variables - -LET size = `constraints_mask[i=@ngd]` - -LIST/NOHEAD/NOROW/FILE/CLOBBER/FORMAT=("Total Number of Records", F10.0) `size` - -! Constraint labels - -IF `($note_num"0") GT 0` THEN - REPEAT/RANGE=1:($note_num)/name=q (\ - DEFINE SYMBOL qq = `q`; \ - SAY/OUTFILE="($result_ferret_listing_filename)"/APPEND ($note_($qq)_lab) ) -ENDIF - ! Set up the list of variables to plot. IF ($feature_variable"0|*>1") THEN DEFINE SYMBOL list_vars = ($feature_variable), diff --git a/JavaSource/resources/ferret/scripts/make_c_lab.jnl b/JavaSource/resources/ferret/scripts/make_c_lab.jnl index b0ac59c0c..a53295953 100644 --- a/JavaSource/resources/ferret/scripts/make_c_lab.jnl +++ b/JavaSource/resources/ferret/scripts/make_c_lab.jnl @@ -86,24 +86,12 @@ IF ($math_sym_convert"1|no_convert>0") THEN GO op_math_sym ($translate_math) ($o DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhs) ! Show time constraint as a formatted time -! Currently we do not have any products that do a constraint in time. - IF `($lhs"|time>1|TIME>1|*>0")` THEN IF `($timevar"0|*>1") EQ 0` THEN DEFINE SYMBOL timevar = time CANCEL SYMBOL rhsdate IF `($timeaxis"0|*>1") EQ 0` THEN - DEFINE SYMBOL shape `($timevar),RETURN=shape` - LET amin = ($timevar)[($shape)=@MIN] - LET amax = ($timevar)[($shape)=@MAX] - - ! Is this a multi-feature timeseries dataset? If so @MIN and @MAX are for each timeseries - DEFINE SYMBOL eshape `amin,RETURN=shape` - IF ($eshape"0|E>1|*>0") THEN - LET amin_featr = ($timevar)[($shape)=@MIN] - LET amax_featr = ($timevar)[($shape)=@MAX] - LET amin = `amin_featr[e=@min]` - LET amax = `amax_featr[e=@max]` - ENDIF + LET amin = ($timevar)[i=@MIN] + LET amax = ($timevar)[i=@MAX] DEFINE SYMBOL is_time = 1 GO LAS_is_range amin amax CANCEL SYMBOL is_time @@ -115,19 +103,18 @@ IF `($lhs"|time>1|TIME>1|*>0")` THEN DEFINE AXIS/T=`ax_lo`:`ax_hi`:`del_ax`/T0="`($data_t_var"time").time_origin`"/units=($tunits) timeaxis DEFINE SYMBOl timeaxis = timeaxis ENDIF - LET tt = t[gt=($timeaxis)] LET nt = `tt,RETURN=lsize` LET tn = tt[L=`nt`] DEFINE SYMBOL tn = `tn` IF `($rhs) GE tt[L=1] AND ($rhs) LE ($tn)` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[t=($rhs)], tt, "minutes")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[t=($rhs)], tt, "hours")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ELIF `($rhs) LT tt[L=1]` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[L=1], tt, "minutes")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[L=1], tt, "hours")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ELIF `($rhs) GT ($tn)` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( ($tn), tt, "minutes")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( ($tn), tt, "hours")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ENDIF IF ($rhsdate"0|*>1") THEN DEFINE SYMBOL rhs ($rhsdate) diff --git a/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl b/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl index f72982c1d..b1101791f 100644 --- a/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl +++ b/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl @@ -7,15 +7,9 @@ DEFINE SYMBOL ferret_thumb_qc2 = 1 ! Dont use finest-resolution map underlay. LET/UNITS="`longitude,RETURN=units`"/TITLE="`longitude,RETURN=title`" lon = longitude LET/UNITS="`latitude,RETURN=units`"/TITLE="`latitude,RETURN=title`" lat = latitude -DEFINE SYMBOL lonlatshape = `lon,RETURN=shape` +LET amin = `min(lon[i=@MIN]-5, 180)` +LET amax = `max(lon[i=@MAX]+5, -180)` -IF ($lonlatshape"|POINT>1|*>0") THEN - LET amin = `min(lon-5, 180)` - LET amax = `max(lon+5, -180)` -ELSE - LET amin = `min(lon[($lonlatshape)=@MIN]-5, 180)` - LET amax = `max(lon[($lonlatshape)=@MAX]+5, -180)` -ENDIF GO LAS_is_range amin amax LET xax_lo = ($ppl$range_low) @@ -25,13 +19,8 @@ LET xax_del = ($ppl$range_inc) LET varnames = ..varnames IF `IS_ELEMENT_OF_STR(varnames, "lon360") GT 0` THEN - IF ($lonlatshape"|POINT>1|*>0") THEN - LET amin = `min(lon-5, 360)` - LET amax = `max(lon+5, 0)` - ELSE - LET amin = `min(lon[($lonlatshape)=@MIN]-5, 360)` - LET amax = `max(lon[($lonlatshape)=@MAX]+5, 0)` - ENDIF + LET amin = `min(lon[i=@MIN]-5, 360)` + LET amax = `max(lon[i=@MAX]+5, 0)` GO LAS_is_range amin amax @@ -52,14 +41,8 @@ IF `ABS(xax_hi - xax_lo) LT 1` THEN DEFINE SYMBOL dm_labels = dm IF `ABS(xax_hi - xax_lo) LT 0.06` THEN DEFINE SYMBOL dm_labels = dms DEFINE AXIS/x=`xax_lo`:`xax_hi`:`del_ax`/units="($lon_units%degrees_east%)" haxis -IF ($lonlatshape"|POINT>1|*>0") THEN - LET amin = `max(lat-5, -90)` - LET amax = `min(lat+5, 90)` -ELSE - LET amin = `max(lat[($lonlatshape)=@MIN]-5, -90)` - LET amax = `min(lat[($lonlatshape)=@MAX]+5, 90)` -ENDIF - +LET amin = `max(lat[i=@MIN]-5, -90)` +LET amax = `min(lat[i=@MAX]+5, 90)` GO LAS_is_range amin amax LET yax_lo = ($ppl$range_low) @@ -94,19 +77,15 @@ GO LAS_fland ($land_palette) DEFINE SYMBOL symquals = /SIZE=0.12/THICK=1 STAT lon -LET lonconst = `($stat_std"|bad>0.01|*") LT 0.1` +LET lonconst = `($stat_std) LT 0.1` STAT lat -LET latconst = `($stat_std"|bad>0.01|*") LT 0.1` +LET latconst = `($stat_std) LT 0.1` IF `lonconst + latconst EQ 2` THEN DEFINE SYMBOL symquals = /SIZE=0.3/THICK=3 -! needed for annotations file -IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) -IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) - - IF ($zvar"0|*>1") THEN RIBBON/VS/OVER/NOLAB/KEY=HORIZ,CONT,CENT/SYM=17($symquals)/\ PALETTE=($ferret_palette"red")/LEVELS=($ferret_fill_levels"v") lon, lat, ($zvar) ELSE PLOT/VS/OVER/NOLAB/NOKEY/SYM=17($symquals)/COLOR=($lonlatcolor"red") lon, lat ENDIF + diff --git a/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl b/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl index a176b12e0..83ddd24f3 100644 --- a/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl +++ b/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl @@ -9,7 +9,6 @@ ! 11/2017 back off finding direction variables based on attributes for now ! 12/2017 changes for efficiency getting variable types ! 1/2018 Time will only be the independent variable - no vertical time axis. -! 8/2020 Updates for working with DSG datasets ! prop_prop_plot.jnl creates a property-property plot, using the ! data variable in symbol data_0_var and the second variable from @@ -39,10 +38,6 @@ CANCEL SYMBOL ferret_fill_levels CANCEL SYMBOL ferret_contour_levels CANCEL SYMBOL ferret_palette -! pale gray line for underlay -SET MODE linecolors:7 -PPL color, 7, 90, 90, 90 !gray - ! Initialize data and variables ! Set up masks for constraints @@ -89,9 +84,10 @@ IF ($ferret_use_graticules"0|0|*>1) THEN SET MODE GRATICULE:(DASH=(0.1,0.04,0.1,0.04),COLOR=black) ENDIF + ! Set the plot argument. DEFINE SYMBOL plot_arg = ($xvar), ($yvar) -DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var + DEFINE SYMBOL qualifiers = ($qualifiers)/NOLAB IF `($ferret_thumb"0|*>1") AND ($data_count"0") LE 2` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=red @@ -163,14 +159,6 @@ ENDIF ! If this is a Watch Circle plot, set that up. ! This is a hack, which can be generalized with properties or attributes. -LET itsa_lon_prop = 0 -LET itsa_lat_prop = 0 -LET itsa_tim_prop = 0 -LET itsa_lon_plot = 0 -LET itsa_lat_plot = 0 -LET itsa_tim_plot = 0 -LET itsa_map_plot = 0 - GO setup_watch_circle @@ -182,55 +170,29 @@ IF `its_watch_circle EQ 0` THEN ENDIF ENDIF -IF `($ngood_data"0|*") EQ -1` THEN - GO LAS_results box - EXIT/SCRIPT +IF `($ngood_data"0|*>1") EQ 0` THEN + LET allp = xsequence(($xvar)) + DEFINE SYMBOL ngood_data = `allp[i=@ngd]` ENDIF -DEFINE SYMBOL xvar = constraints_mask*xvar -DEFINE SYMBOL yvar = constraints_mask*yvar -LET x_plot_var = ($xvar) -LET y_plot_var = ($yvar) -IF `($data_count"0") GT 2` THEN - DEFINE SYMBOL zvar = constraints_mask*zvar - LET z_plot_var = ($zvar) -ENDIF - - -! compute # points plotted after mask applied - -LET compute_good = ($xvar)* ($yvar) - - -IF `($data_count"0") GT 2` THEN - DEFINE SYMBOL ztyp = `($zvar),return=dtype` - IF `($ztyp"0|FLOAT>1|*>0") AND ($zshape"0|POINT>0|($shape)>1|*>0")` THEN \ - LET compute_good = ($xvar)* ($yvar)* ($zvar) -ENDIF -STAT compute_good -DEFINE SYMBOL shape = `compute_good,RETURN=shape` -DEFINE SYMBOL ngood_data = ($stat_ngood) -DEFINE SYMBOL nbad_data = ($stat_nbad) - IF ($put_label"0|*>1") THEN DEFINE SYMBOL all_missing = 1 -IF `($ngood_data) EQ 0` THEN DEFINE SYMBOL all_missing = 1 DEFINE SYMBOL plot_arg = ($xvar), ($yvar) -DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var -sh sym xvar, yvar, zvar -sh var xvar,yvar - -IF `($data_count"0") GT 2` THEN DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var, z_plot_var +IF `($data_count"0") GT 2` THEN DEFINE SYMBOL plot_arg = ($xvar), ($yvar), ($zvar) IF `($all_missing"0") EQ 0` THEN !!!! or all the way to the bottom of this script ! ... let symbol size gradually increase as no. of obs gets small -DEFINE SYMBOL size_creep_factor `(($ngood_data)+300)/(($ngood_data)+100) - 1` ! [0,1] range + + + + +DEFINE SYMBOL size_creep_factor `(($ngood_data"0")+300)/(($ngood_data"0")+100) - 1` ! [0,1] range LET sym_factr = 0.9 + 1.5*($size_creep_factor) DEFINE SYMBOL plot_command = PLOT/NOLAB/VS/sym=17/SIZE=`.12*sym_factr` -DEFINE SYMBOL underlay_command = PLOT/NOLAB/RIBBON/VS/sym=17/palette=gray_light/NOKEY/SIZE=`.08*sym_factr` -DEFINE SYMBOL underlay_vars = x_plot_var, y_plot_var, y_plot_var +DEFINE SYMBOL underlay_command = PLOT/NOLAB/RIBBON/VS/sym=17/palette=gray_light/NOKEY/SIZE=`.08*sym_factr` + ! gray dashed line underlying trajectories or time series @@ -240,18 +202,6 @@ IF `itsa_map_plot` THEN DEFINE SYMBOL underlay_command = ($underlay_command)/OVER ENDIF -! Set up gray dash line and underly of gray symbols as simple line plots not ribbon plots -! Make the time coordinate variable the first argument for the ribbon plot so the scaling is right. - -IF `itsa_tim_prop AND ($connect_dots"0|0|1|*>1")` THEN !! not a /VS plot. - DEFINE SYMBOL under_line = /COLOR=7/DASH=(0.1,0.04,0.1,0.04)/NOLAB($vlim) y_plot_var - DEFINE SYMBOL underlay_command = PLOT/NOLAB/sym=17/COLOR=7/NOKEY/SIZE=`.08*sym_factr`/THICK=1 - DEFINE SYMBOL underlay_vars = y_plot_var - - DEFINE SYMBOL plot_arg = ($data_0_var), ($data_1_var), z_plot_var -ENDIF - - ! Fewer and larger symbols, use thicker line IF `.12*sym_factr GT 0.3` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=3 @@ -263,13 +213,12 @@ ENDIF DEFINE SYMBOL plot_end_command = PLOT IF `($data_count"0") GT 2` THEN IF ($color_by_levels"0|*>1") THEN DEFINE SYMBOL ferret_fill_levels = ($color_by_levels) - DEFINE SYMBOL plot_command = ($plot_command)/RIBBON/LEVELS=($ferret_fill_levels"v") + DEFINE SYMBOL plot_command = ($plot_command)/RIBBON/LEVELS=($ferret_fill_levels"v")/MISSING=blank DEFINE SYMBOL plot_end_command = RIBBON ENDIF LET x_plot_var = ($xvar) LET y_plot_var = ($yvar) -IF `($data_count"0") GT 2` THEN LET z_plot_var = ($zvar) LET have_constr = `constraints_mask,RETURN=isready` IF `have_constr EQ 0` THEN LET constraints_mask = 1 @@ -278,43 +227,22 @@ IF `color_by_feature` THEN GO LAS_pp_colorby_feature ! put_label has been set if all data is missing or constraints return no data. -ELIF ($ferret_thumb"0|*>1") THEN - IF `itsa_tim_prop ` THEN - PLOT/color=red/sym=17/title=" "/set y_plot_var - ppl ylab "($ferret_title_1)" - go unlabel ($labnum_x) - go unlabel ($labnum_e) - go unlabel ($labnum_dset) - go unlabel ($labnum_datitl) - PPL PLOT - ELSE - PLOT/VS/color=red/sym=17/title=" "/set x_plot_var, y_plot_var - ppl xlab "($ferret_title_0)" - ppl ylab "($ferret_title_1)" - go unlabel ($labnum_x) - go unlabel ($labnum_e) - go unlabel ($labnum_dset) - go unlabel ($labnum_datitl) - PPL PLOT - ENDIF ELSE + IF ($color_by"0|*>1") THEN ! Get color-plot qualifiers DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") - IF `($ngood_data"0") GT 0` THEN - IF ($ferret_plot_key"0|0|nokey>1|*>0") THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY - DEFINE SYMBOL dokey = 0 - ELSE - IF `STRINDEX(UPCASE("($qualifiers)"), "/KEY") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY - DEFINE SYMBOL dokey = 1 - ENDIF - - IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT - + IF ($ferret_plot_key"0|0|nokey>1|*>0") THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY + DEFINE SYMBOL dokey = 0 + ELSE + IF `STRINDEX(UPCASE("($qualifiers)"), "/KEY") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY + DEFINE SYMBOL dokey = 1 ENDIF + + IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT DEFINE SYMBOL color_by_title = `zvar,RETURN=title` @@ -329,24 +257,15 @@ ELSE ENDIF ! on lat/lon plots, draw a gray line on the cruise tracks. - IF `itsa_map_plot OR ($watch_plot"0|*>1") AND ($connect_dots"0|0|1|*>1") ` THEN PLOT/OVER($under_line) - - if ($watch_plot"0|*>1") THEN DEFINE SYMBOL underlay_command = ($underlay_command)/over/nolab/noaxis - -! on time plots, draw a gray line. This is the first plot, drawing the time axis - IF `itsa_tim_prop ` THEN PLOT($under_line) + IF `itsa_map_plot AND ($connect_dots"0|0|1|*>1")` THEN PLOT/OVER($under_line) ! show locations where the color-by variable is missing. This way all missing data ! is underneath good data but PLOT/RIBBON/MISSING=gray can plot lots of missing pts over ! valid ones from data already on the page PPL COLOR,6,60,60,60 ! grey - IF `($data_count"0") GT 2 AND itsa_map_plot EQ 0 AND ($watch_plot"0|*>1") EQ 0` THEN - ($underlay_command)/set ($underlay_vars) - IF ($ax_label_x"0|*>1") THEN PPL xlab ($ax_label_x) - IF ($ax_label_y"0|*>1") THEN PPL ylab ($ax_label_y) - PPL PLOT - ENDIF + + IF `($data_count"0") GT 2` THEN ($underlay_command) x_plot_var, y_plot_var, y_plot_var DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/SET @@ -367,9 +286,6 @@ ELSE DEFINE SYMBOL qualifiers = ($qualifiers)/levels=($ferret_fill_levels)/KEY=CENTER/palette=($ferret_palette) ENDIF - IF `STRINDEX("($qualifiers)", "palette") EQ 0` THEN \ - DEFINE SYMBOL qualifiers = ($qualifiers)/palette=($ferret_palette"default|*>*) - IF `STRINDEX("($qualifiers)", "OVER") GT 0` THEN DEFINE SYMBOL plot_end_command ($plot_end_command)/OVER ($plot_command)($qualifiers) ($plot_arg) IF `($ferret_annotations%0|*>1%) AND ($dokey"0|1>1|*>1")` THEN GO key_at_top @@ -380,11 +296,12 @@ ENDIF ! color-by-feature or not... ! This allows for auto-levels on prop-prop plots. IF ($color_by"0|*>1") THEN - LET data_range = MINMAX(constraints_mask*zvar) + LET data_range = minmax(constraints_mask*zvar) DEFINE SYMBOL data_plotted_min = `data_range[i=1],prec=7` DEFINE SYMBOL data_plotted_max = `data_range[i=2],prec=7` ENDIF + IF `($color_by_title"0|*>1") AND ($ferret_annotations%0|*>1%) EQ 0` THEN \ LABEL/NOUSER `($ppl$width)-($ppl$xorg)-0.2`, -0.7, 1, 0, 0.12 Colored by ($color_by_title) @@ -400,25 +317,17 @@ LET q = ($yvar) IF `itsa_map_plot or itsa_tim_prop` THEN DEFINE SYMBOL do_rsquare = 0 -! ~ 85 points gives a confidence of 0.8 - -IF `($do_rsquare"1|0|*>1) AND ($ngood_data"0") LT 85` THEN - DEFINE SYMBOL do_rsquare = 0 - IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/COLOR=blue moveable - DEFINE SYMBOL rsqlab = Too few points to compute - LET wid = `LABWID("($rsqlab)", 0.1)` - LABEL/NOUSER -0.5,-0.42,-1, 0, 0.1, Too few points to compute - LABEL/NOUSER -0.5,-0.6,-1, 0, 0.1, regression line -ENDIF - DEFINE SYMBOL line_color = blue ! regression line IF ($polycolor%0|blue>1|*>0%) THEN DEFINE SYMBOL line_color = red +IF ($do_rsquare"1|0|*>1) THEN GO LAS_regressx + +IF `($ngood_data"0") eq 0` THEN DEFINE SYMBOL do_rsquare = 0 + ! Note do_rsquare is set in LAS_xytvar_setup, where plots with time, lon, or ! lat axes are set to NOT draw the regression line. IF ($do_rsquare"1|0|*>1) THEN - GO LAS_regressx ! Note that qhat in the regress script is defined as ! LET qhat = slope*p + intercep @@ -475,13 +384,8 @@ IF ($do_rsquare"1|0|*>1) THEN ENDIF -ELSE ! all_missing, make a nominal plot so LAS_results has something to work with - - plot/vs/nolab/noax/sym=dot/vlim=-1:1/hlim=-1:1 {-2,2}, {-2,2} +ENDIF ! all_missing or not... -ENDIF - -show data/att; pause ! notation with number of cruises, trajectories, or profiles and obs. GO feature_labels @@ -508,6 +412,7 @@ IF ($note_num"0|*>1") THEN ) ENDIF + GO LAS_results box ! ----- End of prop_prop_plot.jnl ------------------------------------------------ diff --git a/JavaSource/resources/ferret/scripts/reset_labels.jnl b/JavaSource/resources/ferret/scripts/reset_labels.jnl index 50fbd4ee5..55efea8d1 100644 --- a/JavaSource/resources/ferret/scripts/reset_labels.jnl +++ b/JavaSource/resources/ferret/scripts/reset_labels.jnl @@ -3,11 +3,7 @@ ! Define symbols used by the annotations xml ! 1/2018 issue 1854 Inside of a SHADE/SET, LET commands that redefine a variable can ! cause curvi coord data to be wiped out. As a workaround, cancel any vars we define -! 3/2020 Issue 1773 If the data is really monthly or yearly, can configure with the -! ferret property month or year -! Here, implement a hack for datasets with timesteps defined e.g. -! as month-since 1-Jan-1990 so timesteps fall near the startor end of month -! THEN a request for Nov-1990 gets the timestep at 31-Oct-1990:15:00 + IF ($xform_dms"0|*>1") THEN PPL XFOR (($xform_dms)) IF ($yform_dms"0|*>1") THEN PPL YFOR (($yform_dms)) @@ -39,28 +35,8 @@ IF `($data_count"1") EQ 1` THEN ENDIF IF ($labnum_t"0|*>1") THEN DEFINE SYMBOL time_lab ($lab($labnum_t)) - -! HACK: does the time match the region request down to month/year? - IF `($ferret_timelab_res"0|month>1|*>0") AND \ - STRCMP("($region_t_lo)", "($region_t_hi)") EQ 0` THEN - LET month = SUBSTRING("($time_lab)", 1, 3) - LET dash = STRINDEX("($REGION_T_LO)", "-") - LET rmonth = SUBSTRING ("($REGION_T_LO)", dash+1, 3) - IF `STRCMP(month, rmonth) NE 0` THEN - LET ryear = SUBSTRING ("($REGION_T_LO)", dash+5, 4) - DEFINE SYMBOL time_lab = TIME : `UPCASE(rmonth)`-`ryear` - ENDIF - ENDIF - IF `($ferret_timelab_res"0|year>1|*>0") AND \ - STRCMP("($region_t_lo)", "($region_t_hi)") EQ 0` THEN - LET dash = STRINDEX("($REGION_T_LO)", "-") - LET ryear = SUBSTRING ("($REGION_T_LO)", dash+5, 4) - IF `STRCMP("($time_lab)", ryear) NE 0` THEN - DEFINE SYMBOL time_lab = TIME : `ryear` - ENDIF - ENDIF ENDIF - + IF ($labnum_calend"0|*>1") THEN DEFINE SYMBOL calendar_lab ($lab($labnum_calend)) ENDIF diff --git a/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl b/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl index bc5056e38..73320690d 100644 --- a/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl +++ b/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl @@ -77,5 +77,3 @@ IF ($ferret_annotate_with"0|*>1") THEN ENDIF !-----------------End of set_constraint_labels --------------------------------- - -pause diff --git a/JavaSource/resources/ferret/scripts/set_linesym.jnl b/JavaSource/resources/ferret/scripts/set_linesym.jnl index 3c1ffde8a..98e9d5fa8 100644 --- a/JavaSource/resources/ferret/scripts/set_linesym.jnl +++ b/JavaSource/resources/ferret/scripts/set_linesym.jnl @@ -50,17 +50,16 @@ ELSE let ngood = plotvar[($getgood)] let nbad = plotvar[($getbad)] - - IF ($dsgshape"0|*>1") THEN - stat plotvar - LET ngood = ($stat_ngood) - let nbad = ($stat_nbad) - ENDIF - ENDIF ! curvilinear or not LET npoints = ngood + nbad +DEFINE SYMBOL shape = `npoints,RETURN=shape` +IF ($shape"0|POINT>0|E>1") THEN + LET epoints = ngood + nbad + LET nmax = epoints[e=@max] + LET npoints = `nmax[e=1]` ! works around a bug where the context of `nmax[e=1]` is nfeatures long, not 1 +ENDIF LET nminpts = 120 IF ($itsa_multi_lineplot"0|*>1") THEN LET nminpts = 15 diff --git a/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl b/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl index 3c4ee774b..a5eceb1b5 100644 --- a/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl +++ b/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl @@ -356,11 +356,10 @@ IF `($data_count"0") GE 3` THEN ! color by 3rd variable DEFINE SYMBOL zshape = `($ferret_plot_var_2),return=shape` DEFINE SYMBOL zshape = ($zshape"|POINT>E|*") LET zvar = _($zshape"|X>i|Y>j|Z>k|T>l|E>m|F>n")[g($zshape)=($ferret_plot_var_2)] - ELSE - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = ($data_2_title) is not numeric. Plot without color. - CANCEL SYMBOL ferret_plot_var - ENDIF + ENDIF + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL note_($note_num)_lab = ($data_2_title) is not numeric. Plot without color. + CANCEL SYMBOL ferret_plot_var ENDIF ENDIF diff --git a/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl b/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl index 55fbe582c..94aeda99a 100644 --- a/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl +++ b/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl @@ -117,21 +117,20 @@ let q_var = q + pqmask ! Define axes for both variables using the range in the data !--------- -LET amin = p_var[t=@MIN] -LET amax = p_var[t=@MAX] -LET bmin = q_var[t=@MIN] -LET bmax = q_var[t=@MAX] -list amin,amax,bmin,bmax +LET amin = p_var[i=@MIN] +LET amax = p_var[i=@MAX] +LET bmin = q_var[i=@MIN] +LET bmax = q_var[i=@MAX] -LET locx = ($deploy_lon)[e=1] -LET locy = ($deploy_lat)[e=1] +LET locx = ($deploy_lon)[i=1] +LET locy = ($deploy_lat)[i=1] ! Compute radius of circle: max excursion from the deployment location. ! The plot range is the max of this size and the watch circle radius -LET radii = ((p_var - (`locx`))^2 + (q_var - (`locy`))^2)^0.5 -LET wc_rad_compute = radii[t=@max] +LET radii = ((p_var - locx)^2 + (q_var - locy)^2)^0.5 +LET wc_rad_compute = radii[i=@max] LET wc_rad = wc_rad_compute LET axis_add = wc_rad_compute @@ -209,7 +208,7 @@ PPL SHADE PLOT/VS/OVER/NOLAB/THICK=3/sym=21/SIZ=0.2/color=lightblue locx, locy PLOT/VS/OVER/NOLAB/THICK=3/sym=27/SIZ=0.18/color=black locx, locy -PLOT/VS/OVER/NOLAB/LINE/k=1:628/COLOR=6/pal=rnb `locx` + `wc_rad`*cos(k/100), `locy` + `wc_rad`*sin(k/100) +PLOT/VS/OVER/NOLAB/LINE/k=1:628/COLOR=6/pal=rnb locx + wc_rad*cos(k/100), locy + wc_rad*sin(k/100) ! If put_label was defined, something caused one or both variables to be all BAD. IF ($put_label"0|*>1") THEN @@ -270,6 +269,4 @@ DEFINE SYMBOL yvar = constraints_mask*yvar LET p = ($xvar) LET q = ($yvar) -define symbol watch_plot = 1 - ! End of file setup_watch_circle.jnl-------------------------- From fac02d1a674ab835d71abfbd836aa6694e6ffee2 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Thu, 24 Sep 2020 17:25:10 -0700 Subject: [PATCH 05/15] initial placement of watermarks in images --- .../resources/ferret/scripts/LAS_open_window.jnl | 14 +++++++------- .../resources/ferret/scripts/set_full_margins.jnl | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl index 0ad9e9a0e..b7357eb0d 100644 --- a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl @@ -33,9 +33,9 @@ IF `($set_window_quals"0|*>1") EQ 0` THEN \ DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5") CANCEL MODE LOGO -let wmark = 0 -IF ($ferret_wmark_image"0|*>1") THEN - LET wmark = 1 +DEFINE SYMBOL wmark = 0 +IF `($ferret_wmark_image"0|*>1" AND ($ferret_version) GT 7.63` THEN + DEFINE SYMBOL wmark = 1 DEFINE SYMBOL set_window_quals = ($set_window_quals)/\ wmark="($ferret_wmark_image)"/wmscale=0.5/wmopac=50 /wmxloc=5/wmyloc=5 ENDIF @@ -68,7 +68,7 @@ SET WINDOW($set_window_quals) IF `($ferret_margins"1|0|1|false>0|true>1") EQ 0` THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:1 WMSview - IF `wmark` THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:.8 WMSview + IF ($wmark"0|*>1") THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:.8 WMSview SET VIEW WMSview IF `STRLEN("($ferret_view)") LT 2` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/NOYADJUST @@ -76,8 +76,8 @@ ELSE ! For 2D plots, make room for the colorbar labels which sometimes get cut off. IF `STRLEN("($ferret_view)") GE 2` THEN DEFINE VIEW/X=0:0.95/Y=0:1 xspace - IF `wmark` THEN DEFINE VIEW/X=0:0.95/Y=0:.8 xspace - IF `wmark` THEN DEFINE VIEW/X=0:0.95/Y=0:.5 xspace + IF ($wmark"0|*>1") THEN DEFINE VIEW/X=0:0.95/Y=0:.8 xspace + IF ($wmark"0|*>1") THEN DEFINE VIEW/X=0:0.95/Y=0:.5 xspace SET VIEW xspace ELSE ! For 1D plots we may be doing a line key in a new viewport, so set the initial viewport. @@ -88,7 +88,7 @@ ELSE DEFINE SYMBOL win_aspect = 0.4 ENDIF SET WIN/ASPECT=($win_aspect)/:axis - IF `wmark` THEN SET WIN/ASPECT=($win_aspect)/wmark="($ferret_wmark_image)" + IF ($wmark"0|*>1") THEN SET WIN/ASPECT=($win_aspect)/wmark="($ferret_wmark_image)" ENDIF ENDIF diff --git a/JavaSource/resources/ferret/scripts/set_full_margins.jnl b/JavaSource/resources/ferret/scripts/set_full_margins.jnl index a90deda22..f9389c151 100644 --- a/JavaSource/resources/ferret/scripts/set_full_margins.jnl +++ b/JavaSource/resources/ferret/scripts/set_full_margins.jnl @@ -23,7 +23,7 @@ IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN LET y_up_t = 0.99 ENDIF -IF `wmark` THEN +IF ($wmark"0|*>1") THEN LET y_up = `y_up - 0.04` LET y_up_t = `y_up_t - 0.6` ENDIF From 01aa4b1af92b411a6c369d57872173a20004d5ba Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Thu, 24 Sep 2020 17:26:07 -0700 Subject: [PATCH 06/15] initial placement of watermarks in images --- JavaSource/resources/ferret/scripts/LAS_open_window.jnl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl index b7357eb0d..760098ad8 100644 --- a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl @@ -34,7 +34,7 @@ IF `($set_window_quals"0|*>1") EQ 0` THEN \ CANCEL MODE LOGO DEFINE SYMBOL wmark = 0 -IF `($ferret_wmark_image"0|*>1" AND ($ferret_version) GT 7.63` THEN +IF `($ferret_wmark_image"0|*>1") AND ($ferret_version) GE 7.63` THEN DEFINE SYMBOL wmark = 1 DEFINE SYMBOL set_window_quals = ($set_window_quals)/\ wmark="($ferret_wmark_image)"/wmscale=0.5/wmopac=50 /wmxloc=5/wmyloc=5 From c3a37bdd1707c8c47fde07876a559baa155b5b36 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Fri, 25 Sep 2020 14:08:38 -0700 Subject: [PATCH 07/15] new script for setting watermark settings --- .../ferret/scripts/LAS_setup_watermark.jnl | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl diff --git a/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl b/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl new file mode 100644 index 000000000..048dd7c08 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl @@ -0,0 +1,26 @@ +! LAS_setup_watermark.jnl +! Add the settings for a watermark image to the +! quqlifiers in symbol set_window_quals + +! How do we know what the size of the watermark image is? +! Assume it's ~100 pixels; The LAS configurer creates the right size image? +! The linux command returns the image info including size in pixels. +! identify -ping imagefile.png + +LET wmscale = 1 ! scale factor: +LET wmopac = 50 ! percent opacity + +! Watermark in the upper left +IF ($wmark"0|ul>1|*>0") THEN + LET wmxloc = 5 ! pixels from upper left corner + LET wmyloc = 5 ! pixels from upper left corner +ENDIF + +! Watermark in the lower left +IF ($wmark"0|ll>1|*>0") THEN + LET wmxloc = 5 ! pixels from upper left corner + LET wmyloc = pix_y - 100 ! pixels from upper left corner +ENDIF + +IF ($wmark"0|*>1") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)\ + /wmark="($ferret_wmark_image)"/wmscale=`wmscale`/wmopac=`wmopac`/wmxloc=`wmxloc`/wmyloc=`wmyloc` From de56c45fac16f32b5dab9ad3ce9d6a6fa53a1082 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Fri, 25 Sep 2020 14:08:53 -0700 Subject: [PATCH 08/15] restore scripts from baker trunk for DSG-enabled PyFerret --- .../ferret/scripts/LAS_annotations_xml.jnl | 3 +- .../ferret/scripts/LAS_define_etopo.jnl | 23 +- .../scripts/LAS_draw_multi_line_plot.jnl | 28 ++- .../ferret/scripts/LAS_initial_setup.jnl | 12 +- .../ferret/scripts/LAS_initialize_data.jnl | 6 + .../scripts/LAS_initialize_data_std.jnl | 12 +- .../ferret/scripts/LAS_initialize_dataset.jnl | 9 +- .../scripts/LAS_initialize_feature_id.jnl | 30 +-- .../ferret/scripts/LAS_initialize_region.jnl | 9 +- .../resources/ferret/scripts/LAS_is_range.jnl | 29 ++- .../ferret/scripts/LAS_open_window.jnl | 111 ++++++---- .../ferret/scripts/LAS_pp_colorby_feature.jnl | 26 ++- .../scripts/LAS_pp_set_region_labels.jnl | 3 +- .../resources/ferret/scripts/LAS_results.jnl | 36 +++- .../scripts/LAS_set_plot_qualifiers.jnl | 7 +- .../ferret/scripts/LAS_setup_dsg.jnl | 20 ++ .../ferret/scripts/LAS_xytvar_setup.jnl | 2 - .../ferret/scripts/Plot_2D_Profile.jnl | 2 +- .../scripts/Timeseries_station_plot.jnl | 197 +++++++++++------- .../ferret/scripts/Trajectory_2D_poly.jnl | 3 + .../scripts/Trajectory_Data_Convert_File.jnl | 5 +- .../ferret/scripts/define_dsg_taxis.jnl | 24 ++- .../ferret/scripts/dsg_find_roles.jnl | 6 +- .../feature_initialize_data_insitu.jnl | 3 + .../ferret/scripts/feature_labels.jnl | 6 +- .../ferret/scripts/insitu_waterfall_xz.jnl | 27 +-- .../ferret/scripts/insitu_waterfall_yz.jnl | 27 +-- .../ferret/scripts/insitu_waterfall_zt.jnl | 26 ++- .../resources/ferret/scripts/key_at_top.jnl | 3 + .../ferret/scripts/list_a_variable.jnl | 11 +- .../ferret/scripts/list_csv_data.jnl | 18 +- .../ferret/scripts/list_csv_define_var.jnl | 66 ++++-- .../resources/ferret/scripts/list_data.jnl | 29 +++ .../ferret/scripts/list_prop_prop.jnl | 21 ++ .../resources/ferret/scripts/make_c_lab.jnl | 23 +- .../ferret/scripts/prop_prop_map_thumb.jnl | 39 +++- .../ferret/scripts/prop_prop_plot.jnl | 162 +++++++++++--- .../resources/ferret/scripts/reset_labels.jnl | 28 ++- .../ferret/scripts/set_constraint_labels.jnl | 1 + .../ferret/scripts/set_full_margins.jnl | 49 +++-- .../resources/ferret/scripts/set_linesym.jnl | 13 +- 41 files changed, 818 insertions(+), 337 deletions(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl b/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl index 81bd0a79c..00399d6f6 100644 --- a/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl @@ -32,7 +32,8 @@ DEFINE SYMBOL out = GO write_to_xml ! orthogonal axis labels -IF `($longitude_lab%0|*>1%)+($latitude_lab%0|*>1%)+($depth_lab%0|*>1%)+($time_lab%0|*>1%)+($ens_lab%0|*>1%)+($forecast_lab%0|*>1%) GT 0` THEN \ + +IF `($longitude_lab%0|*>1%)+($latitude_lab%0|*>1%)+($depth_lab%0|*>1%)+($time_lab%0|*>1%)+($year_lab%0|*>1%)+($ens_lab%0|*>1%)+($forecast_lab%0|*>1%) GT 0` THEN \ GO annotation_orthogonal_axes ! variable and dataset labels diff --git a/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl b/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl index 79ae016a8..d607397d1 100644 --- a/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_define_etopo.jnl @@ -2,7 +2,7 @@ ! See if there are etopo2 and etopo1 in the same ! directory as etopo5 ! 11/2017 Add topo015 as an option, define topo*url symbols - +! 7/2020 Do not look for topo50 dataset as a local file. DEFINE SYMBOL topo20_url = etopo20 DEFINE SYMBOL topo5_url = etopo5 @@ -14,28 +14,27 @@ LET epath = "`rose,RETURN=dsetpath`" LET eloc = STRINDEX(epath,"etopo") LET justpath = SUBSTRING(epath,1,eloc-1) -IF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc") EQ 0` THEN - DEFINE SYMBOL topo2_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc +IF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc") EQ 0` THEN + DEFINE SYMBOL topo2_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo2.nc ELSE LET e2file = STRCAT(justpath, "etopo2.nc") IF `TEST_OPENDAP(e2file) EQ 0` THEN DEFINE SYMBOL topo2_url = `e2file` ENDIF -IF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc") EQ 0` THEN - DEFINE SYMBOL topo1_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc -ELIF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc") EQ 0` THEN - DEFINE SYMBOL topo1_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc +IF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc") EQ 0` THEN + DEFINE SYMBOL topo1_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo1.nc +ELIF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc") EQ 0` THEN + DEFINE SYMBOL topo1_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/etopo01.nc ELSE LET e1file = STRCAT(justpath, "etopo1.nc") IF `TEST_OPENDAP(e2file) EQ 0` THEN DEFINE SYMBOL topo1_url = `e1file` ENDIF -IF `TEST_OPENDAP("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc") EQ 0` THEN - DEFINE SYMBOL topo_015_url = http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc -ELIF `TEST_OPENDAP("/home/data/topography/topo15_compressed.nc") EQ 0` THEN - DEFINE SYMBOL topo_015_url = /home/data/topography/topo15_compressed.nc +IF `TEST_OPENDAP("https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc") EQ 0` THEN + DEFINE SYMBOL topo_015_url = https://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/topo15_compressed.nc ENDIF CANCEL DATA etopo5 -! --------------- End of LAS_define_etopo --------------------------- \ No newline at end of file +! --------------- End of LAS_define_etopo --------------------------- + diff --git a/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl b/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl index cdce82914..5307ea9d0 100644 --- a/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_draw_multi_line_plot.jnl @@ -9,10 +9,13 @@ ! 11/2017 *acm* Dont label plots with units of "units" or "none" ! 12/2017 *acm* Apply positive=down attribute if all variables in a ! units-group have that setting. +! 10/2019 *acm* For time plots if there's a year-label needed, save symbol +! to be added to the annotations +! 10/2019 *acm* Fix use of plot_pos_down_* symbols so vertical axis doesn't +! get incorrectly flipped. set mode ver:always - LET xvf = ($1%0.1%) LET xvl = ($2%0.9%) @@ -136,6 +139,14 @@ REPEAT/RANGE=2:`($nunit_grp"1")`/NAME=m (\ LET maxlablen = `MAX(maxlablen, STRLEN("($PPL$YMIN1)"))`;\ LET maxlablen = `MAX(maxlablen, STRLEN("($PPL$YMAX1)"))`) +! Set a year-label for the annotations if Ferret has added an upper-left year label +IF `(($have_year_lab"0|*>1") EQ 0) AND ($labnum_year%0|*>1%)` THEN + DEFINE SYMBOL n_left_labels = `($n_left_labels"0") + 1` + DEFINE SYMBOL upper_left_($n_left_labels) = ($lab($labnum_year)) + DEFINE SYMBOL year_lab = ($lab($labnum_year)) + DEFINE SYMBOL have_year_lab = 1 +ENDIF + ! Draw any other plot axes scaled for each set of variables with common units ! Plot axis with first set of units will be on the left. ! Draw the plots for other sets of variables as /SYM=dot/COLOR=8 (COLOR=white) so that @@ -168,7 +179,7 @@ REPEAT/RANGE=1:`($nunit_grp"1")`/NAME=m (\ GO LAS_get_lines_min_max `vplotnum`;\ PPL %range `vlimylo`, `vlimyhi`, 10;\ DEFINE SYMBOL qualifiers_g($vm) = /VLIM=($ppl$range_low):($ppl$range_high);\ - IF ($plot_pos_down"($vm)|0|1|*>1") THEN DEFINE SYMBOL qualifiers_g($vm) = /VLIM=($ppl$range_high):($ppl$range_low);\ + IF ($plot_pos_down_($vm)"0|0|1|*>1") THEN DEFINE SYMBOL qualifiers_g($vm) = /VLIM=($ppl$range_high):($ppl$range_low);\ IF `($vm) GT 0` THEN;\ PLOT/AXES=0,0,0,1($qualifiers_g($vm))/SYM=dot/COLOR=8/NOLAB {0,1};\ LET do_lab = ($group_label_($vm)"0|NONE>0|none>0|units>0|*>1");\ @@ -194,6 +205,18 @@ SET VIEW v0_v($vpname)($vm) IF ($ferret_view"1|t>0|*>1") THEN SET MODE GRATICULE:(DASH,COLOR=($graticuleColor)) +! Draw the first line to capture the year-label if any. Draw again below with /NOLAB and other qualifiers. +! Set a year-label for the annotations if Ferret has added an upper-left year label + +PLOT ($ferret_plot_var_($vm)) + +IF `(($have_year_lab"0|*>1") EQ 0) AND ($labnum_year%0|*>1%)` THEN + DEFINE SYMBOL n_left_labels = `($n_left_labels"0") + 1` + DEFINE SYMBOL upper_left_($n_left_labels) = ($lab($labnum_year)) + DEFINE SYMBOL year_lab = ($lab($labnum_year)) + DEFINE SYMBOL have_year_lab = 1 +ENDIF + PLOT($qualifiers)($qualifiers_0)($qualifiers_g($vm))($axqual)/COLOR=($leg_color($vm))/NOLAB ($ferret_plot_var_($vm)) LET do_lab = ($group_label_($vm)"0|NONE>0|none>0|units>0|*>1") @@ -246,4 +269,3 @@ DEFINE SYMBOL xaxis_min = ($xax_min_save) DEFINE SYMBOL xaxis_max = ($xax_max_save) ! --------------- End of LAS_draw_multi_line_plot --------------------------- - diff --git a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl index 4b611d68a..9d52e3064 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl @@ -12,11 +12,6 @@ SET MODE VERIFY:ALWAYS -! Put into the debug output what PyFerret/Ferret is running, and when. - -SHOW SYMBOL ferret_version, ferret_platform, program_name, current_date -SHOW MEMORY - DEFINE SYMBOL initialize_script_arg = ($1"2") ! Make sure to do the SET REDIRECT just once. @@ -26,7 +21,12 @@ DEFINE SYMBOL initial_setup_done = 1 ! Put the output into the log file so that FshowGO will list ! the tree of GO script calls. -SET REDIRECT/APPEND/TEE/file="($result_debug_filename)" STDOUT,STDERR +SET REDIRECT/CLOBBER/TEE/file="($result_debug_filename)" STDOUT,STDERR + +! Put into the debug output what PyFerret/Ferret is running, and when. + +SHOW SYMBOL ferret_version, ferret_platform, program_name, current_date +SHOW MEMORY IF `($initialize_script_arg) EQ 0` THEN EXIT/SCRIPT diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl index e04dde840..c7857e566 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_data.jnl @@ -24,6 +24,12 @@ IF `($ferret_start_memory"0") GT 0` THEN SET MEM/SIZ=($ferret_start_memory) IF `($data_initialization_script"0|*>1") EQ 0` THEN \ DEFINE SYMBOL data_initialization_script LAS_initialize_data_std GO ($data_initialization_script) ($1) +IF ($error_string"0|*>1") THEN + IF `STRINDEX(($data_url), "_expr_") GT 0 AND STRINDEX(($data_url), "analysed_") GT 0` THEN\ + DEFINE SYMBOL error_string = Failed setting up computation for `($data_($num)_var).long_name`. Try a smaller region. + MESSAGE/ERROR **ERROR ($error_STRING) + EXIT/PROGRAM +ENDIF GO LAS_unquote_string data_title diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl index f226466b8..60d29c705 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_data_std.jnl @@ -30,7 +30,9 @@ ! in the dataset configuration as ferret_init_commands, whose the value is a set ! of Ferret commands separated by semicolons. ! -! 10/4/2016 fixes so init scripts still work +! 10/4/2016 fixes so init scripts still work +! 1/ 2020 improved error messages on initializing dataset +! 1/20/2020 For multiple variables (e.g. a csv listing of vars) do not run init script multiple times ! GO LAS_initialize_dataset ($1"0") @@ -47,7 +49,13 @@ IF ($error_status"0|ERROR>1|*>1") THEN EXIT/PROGRAM ENDIF -IF ($ferret_init_script"0|*>1") THEN GO ($ferret_init_script) ($dset($1"0")) +! Generally don't want to run init scripts more than once; variables +! have been renamed. + +IF `($ferret_init_script"0|*>1") AND ($init_script_done"0") EQ 0` THEN + GO ($ferret_init_script) ($dset($1"0")) + DEFINE SYMBOL init_script_done = 1 +ENDIF IF ($ferret_init_commands"0|*>1") THEN ($ferret_init_commands) diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl index dac4008e9..babf385fc 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_dataset.jnl @@ -40,8 +40,11 @@ IF ($fer_last_error"0|0|1|*>1") THEN IF `($error_status"0|*>1") EQ 0` THEN ! if errors not yet set. DEFINE SYMBOL error_status = ERROR DEFINE SYMBOL error_type = DATA - DEFINE SYMBOL error_string = The ($data_var) source file -- ($data_url) did not open uccessfully. - ENDIFs + DEFINE SYMBOL error_string = The source file -- ($data_url) did not open uccessfully. + IF `STRINDEX(($data_url), "_expr_") GT 0 AND STRINDEX(($data_url), "analysed_") GT 0` THEN\ + DEFINE SYMBOL error_string = Failed setting up computation for `($data_($num)_var).long_name`. Try a smaller region. + ENDIF + EXIT/SCRIPT ENDIF @@ -217,7 +220,7 @@ ENDIF ! Check for single quotes and remove them. They are ! not needed on units strings -GO LAS_unquote_string lhs data_($num)_units +GO LAS_unquote_string data_($num)_units IF ($data_units"0|*>1") THEN DEFINE SYMBOL data_units (($data_($num)_units)) diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl index 1509c1ca3..65f291237 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl @@ -1,5 +1,6 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! LAS_initialize_feature_id.jnl +! ACM 8/2020 version for DSG datasets ! ! Define variables and symbols based on feature (trajecotory or profile) ! identification variables @@ -19,32 +20,19 @@ IF `($ferret_memory"25.6") LT 200` THEN SET MEM/siz=200 DEFINE SYMBOL feature_max_labels = 200 LET featurevar = ($rowvar) -!If undefined, set up the feature_numbers variable -DEFINE AXIS/X=1:`nfeatures`:1 xfeature_axis - -IF `($have_feature_nums"0|*>1") EQ 0` THEN LET feature_numbers = x[gx=xfeature_axis] +IF `($have_feature_nums"0|*>1") EQ 0` THEN LET feature_numbers = _m[ge=featurevar] ! rind is direction of rowsize, defined in feature_initialize -LET longest = `featurevar[($rind)=@max]` + 2 - -LET data_var_c = EXPNDI_BY_Z_COUNTS(longitude, xsequence(featurevar),`longest`) -LET id_by_c = EXPNDI_ID_BY_Z_COUNTS(xsequence(featurevar),`longest`) +LET longest = `rowsize[e=@max]` + 2 ! If dsg file then these symbols are set up. IF `($data_($num)_var"0|($feature_variable)>1|*>0") AND ($rowvar"0|*>1")` THEN - LET data_var_expnd = EXPND_BY_LEN(feature_numbers,($rowvar), `($rowvar)[M=@sum]`) - LET data_var_id = RESHAPE (data_var_expnd, ($dsgshape_var)) - IF ($feature_type"0|*>1") THEN SET VAR/TITLE="($feature_type) ID" data_var_id - DEFINE SYMBOL data_var = data_var_id + DEFINE SYMBOL data_var = feature_numbers EXIT/SCRIPT ENDIF IF `($its_prop_prop_plot"0|*>1") EQ 0` THEN - LET data_var_expnd = EXPND_BY_LEN(feature_numbers, XSEQUENCE(featurevar), `featurevar[M=@sum]`) - LET data_var_id = RESHAPE (data_var_expnd, ($dsgshape_var)) - IF ($feature_type"0|*>1") THEN SET VAR/TITLE="($feature_type) ID" data_var_id - DEFINE SYMBOL data_var = data_var_id - + DEFINE SYMBOL data_var = feature_numbers EXIT/SCRIPT ENDIF @@ -54,19 +42,13 @@ ENDIF IF ($ferret_traj_list"0|*>1") THEN LET subset_ids = {($ferret_traj_list)} - LET n_subset = `subset_ids,RETURN=isize` ! Define a mask to use on the entire list of values: plot or not to plot ! the polygons on the prop-prop plot. LET subm_ids = IF ELEMENT_INDEX(traj_numbers,subset_ids) THEN 1 IF `($subset_mask"0|*>1") EQ 0` THEN LET subset_mask = subm_ids + 0*x[x=1:`ntrajs`] ! put it on a non-abstract axis. - -! apply mask as data_var_c* subset_mask - - LET n_subset = `subset_mask[I=@NGD]` - DEFINE SYMBOL features_shown = `n_subset` - DEFINE SYMBOL prof_traj_shown = `n_subset` + SET DATA/FMASK=subset_mask ($num) ELSE ! There may be a subset already defined from ferret_feature_list diff --git a/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl b/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl index 802754d64..8a5f5cf59 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initialize_region.jnl @@ -25,6 +25,7 @@ ! second in comparisons etc. Keep this behavior. ! ! 10/2017 Expand the map if the region is super skinny, only for insitu data +! 2/2020 Check for existence of global attributes before using global_attnames. DEFINE SYMBOL num ($1"0") DEFINE SYMBOL region_name data_($num)_region @@ -64,8 +65,14 @@ IF `($win_aspect"0|*>1") EQ 0` THEN DEFINE SYMBOL win_aspect = 1 SET DATA "($data_0_url)" LET global_attnames = ..attnames +LET nglobal_atts = ..nattrs -IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN +LET featr = 0 +IF `nglobal_atts GT 0` THEN + IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN LET featr = 1 +ENDIF + +IF `featr GT 0` THEN IF `($win_aspect) LT 0.3` THEN DEFINE SYMBOL win_aspect = 0.3 diff --git a/JavaSource/resources/ferret/scripts/LAS_is_range.jnl b/JavaSource/resources/ferret/scripts/LAS_is_range.jnl index 70441fa5a..cf97d70e3 100644 --- a/JavaSource/resources/ferret/scripts/LAS_is_range.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_is_range.jnl @@ -4,25 +4,38 @@ ! Given a min and max variables defined, see if they are valid data ! and use them to define axis min,max, delta. If min and max are not ! valid then return nominal 0:100 and set an error flag. +! 8/19 *acm* more bad-value handling +! 2/25/2020 ACM robust method usin Ferret/PyFerret internal method +! to set range for constant-valued data LET baddat = 0 CANCEL SYMBOL dm_labels -LET ok = IFV (($1)) THEN 1 ELSE 0 +IF ($1"0|bad>1|*>0") THEN + let ok = 0 +ELSE + LET ok = IFV (($1)) THEN 1 ELSE 0 +ENDIF + IF `ok` THEN DEFINE SYMBOL ax_lo = `($1)` ELSE DEFINE SYMBOl ax_lo = bad ENDIF -LET ok = IFV (($2)) THEN 1 ELSE 0 + +IF ($2"0|bad>1|*>0") THEN + let ok = 0 +ELSE + LET ok = IFV (($2)) THEN 1 ELSE 0 +ENDIF + IF `ok` THEN DEFINE SYMBOL ax_hi = `($2)` ELSE DEFINE SYMBOl ax_hi = bad ENDIF - IF `($ax_lo"0|bad>1|*>0") OR ($ax_hi"0|bad>1|*>0")` THEN LET ax_lo = 0 LET amin = 0 @@ -88,15 +101,19 @@ ELSE ! PPL %RANGE `ax_lo`, `ax_hi`, 50 PPL %RANGE `ax_lo`, `ax_hi`, 30 IF `($ppl$range_low) EQ ($ppl$range_high)` THEN - LET del_ax = `(ax_hi - ax_lo)/10` + CANCEL SYMBOL yaxis* ! Ferret adds +/- a bit for const value plots + PLOT/SET {($ppl$range_low), ($ppl$range_high)} + LET ax_lo = ($yaxis_min) + LET ax_hi = ($yaxis_max) + PPL %RANGE `ax_lo`, `ax_hi`, 30 ELSE LET ax_lo = ($ppl$range_low) LET ax_hi = ($ppl$range_high) - LET del_ax = ($ppl$range_inc) ENDIF - say `ABS(ax_hi - ax_lo)` + LET del_ax = ($ppl$range_inc) IF `ABS(ax_hi - ax_lo) LT 1` THEN DEFINE SYMBOL dm_labels = dm IF `ABS(ax_hi - ax_lo) LT 0.06` THEN DEFINE SYMBOL dm_labels = dms ENDIF ! End of file ------------ LAS_is_range.jnl-------------------------- + diff --git a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl index 760098ad8..3fa6d84ad 100644 --- a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl @@ -19,47 +19,92 @@ ! - If no margins (WMS style plot) is requested, set that up, ! including the /NOYADJUST plot qualifier. -! For watermarks: -! If there is a Ferret property wmark_image -! then add that to the plot. -! Here I have made the nominal choice to use 50% opacity and place -! it 5 pixels from the uppermost left-hand corner. It can also be scaled -! using the /wmscale= qualifier. -! -! If wmark is set, the viewports defined here and in set_full_margins.jnl -! are changed to allow some extra spacing in the Y direction. - -IF `($set_window_quals"0|*>1") EQ 0` THEN \ - DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5") CANCEL MODE LOGO -DEFINE SYMBOL wmark = 0 -IF `($ferret_wmark_image"0|*>1") AND ($ferret_version) GE 7.63` THEN - DEFINE SYMBOL wmark = 1 - DEFINE SYMBOL set_window_quals = ($set_window_quals)/\ - wmark="($ferret_wmark_image)"/wmscale=0.5/wmopac=50 /wmxloc=5/wmyloc=5 -ENDIF IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/FONT=verdana SET TEXT/isiz=-1 CBAR ENDIF -IF `($win_aspect"0|*>1") EQ 0` THEN DEFINE SYMBOL win_aspect = 1 IF `($win_aspect"0|*>1") EQ 0 AND ($ferret_view"|xy>1|xyt>1|*>0") AND ($its_prop_prop_plot"0|*>1") EQ 0` THEN IF `($fview"1|t>0|*>1") AND ($region_x_range"0") NE 0` THEN \ DEFINE SYMBOL win_aspect = `($region_Y_range)/($region_X_range)` ENDIF -IF ($ferret_set_aspect"1|default>1|no>0|yes>1|0|1") THEN - IF `($region_x_range"0") NE 0 AND ($region_y_range"0") NE 0` THEN \ - DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = ($win_aspect):axis + + +! Set the aspect ratio for 1D plots +IF `STRLEN("($ferret_view)") EQ 1` THEN + IF ($ferret_view"0|z>1|*>0") THEN + DEFINE SYMBOL win_aspect = 0.8 + ELSE + DEFINE SYMBOL win_aspect = 0.4 + ENDIF +ENDIF + +IF `($win_aspect"0|*>1") EQ 0` THEN DEFINE SYMBOL win_aspect = 1 + +IF `($win_aspect) GT 100` THEN DEFINE SYMBOL win_aspect = 1 +IF `($win_aspect) LT 0.01` THEN DEFINE SYMBOL win_aspect = 1 + + +! Set up the window. In PyFerret now use pixels to define the +! size and aspect ratio which will make the optional watermark +! easier to locate on the page. + +! Here the value of symbol wmark is "ul" for the upper right-hand corner +! Settings for lower left is sketched out where this is used, in +! LAS_setup_watermark.jnl and set_full_margins.jnl. + + +DEFINE SYMBOL wmark = 0 +IF `($ferret_wmark_image"0|*>1") AND ($PROGRAM_NAME"|PyFerret>1|*>0) AND \ + ($ferret_version) GE 7.63` THEN DEFINE SYMBOL wmark = ul + +! The set window/aspect= /size= of classic Ferret sets up PPLUS symbols +! WITDTH and HEIGHT of the window. Here, set the window using pixel sizes +! with the larger dimension of size 1000 for our typical setting of large plots, +! and assuming 100 pixels width for plot margins. This approximates the sizes we see + +IF `($set_window_quals"0|*>1") EQ 0` THEN + + IF ($PROGRAM_NAME"|PyFerret>1|*>0) THEN + +! The sizes in ferret_size are 0.8333, 0.5, etc and are square roots of +! the nominal set win/size= settings in classic Ferret. + + LET win_base_size = ($ferret_size"0.5")^0.5 * 1000 + + LET pix_xtra = 0.1* win_base_size + + IF `($win_aspect) LE 1` THEN + LET pix_x = win_base_size + LET pix_y = win_base_size* ($win_aspect) + pix_xtra + ELSE + LET pix_y = win_base_size + LET pix_x = (win_base_size + pix_xtra*($win_aspect)) / ($win_aspect) + ENDIF + + DEFINE SYMBOL set_window_quals = ($set_window_quals)/XPIXEL=`pix_x`/YPIXEL=`pix_y` + +! Add any watermark settings added to set_window_quals + + IF ($wmark"0|*>1") THEN GO LAS_setup_watermark + + ELSE ! not pyferret, + + DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5") + + IF ($ferret_set_aspect"1|default>1|no>0|yes>1|0|1") THEN + IF `($region_x_range"0") NE 0 AND ($region_y_range"0") NE 0` THEN \ + DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = ($win_aspect):axis + ENDIF + + ENDIF + ENDIF -IF `($win_aspect) GT 100` THEN \ - DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = 1:axis -IF `($win_aspect) LT 0.01` THEN \ - DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = 1:axis ! Open the window. For PyFerret, use /OUTLINE to take care of the pesky white-line issue IF ($program_name"0|PyFerret>1|*>0") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)/OUTLINE=0.7 1 @@ -68,7 +113,6 @@ SET WINDOW($set_window_quals) IF `($ferret_margins"1|0|1|false>0|true>1") EQ 0` THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:1 WMSview - IF ($wmark"0|*>1") THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:.8 WMSview SET VIEW WMSview IF `STRLEN("($ferret_view)") LT 2` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/NOYADJUST @@ -76,25 +120,18 @@ ELSE ! For 2D plots, make room for the colorbar labels which sometimes get cut off. IF `STRLEN("($ferret_view)") GE 2` THEN DEFINE VIEW/X=0:0.95/Y=0:1 xspace - IF ($wmark"0|*>1") THEN DEFINE VIEW/X=0:0.95/Y=0:.8 xspace - IF ($wmark"0|*>1") THEN DEFINE VIEW/X=0:0.95/Y=0:.5 xspace SET VIEW xspace ELSE ! For 1D plots we may be doing a line key in a new viewport, so set the initial viewport. SET VIEW full - IF ($ferret_view"0|z>1|*>0") THEN - DEFINE SYMBOL win_aspect = 0.8 - ELSE - DEFINE SYMBOL win_aspect = 0.4 - ENDIF - SET WIN/ASPECT=($win_aspect)/:axis - IF ($wmark"0|*>1") THEN SET WIN/ASPECT=($win_aspect)/wmark="($ferret_wmark_image)" ENDIF - ENDIF ! If the annotations are going to be collected and sent back to LAS for presentation, ! set up the viewport for small margins around the edge. + IF ($ferret_annotations"0|*>1") THEN GO set_full_margins ! ----------------- End of LAS_open_window.jnl ------------------------------------ + + diff --git a/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl b/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl index c1d21c18b..55e2b4e2f 100644 --- a/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_pp_colorby_feature.jnl @@ -19,7 +19,10 @@ IF `($data_1_var"0|*>1") EQ 0` THEN EXIT/PROGRAM ENDIF -LET n_in_mask = constraints_mask[i=@ngd] + +let nmasked_var = XSEQUENCE(constraints_mask) +LET n_in_mask = nmasked_var[i=@ngd] + IF `n_in_mask eq 0` THEN DEFINE SYMBOL put_label = 1 EXIT/SCRIPT @@ -66,6 +69,14 @@ DEFINE SYMBOL fersym_command = PLOT/VS/NOLAB/NOKEY/ribbon/miss=blank/PALETTE=($f ! Start the plot. Draw an underlay of dashed-line plot for time series and map trajctory plots + +IF `itsa_tim_prop` THEN + LET tmin = p[L=@min] + LET tmax = p[L=@max] + LET t1 = `tmin[e=@min]` + LET t2 = `tmax[e=@max]` +ENDIF + IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` THEN set data/fmask=subset_mask 1 @@ -75,10 +86,10 @@ IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` T PLOT/VS/SYM=dot($hlim)($vlim)/RIBBON/NOKEY/NOLAB/PALETTE=white {0,1}, {0,1}, {0,1} ! underlay to draw the axes... (Need /hlim, /vlim for expanded axes?) IF `itsa_tim_prop AND ($connect_dots"0|0|1|*>1")` THEN \ - PLOT/NOLAB/DASH=(0.1,0.04,0.1,0.04)/color=6 yvar + PLOT/t=`t1`:`t2`/NOLAB/DASH=(0.1,0.04,0.1,0.04)/color=6 q IF `itsa_map_plot AND ($connect_dots"0|0|1|*>1")` THEN \ - PLOT/OVER/NOLAB/VS/RIBBON/DASH=(0.1,0.04,0.1,0.04)/pal=gray xvar, yvar, 0*yvar + PLOT/OVER/NOLAB/VS/RIBBON/DASH=(0.1,0.04,0.1,0.04)/pal=gray p,q, 0*q PPL COLOR,6,100,0,100 !restore default line-6 color @@ -126,6 +137,11 @@ IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` T LET yplt_var = XSEQUENCE(($yvar)) LET zplt_var = XSEQUENCE(ids_on_obs) + +! LET xplt_var = ($xvar) +! LET yplt_var = ($yvar) +! LET zplt_var = ($zvar) + DEFINE SYMBOL plot_arg = xplt_var, yplt_var, zplt_var LET ishape = 1 @@ -147,7 +163,7 @@ IF `( ($features_shown) LE ($feature_max_labels) ) AND ( ($DATA_COUNT) eq 3 )` T SET DATA/fmask=mask_for_shape 1;\ ;\ DEFINE SYMBOL color_command = GO polymark ($poly_command)/LEVELS=(`c1`,`cn+1`,1) ($plot_arg), ($shape($ishape)), ($poly_scale) ;\ - IF ($py_syms"0") THEN DEFINE SYMBOL color_command = ($pysym_command)/sym=($pyshape($ishape))/LEVELS=(`c1`,`cn+1`,1) ($plot_arg);\ + IF ($py_syms"0") THEN DEFINE SYMBOL color_command = ($pysym_command)/sym=($pyshape($ishape))/E=`c1`:`cn`/LEVELS=(`c1`,`cn+1`,1) ($plot_arg);\ ;\ ($color_command); \ ;\ @@ -167,8 +183,6 @@ ELSE ! all features, do as a PLOT not a POLY command, much faster DEFINE SYMBOL ngood_data = `p[i=@ngd]` ENDIF - - ! If location(s) of a crossover has been sent, mark them. ! This might be one point, or two, comma-separated. diff --git a/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl b/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl index a18c6e94e..fa7cdc1b3 100644 --- a/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_pp_set_region_labels.jnl @@ -166,7 +166,8 @@ IF `($have_time_lab"0|*>1") EQ 0` THEN ENDIF ! Do we need a YEAR label? If its a 1-D Time plot then we do -IF ($its_prop_prop_plot"0|*>1") THEN + +IF `($its_prop_prop_plot"0|*>1") OR ($its_tsplot"0|*>1")` THEN LET L_time = `($ferret_plot_var),return=Lsize` IF `(($have_year_lab"0|*>1") EQ 0) AND (L_time GT 1)` THEN IF `(STRCMP("($fview%A%)", "T") EQ 0) AND ($region_t_lo"0|*>1") AND ($do_t"0")` THEN diff --git a/JavaSource/resources/ferret/scripts/LAS_results.jnl b/JavaSource/resources/ferret/scripts/LAS_results.jnl index 3eaf23c48..d54aa92c7 100644 --- a/JavaSource/resources/ferret/scripts/LAS_results.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_results.jnl @@ -16,6 +16,7 @@ ! 10/2017 fixes for map-scale file, monthly time axis such as monthly_navy_winds ! 11/2017 add report map resolution to the log if this was a map plot ! 10/2018 changing animation product to make all the frames in one PyFerret session +! 5/2020 Define time_map_var to access time units etc without loading so much data. ! ....................................................................................... ! ! LAS_results.jnl creates the result files. @@ -47,15 +48,17 @@ ELSE ENDIF ENDIF ENDIF + ! Annotate if the selection resulted in no data ngood_data is defined for insitu datasets + IF `($ngood_data"-1|*>1") NE -1` THEN - IF `($ngood_data) EQ 0` THEN annotate/norm/x=0.02/y=0.92/halign=-1/siz=0.1 "No Valid Data in the selection" + IF `($ngood_data) EQ 0` THEN annotate/norm/x=0.52/y=0.92/halign=0/siz=0.14 "No Valid Data in the selection" ELSE IF `($ferret_annotations"0|*>1") AND ($plotvar_is_basemap"0|*>1") EQ 0 AND ($no_novalid_lab"0|*>1") NE 1` THEN stat the_plot_var IF `($stat_ngood"0|0|*>1") EQ 0` THEN \ - annotate/norm/x=0.02/y=0.92/halign=-1/siz=0.1 "No Valid Data in the selection" + annotate/norm/x=0.52/y=0.92/halign=0/siz=0.14 "No Valid Data in the selection" ENDIF ENDIF @@ -215,7 +218,7 @@ IF ($insitu_blankvar"0|*>1) THEN SHADE($insitu_blankvar_qual) ($insitu_blankvar) ELSE IF ($ax_horiz"0|T>1|*>0") THEN SET DATA 1 - LET time_map_var = ($data_0_var) + LET time_map_var = ($data_0_var)[($region_full)] IF ($insitu_blankvar"0|*>1) THEN LET time_map_var = ($insitu_blankvar) LET tt= t[GT=time_map_var] @@ -277,9 +280,10 @@ IF ($insitu_blankvar"0|*>1) THEN SHADE($insitu_blankvar_qual) ($insitu_blankvar) DEFINE SYMBOL vaxis_tstart = `TAX_DATESTRING(t1, tt, "seconds")` DEFINE SYMBOL vaxis_tend = `TAX_DATESTRING(t2, tt, "seconds")` - DEFINE SYMBOL vaxis_tunits = `($data_0_var),RETURN=tunits` - DEFINE SYMBOL vaxis_torigin = `($data_0_var),RETURN=t0` - DEFINE SYMBOL vaxis_tcalendar = `($data_0_var),RETURN=calendar` + LET time_map_var = ($data_0_var)[($region_full)] + DEFINE SYMBOL vaxis_tunits = `time_map_var,RETURN=tunits` + DEFINE SYMBOL vaxis_torigin = `time_map_var,RETURN=t0` + DEFINE SYMBOL vaxis_tcalendar = `time_map_var,RETURN=calendar` LET syms_names = {"VAXIS_TSTART", "VAXIS_TEND", "VAXIS_TUNITS", "VAXIS_TORIGIN", "VAXIS_TCALENDAR"} LET syms_vals = {"($VAXIS_TSTART)", "($VAXIS_TEND)", "($VAXIS_TUNITS)", "($VAXIS_TORIGIN)", "($VAXIS_TCALENDAR)"} LIST/APPEND/FILE="($result_map_scale_filename)"/NOHEAD/NOROWLAB syms_names, syms_vals @@ -426,5 +430,25 @@ IF ($ferret_annotations%0|*>1%) THEN GO LAS_annotations_xml ! Result "colorbar" is the legend of the plot_image...only for Google Earth IF ($result_colorbar_filename%0|*>1%) THEN GO colorbar + +! Result ref_map is a ref map. Save to result_ref_map_filename + +IF ($ferret_use_ref_map%0|false>0|*>1%) THEN + CAN VIEW + SET VIEW full + GO std_refmap ($region_0_x_lo) ($region_0_x_hi) ($region_0_y_lo) ($region_0_y_hi) $1%box% ($ref_magnify%0%) ($ref_xcompress%0%) ($ref_ycompress%0%) + FRAME/FORMAT=gif/FILE="($result_ref_map_filename)" + +ENDIF + +! If this was a map plot, report on the topo resolution used +IF ($fland_area"0|*>1") THEN + SAY _________________Map plot: Region and topo file used: + SAY _________________Map plot: XY region ($region_xy) + SAY _________________Map plot: $fland_area ($fland_area) + SAY _________________Map plot: topo file ($topo_url) +ENDIF + + ! End of file ------------LAS_results.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl b/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl index fe632575e..2b2fb165b 100644 --- a/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_set_plot_qualifiers.jnl @@ -200,6 +200,9 @@ ENDIF ! end of options for twoDplot ! Do not set a /COLOR qualifier for multi-line plots ! Default is blue for line, vector, contour plots. ! Line-color is red for difference plots. +! +! IF there is already a /color in the qualifers don't add /COLOR +! unless the ferret_line_color symbol is set to override everything ! IF `($line_drawn"0|*>1") EQ 0` THEN \ DEFINE SYMBOL line_drawn = `($oneDplot"0|*>1") OR ($itsa_vector_plot"0|*>1") OR ($plot_type"0|CONTOUR>1|*>0")` @@ -210,7 +213,9 @@ IF `($line_drawn"0") AND ($itsa_multi_lineplot"0|*>1") EQ 0 AND ($nstations"1") IF ($ferret_line_color"0|multi>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR ELSE - DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color%blue|default>blue|black|red|blue|green|lightblue|purple|*%) + LET has_color = STRINDEX("`UPCASE("($qualifiers)")`", "/COLOR") + IF `has_color EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color%blue|default>blue|black|red|blue|green|lightblue|purple|*%) + IF ($ferret_line_color%0|*>1%) THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=($ferret_line_color) ENDIF ENDIF ! skipped color setting if its a multi-line plot diff --git a/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl b/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl index cb9bd7c79..0f5a56e86 100644 --- a/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_setup_dsg.jnl @@ -3,6 +3,12 @@ SAY _________________ START LAS_setup_dsg: clock seconds: ($clock_secs) + +LET nglobal_atts = ..nattrs +IF `nglobal_atts EQ 0` THEN + GO LAS_error_msg Expecting Distributed Sampling Geometries file. No Global Attributes found. +ENDIF + LET global_attnames = ..attnames LET varnames = ..varnames LET nvars = ..nvars @@ -23,6 +29,7 @@ IF `IS_ELEMENT_OF_STR_N(global_attnames, "featureType") ` THEN ENDIF ! cf_role and sample_dimension are not included in DSG point datasets. +! rowsize isn't either. Set one up which is 1 for each point IF ($feature_type"0|point>1|*>0") THEN @@ -31,6 +38,19 @@ IF ($feature_type"0|point>1|*>0") THEN IF ($data_0_x_var"0|*>1") THEN DEFINE SYMBOL data_x_var = ($data_0_x_var) IF ($data_0_y_var"0|*>1") THEN DEFINE SYMBOL data_y_var = ($data_0_y_var) +! Define an E-direction "rowsize" variable that's 1 for each point + + LET getshape = '($data_0_var)' + DEFINE SYMBOL shape = `getshape,RETURN=shape` + IF ($shape"point>1|*>0") THEN + LET rowvar = 1 + ELSE + DEFINE SYMBOL ishape = ($shape"|X>i|Y>j|Z>k|T>l|E>m|F>n") + LET npts = `($data_0_var),return=($ishape)size` + LET rowvar = 1 + 0* _e[e=1:`npts`] + ENDIF + DEFINE SYMBOL rowvar = rowvar + EXIT/SCRIPT ENDIF diff --git a/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl index a14ad6bce..bf3cf71d3 100644 --- a/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_xytvar_setup.jnl @@ -22,7 +22,6 @@ DEFINE SYMBOL yvar = yvar LET p = ($xvar) LET q = ($yvar) - ! Are the variables longitude and latitude (when the dataset is not of trajectory type) ! If so then connect the dots and do not draw the regression line @@ -57,7 +56,6 @@ IF ($variable_1_lab"0|*>1") THEN IF `itsa_lon_plot OR itsa_lat_plot` THEN CANCEL SYMBOL ax_label_y ENDIF - ! If the axis labels are long, make the text size smaller LET labfac = 1. if `(labwid("($ax_label_x)", 0.12) / ($ppl$xlen)) GT 1` THEN LET labfac = ($ppl$xlen)/labwid("($ax_label_x)",0.12) diff --git a/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl b/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl index e6256fed6..c1bbae368 100644 --- a/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl +++ b/JavaSource/resources/ferret/scripts/Plot_2D_Profile.jnl @@ -1,7 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Author: ACM -! 10/14 Call one of the Waterfal Plots in XZ, YZ, or ZT. +! 10/14 Call one of the Waterfall Plots in XZ, YZ, or ZT. ! ! ! Set the gif filename, changing it from .gif to the name from this request diff --git a/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl b/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl index f03bec738..2e5cb0e88 100644 --- a/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl +++ b/JavaSource/resources/ferret/scripts/Timeseries_station_plot.jnl @@ -132,24 +132,16 @@ IF `nstations EQ 1` THEN LET num_colors = ($data_count) show mode linecolors IF `num_colors LE 12` THEN -! Redefine color order to blue, red, green, lightblue, purple -! and add more - DEFINE SYMBOL nlinecolors = 13 SET MODE LINECOLORS:13 - ppl color, 2, 0, 0, 100 ! blue - ppl color, 3, 100, 0, 0 ! red - ppl color, 4, 0, 100, 0 ! green - ppl color, 5, 0, 100, 100 ! lightblue - ppl color, 6, 100, 0, 100 ! purple - PPL color, 7, 100, 50, 0 ! orange - PPL color, 8, 0, 55, 0 ! dark green - PPL color, 9, 60, 0, 100 ! purple - PPL color, 10, 100, 60, 70 ! pink - PPL color, 11, 80, 70, 60 ! tan - PPL color, 12, 100, 75, 0 ! yellow - - PPL color, ($nlinecolors), 90, 90, 90 !gray + PPL COLOR,7,100,50,0 ! orange + PPL COLOR,8,0,55,0 ! dark green + PPL COLOR,9,60,0,100 ! purple + PPL COLOR,10,100,60,70 ! pink + PPL COLOR,11,80,70,60 ! tan + PPL COLOR,12,100,75,0 ! yellow + + PPL COLOR,($nlinecolors),90,90,90 !gray DEFINE SYMBOL gryclr = ($nlinecolors) ELSE @@ -171,24 +163,20 @@ ELSE DEFINE SYMBOL gryclr = ($nlinecolors) + DEFINE SYMBOL qualifiers = ($qualifiers)/color ENDIF -DEFINE SYMBOL qualifiers = ($qualifiers)/color - - IF `($data_count) GT 1 AND nstations EQ 1` THEN DEFINE SYMBOL itsa_multi_lineplot = 1 - - ! For 1-variable, 1-station plots, turn on horizontal graticule lines, unless graticules ! have been turned off explicitly. Ignore choice of white - its in the menu ! but useless for line plots. IF `($data_count) EQ 1` THEN IF `(nstations GE max_labeled_stations) AND ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1)` THEN - IF ($ferret_use_graticules"0|black>1|*>0") THEN + IF ($ferret_use_graticules"0|black>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) DEFINE SYMBOL ferret_use_graticules = 1 ELSE @@ -198,10 +186,9 @@ IF `($data_count) EQ 1` THEN ENDIF ENDIF -! IF `($data_count) GT 1 AND nstations GT 1` THEN -IF `($data_count) GT 1` THEN +IF `($data_count) GT 1 AND nstations GT 1` THEN IF ($ferret_use_graticules"1|1|none>0|notic>0|white>0|*>1) THEN - IF ($ferret_use_graticules"0|black>1|*>0") THEN + IF ($ferret_use_graticules"0|black>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/HGRAT=(DASH,COLOR=black) DEFINE SYMBOL ferret_use_graticules = 1 ELSE @@ -232,22 +219,19 @@ GO set_linesym ! Open the window, apply size, scale options -! -!c for now, we're just making one plot per page: multi-station for one var or multi-var for one station -!c Later, define multi viewports for multi-var plots each station or multi-station plots each var. -!c IF `($data_count) EQ 1 OR nstations EQ 1` THEN +IF `($data_count) EQ 1 OR nstations EQ 1` THEN DEFINE SYMBOL win_aspect = 0.4 -!cELSE -!c DEFINE SYMBOL win_aspect = `0.4 + nstations/max_separate_stations` -!c -!c! ? Adjust the aspect ratio to make the plots more uniformly -!c! shaped as there are more and more on the page? -!c -!c LET aspects = {0.4,0.45,0.575,0.7,0.825, 0.95, 1.075, 1.2} -!c DEFINE SYMBOL win_aspect = `aspects[i=($data_count)]` -!c -!cENDIF +ELSE + DEFINE SYMBOL win_aspect = `0.4 + nstations/max_separate_stations` + +! ? Adjust the aspect ratio to make the plots more uniformly +! shaped as there are more and more on the page? + + LET aspects = {0.4,0.45,0.575,0.7,0.825, 0.95, 1.075, 1.2} + DEFINE SYMBOL win_aspect = `aspects[i=($data_count)]` + +ENDIF GO LAS_open_window @@ -315,41 +299,109 @@ IF `($data_count) EQ 1` THEN DEFINE VIEW/AXES/X=0.08:0.99/YLIM=`vylo+0.05`:0.96 full_view SET VIEW full_view PLOT($qualifiers)($axset) ($data_var) -paus -ELSE - -! multi-var. - -! Multi-variable plots: -! If with multiple stations: FOR NOW plot just the first station. - - IF `nstations GT 1` THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/M=1 - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL first_feature_only = 1 ! will make adjustments in annotations - - GO dsg_feature_name - DEFINE SYMBOL first_feature_id = `feature_name[m=1]` - DEFINE SYMBOL note_($note_num)_lab = NOTE: multiple stations and multiple variables requested: showing first station - ENDIF - - DEFINE SYMBOL iv = 0 - REPEAT/RANGE=1:($data_count)/NAME=v (\ - DEFINE SYMBOL plot_arg = ($plot_arg) ($data_($iv)_var);\ - IF `v LT ($data_count)` THEN DEFINE SYMBOL plot_arg = ($plot_arg), ;\ - DEFINE SYMBOL iv = `($iv)+1` ) - - PLOT($qualifiers)/COLOR/set ($plot_arg) - IF ($labnum_datitl"0|*>1") THEN go unlabel ($labnum_datitl) +ELSE - -DEFINE SYMBOL ngood_data = `data_good[m=@sum]` -DEFINE SYMBOL nbad_data = `data_bad[m=@sum]` +! Multi-variable plot of one station + IF `nstations EQ 1` THEN + sh sym data*var* + SET VAR/NAME=($data_0_var)_in ($data_0_var) + LET/LIKE=($data_0_var)_in/d=($dsetnum) ($data_0_var) = ($data_0_var)_in[gt=tt_all] + SET VAR/NAME=($data_1_var)_in ($data_1_var) + LET/LIKE=($data_1_var)_in/d=($dsetnum) ($data_1_var) = ($data_1_var)_in[gt=tt_all] + SET VAR/NAME=($data_2_var)_in ($data_2_var) + LET/LIKE=($data_2_var)_in/d=($dsetnum) ($data_2_var) = ($data_2_var)_in[gt=tt_all] + DEFINE SYMBOL ferret_view = t + DEFINE SYMBOL ferret_plot_var_0 = ($ferret_plot_var) + GO LAS_draw_multi_line_plot + +! Multi-station plots of each variable + ELSE + + + LET vxlo = 0.1 + LET vxhi = 0.9 + + LET vylo = 0.16 ! 0.2 >> 0.16 + LET vyhi = 0.94 + + + ! Draw the time axis and feature-ids just once at the bottom of the page. + + LET y2 = `vyhi` + LET del = (vyhi-vylo)/($data_count) + LET y1 = `y2 - del` + 0.05 + IF `($data_count) LE 3` THEN LET y1 = `y1 + 0.05` + + REPEAT/RANGE=1:($data_count)/NAME=s (\ + DEFINE SYMBOL s = `s`;\ + DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`y1`:`y2` vp_`s`;\ + DEFINE SYMBOL y1_($s) = `y1`;\ + DEFINE SYMBOL y2_($s) = `y2`;\ + LET y1 = `y1 - del`; LET y2 = `y2 - del`) + + ! Adjust the aspect window so that multiple variables each have space similar + ! to what is used for 2 viewports and leaving enough at the bottom for the line key + + IF `($data_count) GT 2` THEN + + LET yy2 = `vyhi` + LET yy1 = `yy2 - (vyhi-vylo)/2` + 0.1 + DEFINE VIEW/AXES/TEXT=0.85/xlim=`vxlo`:`vxhi`/ylim=`yy1`:`yy2` vp_test + set view vp_test + plot ($data_0_var) + LET y_frac = ($ppl$ylen)/($ppl$xlen) + DEFINE SYMBOL win_aspect = `0.2 + (($data_count)+1)* y_frac` + DEFINE SYMBOL ferret_size = `($ferret_size)* (1+0.2*(($data_count)-2))` + CANCEL SYMBOL set_window_quals + CANCEL WINDOW/all + GO LAS_open_window + ENDIF + + ! Set up to draw a gray horizontal line through the middle of the plot + + LET t_all = t[gt=taxis_all] + LET tpts = {`t1`, `t2`} + + DEFINE SYMBOL draw_gray = `($data_count) GT 1` + + DEFINE SYMBOL axset = /axes=0,0,1,0 + + REPEAT/RANGE=1:`($data_count)-1`/name=ivar (\ + DEFINE SYMBOL ivar = `ivar`;\ + DEFINE SYMBOL idata `ivar-1`;\ + DEFINE SYMBOL plotvar = ($data_($idata)_var);\ + SET VIEW vp_($ivar);\ + PLOT($qualifiers)($axset)/NOLAB ($plotvar);\ + ANNOTATE/NORM/XPOS=0.02/YPOS=1.05/HALIGN=-1/SIZE=0.12 "@AC($data_($idata)_title)";\ + ANNOTATE/NOUSER/XPOS=`-0.5*($ppl$yorg)`/YPOS=`($ppl$ylen)/2`/HALIGN=0/SIZE=0.1/angle=90 "@AC($data_($idata)_units)";\ + ) + + SET VIEW vp_($data_count) + DEFINE SYMBOL axset = /axes=0,1,1,0 + + DEFINE SYMBOL ivar = ($data_count);\ + DEFINE SYMBOL idata `($ivar)-1`;\ + DEFINE SYMBOL plotvar = ($data_($idata)_var);\ + + PLOT($qualifiers)($axset)/set ($plotvar) + ppl ylab " " + ppl title " " + IF ($labnum_x"0|*>1") THEN GO unlabel ($labnum_x) + IF ($labnum_y"0|*>1") THEN GO unlabel ($labnum_y) + IF ($labnum_z"0|*>1") THEN GO unlabel ($labnum_z) + IF ($labnum_t"0|*>1") THEN GO unlabel ($labnum_t) + IF ($labnum_e"0|*>1") THEN GO unlabel ($labnum_e) + IF ($labnum_dset"0|*>1") THEN GO unlabel ($labnum_dset) + IF ($labnum_datitl"0|*>1") THEN GO unlabel ($labnum_datitl) + IF ($labnum_year"0|*>1") THEN GO unlabel ($labnum_year) + + PPL PLOT + ANNOTATE/NORM/XPOS=0.02/YPOS=1.05/HALIGN=-1/SIZE=0.12 "@AC($data_($idata)_title)" + ANNOTATE/NOUSER/XPOS=`-0.5*($ppl$yorg)`/YPOS=`($ppl$ylen)/2`/HALIGN=0/SIZE=0.1/angle=90 "@AC($data_($idata)_units)" + + ENDIF ! nstations -LET nstations = `nfeatures` -DEFINE SYMBOL nstations = `nstations` - PPL PLOT ENDIF ! Add labels at the top for the location of overlaid lines @@ -361,6 +413,9 @@ GO labels_above_plot GO feature_labels +! if constraints are shown via constraint_0_lhs etc, define labels for those +GO set_constraint_labels + ! Save the results ! The script wants to get the time-axis end points. diff --git a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl index e8f3bfdd2..1683ac233 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl @@ -271,6 +271,9 @@ ENDIF GO labels_above_plot +! if constraints are shown via constraint_0_lhs etc, define labels for those +GO set_constraint_labels + ! Draw extra points, e.g. moorings as dots. Do this last so these ! marks will be on top of everything else. diff --git a/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl b/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl index 23ed39452..424c370e9 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_Data_Convert_File.jnl @@ -17,11 +17,10 @@ GO LAS_initial_setup 0 -DEFINE SYMBOL frmt width=1024 +DEFINE SYMBOL frmt width=1024 ! /norow? IF ($ferret_data_format"0|csv>1|tsv>1|asc>1|*>0") THEN DEFINE SYMBOL frmt = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") - ENDIF CANCEL MODE INTERPOLATE ! important when evaluating the size limits @@ -30,3 +29,5 @@ SET LIST/FILE="($result_ferret_listing_filename)" GO list_traj_data + +! End of file ------------ Trajectory_Data_Convert_File.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl b/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl index d0b2ff9fd..3cac1eb52 100644 --- a/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl +++ b/JavaSource/resources/ferret/scripts/define_dsg_taxis.jnl @@ -6,16 +6,26 @@ DEFINE SYMBOL shape = `($data_t_var),RETURN=shape` DEFINE SYMBOL indx = ($shape"0|POINT>0|X>i|Z>k|T>l|E>m|*>0") -LET t1 = ($data_t_var)[($indx)=@MIN] -LET t2 = ($data_t_var)[($indx)=@MAX] -IF ($indx"|m>0|*>1") THEN - LET tmin = `t1[e=@min]` - LET tmax = `t2[e=@max]` +IF ($indx"0|0|*>1") THEN + LET t1 = ($data_t_var)[($indx)=@MIN] + LET t2 = ($data_t_var)[($indx)=@MAX] + IF ($indx"|m>0|*>1") THEN + LET tmin = `t1[e=@min]` + LET tmax = `t2[e=@max]` + ELSE + LET tmin = `t1` + LET tmax = `t2` + ENDIF ELSE - LET tmin = `t1` - LET tmax = `t2` + +! single point in time + LET t1 = ($data_t_var) + LET t2 = t1 + LET tmin = t1 + LET tmax = t1 ENDIF + ! Adjust if start and end times are too close together LET oneday = 1 diff --git a/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl b/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl index 3429b51b4..1057f5a73 100644 --- a/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl +++ b/JavaSource/resources/ferret/scripts/dsg_find_roles.jnl @@ -35,9 +35,11 @@ IF `IS_ELEMENT_OF_STR(var_attnames, "axis")` THEN ENDIF -! Put the name in quotes in caes it's a pseudo-var such as K +! Put the name in quotes in case it's a pseudo-var such as K +LET getshape = '($vname)' +IF `STRINDEX("($vname)", "(") GT 0` THEN LET getshape = ($vname) -DEFINE SYMBOL shape = `'($vname)',RETURN=shape` +DEFINE SYMBOL shape = `getshape,RETURN=shape` IF ($shape"0|E>0|POINT>0|*>1") THEN DEFINE SYMBOL ishape = ($shape"|X>i|Y>j|Z>k|T>l|*>nothing") IF ($ishape"nothing>1|*>0") THEN diff --git a/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl b/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl index 67bfa308c..4c99d2da9 100644 --- a/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl +++ b/JavaSource/resources/ferret/scripts/feature_initialize_data_insitu.jnl @@ -25,6 +25,7 @@ IF ($fview"0|T>1|*>0") THEN DEFINE SYMBOL use_as = /feature=timeseries IF ($data_($num)_var"0|1|*>1") THEN DEFINE SYMBOL data_var ($data_($num)_var) IF ($data_($num)_title"0|1|*>1") THEN DEFINE SYMBOL data_title ($data_($num)_title) + ! Remove any quotes surrounding data_title string GO LAS_unquote_string data_title @@ -86,6 +87,8 @@ IF `IS_ELEMENT_OF_STR(global_attnames, "title") GT 0` THEN DEFINE SYMBOL dataset_title_att = `..title` ENDIF +DEFINE SYMBOL dset($num) = `($data_var),RETURN=dsetnum` + GO feature_initialize_plot_settings diff --git a/JavaSource/resources/ferret/scripts/feature_labels.jnl b/JavaSource/resources/ferret/scripts/feature_labels.jnl index ed353398e..46df84d7a 100644 --- a/JavaSource/resources/ferret/scripts/feature_labels.jnl +++ b/JavaSource/resources/ferret/scripts/feature_labels.jnl @@ -11,7 +11,6 @@ IF `($feature_type"0|*>1") EQ 0` THEN EXIT/SCRIPT - IF ($feature_type"0|point>1|*>0") THEN DEFINE SYMBOL note_num = `($note_num"0") + 1` DEFINE SYMBOL note_($note_num)_lab = ($ngood_data) points shown @@ -23,14 +22,14 @@ ENDIF ! ($ngood_data) and perhaps ($nbad_data) have already been computed. -DEFINE SYMBOL prof_traj_shown = ($nfeatures) +IF `($prof_traj_shown"0|*>1") EQ 0` THEN DEFINE SYMBOL prof_traj_shown = ($nfeatures) IF `($have_feature_mask"0|*>1") EQ 0` THEN DEFINE SYMBOL maskdir = `feature_mask,RETURN=shape` IF ($maskdir"0|POINT>1|*>0") THEN DEFINE SYMBOL prof_traj_shown = 1 ELSE - IF ($prof_traj_shown"1|*>0") THEN DEFINE SYMBOL prof_traj_shown = `feature_mask[($maskdir)=@sum]` + IF `($prof_traj_shown) EQ ($nfeatures)` THEN DEFINE SYMBOL prof_traj_shown = `feature_mask[($maskdir)=@sum]` ENDIF ENDIF @@ -87,3 +86,4 @@ ENDIF! first_feature_only !---------------- end of feature_labels.jnl ------------------------- + diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl index c2068943c..62ec53358 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_xz.jnl @@ -1,6 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! $Header$ ! insitu_waterfall_xz.jnl +! ACM 8/2020 version for DSG datasets ! ! Creates a XZ Waterfall plot ! @@ -20,35 +21,18 @@ DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var !DEFINE SYMBOL ribbon = 0 ! wiggly waterfall plots, still colored if there is a color palette. DEFINE SYMBOL its_insitu = 1 -! Open the dataset, analyze the DSG dataset, set up plot variables and -! Z-axis for plotting. +! Open the dataset, analyze the DSG dataset, set up plot variables.8/19/2020 GO LAS_insitu_waterfall_setup -! Make a blank plot with the correct X axis on the horizal and depth -! axis on the vertical. - -LET ntic = 10 - -PPL %range ($region_x_lo), ($region_x_hi), `ntic` -LET xlo = ($ppl$range_low) -LET xhi = ($ppl$range_high) - ! First plot sets up plot symbols. The reset_labels and color-key labeled by dates ! expect the color plot to be an overlay. -DEFINE AXIS/x=`xlo`:`xhi`/npoints=100/units="`($data_x_var),RETURN=units`" haxis - -DEFINE SYMBOL insitu_blankvar = blankvar -LET blankvar = 100+x[gx=haxis] + z[gz=vaxis] -DEFINE SYMBOL insitu_blankvar_qual = /PAL=white/NOLAB/NOKEY/LEV=(0,1,1)($vlim) -SHADE($insitu_blankvar_qual) blankvar +PPL COLOR,6,60,60,60 ! grey +PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_x_var), ($data_z_var) ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" -PPL COLOR,6,60,60,60 ! grey -PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_x_var), ($data_z_var) - PLOT/OVER/VS/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_x_var), ($data_z_var), ($data_var) IF ($ferret_annotations%0|*>1%) THEN GO reset_labels GO key_at_top @@ -63,6 +47,9 @@ DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) ! Add dataset information on the top GO feature_labels +! if constraints are shown via constraint_0_lhs etc, define labels for those +GO set_constraint_labels + ! restore key-annotation setting: keys not annotated KEYMARK 0 diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl index 5263d668c..8bd98f991 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_yz.jnl @@ -1,6 +1,7 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! $Header$ ! insitu_waterfall_yz.jnl +! ACM 8/2020 version for DSG datasets ! ! Creates a YZ Waterfall plot ! @@ -17,31 +18,18 @@ SET MODE verify:always ! allows for debugging DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var DEFINE SYMBOL its_insitu = 1 -! Open the dataset, analyze the DSG dataset, set up plot variables and -! Z-axis for plotting. +! Open the dataset, analyze the DSG dataset, set up plot variables. GO LAS_insitu_waterfall_setup -! Make a blank plot with the correct Y axis on the horizal and depth -! axis on the vertical. +! First plot sets up plot symbols. The reset_labels and color-key labeled by dates +! expect the color plot to be an overlay. -LET ntic = 10 -PPL %range ($region_y_lo), ($region_y_hi), `ntic` -LET ylo = ($ppl$range_low) -LET yhi = ($ppl$range_high) - -DEFINE AXIS/y=`ylo`:`yhi`/npoints=100/units="`($data_y_var),RETURN=units`" haxis - -DEFINE SYMBOL insitu_blankvar = blankvar -LET blankvar = 100+y[gy=haxis] + z[gz=vaxis] -DEFINE SYMBOL insitu_blankvar_qual = /PAL=white/NOLAB/NOKEY/LEV=(0,1,1)($vlim) -SHADE($insitu_blankvar_qual) blankvar +PPL COLOR,6,60,60,60 ! grey +PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_y_var), ($data_z_var) ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" -PPL COLOR,6,60,60,60 ! grey -PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_y_var), ($data_z_var) - PLOT/OVER/VS/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_y_var), ($data_z_var), ($data_var) IF ($ferret_annotations%0|*>1%) THEN GO reset_labels GO key_at_top @@ -55,6 +43,9 @@ DEFINE SYMBOL time_lab = Time ($region_t_lo):($region_t_hi) ! Add feature information on the top GO feature_labels +! if constraints are shown via constraint_0_lhs etc, define labels for those +GO set_constraint_labels + ! restore key-annotation setting: keys not annotated KEYMARK 0 diff --git a/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl b/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl index cc6e48765..36b3edeab 100644 --- a/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl +++ b/JavaSource/resources/ferret/scripts/insitu_waterfall_zt.jnl @@ -5,6 +5,7 @@ ! Creates a ZT Waterfall plot ! 10/2017 Fix for different-shaped data. Check that variable time_units defined before using. ! 4/2018 Ferret updates require that the time-variable has units of seconds since origin. +! ACM 8/2020 version for DSG datasets ! ! Set the gif filename, changing it from .gif to the name from this request ! Set up to write info to the debug log so that FshowGO can be used @@ -21,8 +22,7 @@ DEFINE SYMBOL ribbon = 1 ! straight lines colored by the color var DEFINE SYMBOL its_insitu = 1 -! Open the dataset, analyze the DSG dataset, set up plot variables and -! Z-axis for plotting. +! Open the dataset, analyze the DSG dataset, set up plot variables. GO LAS_insitu_waterfall_setup @@ -32,28 +32,23 @@ GO define_dsg_taxis ! del in days. Generally the graticules on time axis are too few and far between to be useful. IF `del LT 4*365` THEN CANCEL MODE graticule - -! Make a blank plot with the correct time axis on the horizal and depth -! axis on the vertical. - -DEFINE SYMBOL insitu_blankvar = blankvar -LET blankvar = 100+t[gt=taxis] + z[gz=vaxis] -DEFINE SYMBOL insitu_blankvar_qual = /PAL=white/NOLAB/NOKEY/LEV=(0,1,1)($vlim) -SHADE($insitu_blankvar_qual) blankvar - -ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" - ! Now make the ribbon plot. DEFINE SYMBOL qualifiers = ($qualifiers)/noaxes +! First plot sets up plot symbols. The reset_labels and color-key labeled by dates +! expect the color plot to be an overlay. + PPL COLOR,6,60,60,60 ! grey -PLOT/OVER/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_t_var), ($data_z_var) +PLOT/VS/SYM=dot/NOKEY/NOLAB/COLOR=6 ($data_t_var), ($data_z_var) + PLOT/OVER/VS/OVER/RIBBON/MISS=blank/SYM=19/THICK($qualifiers)/SET ($data_t_var), ($data_z_var), ($data_var) IF ($ferret_annotations%0|*>1%) THEN GO reset_labels GO key_at_top PPL RIBBON/OVER +ANNOTATE/norm/xpos=-0.05/ypos=0.5/angle=90/halign=0/siz=0.12 "`($data_z_var),RETURN=units`" + ! Add location labels as annotation notes. DEFINE SYMBOL longitude_lab = Longitude: ($region_x_lo):($region_x_hi) @@ -62,6 +57,9 @@ DEFINE SYMBOL latitude_lab = Latitude: ($region_y_lo):($region_y_hi) ! Add dataset information on the top GO feature_labels +! if constraints are shown via constraint_0_lhs etc, define labels for those +GO set_constraint_labels + ! restore key-annotation setting: keys not annotated KEYMARK 0 diff --git a/JavaSource/resources/ferret/scripts/key_at_top.jnl b/JavaSource/resources/ferret/scripts/key_at_top.jnl index 458100cdc..fdd95407f 100644 --- a/JavaSource/resources/ferret/scripts/key_at_top.jnl +++ b/JavaSource/resources/ferret/scripts/key_at_top.jnl @@ -10,6 +10,9 @@ IF ($its_GE"0|*>1") THEN EXIT/SCRIPT IF `($ferret_plot_key"1|0|*>1") EQ 0` THEN EXIT/SCRIPT +! If the setting is /NOKEY then quit out. +IF `STRINDEX(UPCASE("($qualifiers%0%)"), "NOKEY") GT 0` THEN EXIT/SCRIPT + DEFINE SYMBOL horizontal_key = 1 IF `key_label_size,RETURN=defined` THEN CANCEL VAR key_label_size diff --git a/JavaSource/resources/ferret/scripts/list_a_variable.jnl b/JavaSource/resources/ferret/scripts/list_a_variable.jnl index 31a3a71d5..f673f8cba 100644 --- a/JavaSource/resources/ferret/scripts/list_a_variable.jnl +++ b/JavaSource/resources/ferret/scripts/list_a_variable.jnl @@ -12,6 +12,9 @@ ! and don't rename them according to the subset. ! Also write the URL of the original dataset. ! 12/2016 set list precision to 7 +! 4/2019 Implement the property ferret_points_zt (e.g. SPURS prawler profiles). +! For plots, it's a graphical ZT plot. For data listings, add the pressure +! variable to the listing or file. ! ! Called by list_data.jnl Initialize and write a single variable, appending ! it to the ascii or netCDF output file. @@ -90,7 +93,13 @@ SET DATA/SAVE SET DATA ($data_num) LET attlist = ($data_var_nq).attnames -sh sym ferret_list_var +! When the Ferret property ferret_points_zt is defined, also list the +! pressure variable pointed to by the symbol ($ferret_points_zt) + +IF `($ferret_points_zt%0|*>1%) AND ($frmt%0|/format=cdf>1|*>0%) AND ($data_count%0|1|*>0)` THEN + DEFINE SYMBOL ferret_list_var = ($data_0_var), ($ferret_points_zt) + CANCEL ATTRIBUTE/OUTPUT (`($data_0_var),return=zaxis`).standard_name +ENDIF LET/UNITS="`($ferret_list_var),RETURN=units)`"\ the_list_var = ($ferret_list_var) diff --git a/JavaSource/resources/ferret/scripts/list_csv_data.jnl b/JavaSource/resources/ferret/scripts/list_csv_data.jnl index bf5a5b24c..b1ec22f30 100644 --- a/JavaSource/resources/ferret/scripts/list_csv_data.jnl +++ b/JavaSource/resources/ferret/scripts/list_csv_data.jnl @@ -6,6 +6,8 @@ ! 4/2013 ACM Implement the Ferret property ferret_start_memory ! 12/2013 ACM If the view includes an E direction, list the ensemble member. ! 7/20/2017 ACM -- See GitHub issue 3 fix below. +! 1/21/2020 ACM As part of issue 1770 skip over variables that duplicate ones +! already listed. ! ! Called by list_data.jnl ! Write csv data: date/time, X, Y, Z, var1, var2, ... @@ -200,18 +202,28 @@ IF `STRINDEX("($ferret_view)", "e") GT 0` THEN ENDIF ENDIF -LET/units="($data_($var_num)_units)"/TITLE="`($data_0_var),RETURN=title`" ($data_0_var_orig) = ($ferret_list_var_($var_num)) +LET/units="($data_($var_num)_units)"/TITLE="`($data_0_var),RETURN=title`" ($data_0_var_orig) = ($ferret_list_var_0) DEFINE SYMBOL vars_out = ($tlist) ($xlist) ($ylist) ($zlist) ($elist) ($data_0_var_orig) +LET csv_icount = 1 +DEFINE SYMBOL var_num = 0 + +! Build up the list of variables to write +! Skip any that were marked as duplicates of ones already in the list. + IF `($data_count"1") GT 1` THEN + REPEAT/RANGE=1:`($data_count"1")-1`/NAME=outvar \ (DEFINE SYMBOL var_num = `outvar`; \ + IF ($csv_skip_($var_num)"0") THEN EXIT/CYCLE ;\ LET/units="($data_($var_num)_units)"/TITLE="`($data_($var_num)_var),RETURN=title`" ($data_($var_num)_var_orig) = ($ferret_list_var_($var_num)); \ - DEFINE SYMBOL vars_out = ($vars_out), ($data_($var_num)_var_orig) ) + DEFINE SYMBOL vars_out = ($vars_out), ($data_($var_num)_var_orig);\ + LET csv_icount = `csv_icount+1`) + ENDIF LET ndims = `STRLEN("($ferret_view)")` -LET nlist = ndims + ($data_count) +LET nlist = ndims + csv_icount ! the default is set under 1/4 of Ferret's memory allowing for LET definitions LET use_size = 1000000*($ferret_memory)/4. diff --git a/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl b/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl index a86d3d55f..513e10975 100644 --- a/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl +++ b/JavaSource/resources/ferret/scripts/list_csv_define_var.jnl @@ -4,30 +4,71 @@ ! Initialize data and define 1-d list of variable to write out ! Save the original variable name and use it in the listing. +! 1/21/20 issue 1770 +! If a variable was already renamed in an init script then +! workaround was incorrect when handling naming here. +! 4/20 Make sure we don't try to access variables in dataset +! via ..varnames before the dataset has been initialized. + DEFINE SYMBOL var_num = $1 GO LAS_initialize_region ($var_num) + DEFINE SYMBOL data_($var_num)_var_orig ($data_($var_num)_var) -GO LAS_initialize_data ($var_num) +! Is a variable repeated in the list? If so then ($data_($var_num)_var)_csv is already +! set up so we can skip writing it + +IF `($data_($var_num)_var)_csv,RETURN=isready` THEN + DEFINE SYMBOL csv_skip_($var_num) = 1 + EXIT/SCRIPT +ENDIF + +! Second instance of an init-script variable +IF `($data_($var_num)_var)_csv_($session_PID),RETURN=isready` THEN + DEFINE SYMBOL csv_skip_($var_num) = 1 + EXIT/SCRIPT +ENDIF + + +GO LAS_initialize_data ($var_num) LET varnames = ..varnames -! If a variable has already been renamed, in an init script +! If a variable has already been renamed in an init script ! then we need to work around that. -! variable has not been renamed. We can rename it here, and then -! write the output using the original name. +LET renamed_($var_num) = 0 +IF ($ferret_init_script"0|*>1") THEN -IF `IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)") NE 0` THEN - SET VAR/NAME=($data_($var_num)_var)_in ($data_($var_num)_var) - DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_in - GO LAS_initialize_data ($var_num) + LET renamed_($var_num) = `IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)") GT 0 AND \ + IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)_in") GT 0` + IF `renamed_($var_num) EQ 0` THEN LET renamed_($var_num) = `IS_ELEMENT_OF_STR_N(varnames, "($data_($var_num)_var)") EQ 0` + +ENDIF + +IF `renamed_($var_num)` THEN + + IF `($data_($var_num)_var)_csv_($session_PID),RETURN=isready` THEN + DEFINE SYMBOL ferret_plot_var_($var_num) = skip_var_($var_num) + EXIT/script + ENDIF -! data_($num)_var was renamed. Use original-name plus an underscore when writing. -ELSE DEFINE SYMBOL data_($var_num)_var_orig = ($data_($num)_var)_ - LET/title="`($data_($num)_var),return=title`"/units="`($data_($num)_var),return=units`" ($data_($var_num)_var)_init = ($data_($num)_var)[($region_full)] - DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_init + LET/title="`($data_($num)_var),return=title`"/units="`($data_($num)_var),RETURN=units`" \ + ($data_($var_num)_var)_csv_($session_PID) = ($data_($num)_var)[($region_full)] + DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_csv_($session_PID) + DEFINE SYMBOL ferret_plot_var = ($data_($var_num)_var) +ELSE + + IF `(($data_($var_num)_var)_csv),RETURN=isready` THEN + DEFINE SYMBOL ferret_plot_var_($var_num) = skip_var_($var_num) + EXIT/script + ENDIF + + SET VAR/NAME=($data_($var_num)_var)_csv ($data_($var_num)_var) + DEFINE SYMBOL data_($var_num)_var = ($data_($var_num)_var)_csv DEFINE SYMBOL ferret_plot_var = ($data_($var_num)_var) + GO LAS_initialize_data ($var_num) + ENDIF DEFINE SYMBOL ferret_plot_var_($var_num) =($ferret_plot_var) @@ -38,3 +79,4 @@ IF `($var_num) GT 0` THEN if `($size_($var_num)) NE ($size_0)` THEN MESSAGE/ERRO IF `($var_num) GT 0` THEN if `($size_($var_num)) NE ($size_0)` THEN exit/program ! End of script ---------- list_csv_define_var.jnl---------------------------- + diff --git a/JavaSource/resources/ferret/scripts/list_data.jnl b/JavaSource/resources/ferret/scripts/list_data.jnl index 37ccb0fba..2b4c24bae 100644 --- a/JavaSource/resources/ferret/scripts/list_data.jnl +++ b/JavaSource/resources/ferret/scripts/list_data.jnl @@ -11,6 +11,9 @@ ! 8/ 9/2007 ACM Allow for multiple variables, appending each to the file ! until all are written. ! 12/2016 set list precision to 7 +! 4/2019 Implement the property ferret_points_zt (e.g. SPURS prawler profiles). +! For plots, it's a graphical ZT plot. For data listings, add the +! pressure variable to the listing or file. ! ! list_data.jnl creates a listing, CDF or ASCII (based on std_list.jnl) ! Assumes symbol ferret_format which will be one of "cdf" "txt" "tsv" "csv" "asc" @@ -32,6 +35,29 @@ IF ($ferret_format%0|asc>1|*>0) THEN IF ($ferret_data_format"0|tsv>1|csv>1|asc>1|*>0") THEN DEFINE SYMBOL frmt ($frmt) = ($frmt)/($ferret_data_format"|tsv>format=tab|csv>format=comma|asc>heading=enhanced") SET LIST/PREC=7 + + IF ($ferret_points_zt%0|*>1%) THEN + LIST/APPEND/FILE="($result_ferret_listing_filename)" "Data Is Listed at fixed z-levels. Adding pressure to this listing" + DEFINE SYMBOL nzt = ($data_count) + DEFINE SYMBOL data_count = `($data_count) + 1` + DEFINE SYMBOL data_($nzt)_dataset_name = ($data_0_dataset_name) + DEFINE SYMBOL data_($nzt)_url = ($data_0_url) + USE ($data_0_url) + DEFINE SYMBOL data_($nzt)_name = `($ferret_points_zt),return=title` + DEFINE SYMBOL data_($nzt)_region = ($data_0_region) + DEFINE SYMBOL data_($nzt)_title = `($ferret_points_zt),return=title` + DEFINE SYMBOL data_($nzt)_units = `($ferret_points_zt),return=units` + DEFINE SYMBOL data_($nzt)_var = ($ferret_points_zt) + DEFINE SYMBOL data_($nzt)_t_hi = ($region_0_t_hi) + DEFINE SYMBOL data_($nzt)_t_lo = ($region_0_t_lo) + DEFINE SYMBOL data_($nzt)_x_hi = ($region_0_x_hi) + DEFINE SYMBOL data_($nzt)_x_lo = ($region_0_x_lo) + DEFINE SYMBOL data_($nzt)_y_hi = ($region_0_y_hi) + DEFINE SYMBOL data_($nzt)_y_lo = ($region_0_y_lo) + DEFINE SYMBOL data_($nzt)_z_hi = ($region_0_z_hi) + DEFINE SYMBOL data_($nzt)_z_lo = ($region_0_z_lo) + ENDIF + ENDIF ENDIF @@ -44,3 +70,6 @@ IF ($ferret_data_format"0|csv>1|*>0") THEN ELSE REPEAT/RANGE=1:($data_count"1")/NAME=outvar (GO list_a_variable `outvar-1`; CANCEL SYMBOL ferret_list_var) ENDIF + + +! End of file ------------ list_data.jnl -------------------------- diff --git a/JavaSource/resources/ferret/scripts/list_prop_prop.jnl b/JavaSource/resources/ferret/scripts/list_prop_prop.jnl index 58f9d20ca..8eb52db2d 100644 --- a/JavaSource/resources/ferret/scripts/list_prop_prop.jnl +++ b/JavaSource/resources/ferret/scripts/list_prop_prop.jnl @@ -45,11 +45,32 @@ CANCEL DATA `($data_0_var),RETURN=dsetnum` GO setup_prop_prop +! set up any constraint labels +GO set_constraint_labels + IF `($dsgshape"0|*>1") EQ 0` THEN MESSAGE/ERROR **ERROR Expecting Discrete Sampling Geometries data EXIT/PROGRAM ENDIF + +! set up any constraint labels +GO set_constraint_labels + +! apply mask to list variables + +LET size = `constraints_mask[i=@ngd]` + +LIST/NOHEAD/NOROW/FILE/CLOBBER/FORMAT=("Total Number of Records", F10.0) `size` + +! Constraint labels + +IF `($note_num"0") GT 0` THEN + REPEAT/RANGE=1:($note_num)/name=q (\ + DEFINE SYMBOL qq = `q`; \ + SAY/OUTFILE="($result_ferret_listing_filename)"/APPEND ($note_($qq)_lab) ) +ENDIF + ! Set up the list of variables to plot. IF ($feature_variable"0|*>1") THEN DEFINE SYMBOL list_vars = ($feature_variable), diff --git a/JavaSource/resources/ferret/scripts/make_c_lab.jnl b/JavaSource/resources/ferret/scripts/make_c_lab.jnl index a53295953..b0ac59c0c 100644 --- a/JavaSource/resources/ferret/scripts/make_c_lab.jnl +++ b/JavaSource/resources/ferret/scripts/make_c_lab.jnl @@ -86,12 +86,24 @@ IF ($math_sym_convert"1|no_convert>0") THEN GO op_math_sym ($translate_math) ($o DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhs) ! Show time constraint as a formatted time +! Currently we do not have any products that do a constraint in time. + IF `($lhs"|time>1|TIME>1|*>0")` THEN IF `($timevar"0|*>1") EQ 0` THEN DEFINE SYMBOL timevar = time CANCEL SYMBOL rhsdate IF `($timeaxis"0|*>1") EQ 0` THEN - LET amin = ($timevar)[i=@MIN] - LET amax = ($timevar)[i=@MAX] + DEFINE SYMBOL shape `($timevar),RETURN=shape` + LET amin = ($timevar)[($shape)=@MIN] + LET amax = ($timevar)[($shape)=@MAX] + + ! Is this a multi-feature timeseries dataset? If so @MIN and @MAX are for each timeseries + DEFINE SYMBOL eshape `amin,RETURN=shape` + IF ($eshape"0|E>1|*>0") THEN + LET amin_featr = ($timevar)[($shape)=@MIN] + LET amax_featr = ($timevar)[($shape)=@MAX] + LET amin = `amin_featr[e=@min]` + LET amax = `amax_featr[e=@max]` + ENDIF DEFINE SYMBOL is_time = 1 GO LAS_is_range amin amax CANCEL SYMBOL is_time @@ -103,18 +115,19 @@ IF `($lhs"|time>1|TIME>1|*>0")` THEN DEFINE AXIS/T=`ax_lo`:`ax_hi`:`del_ax`/T0="`($data_t_var"time").time_origin`"/units=($tunits) timeaxis DEFINE SYMBOl timeaxis = timeaxis ENDIF + LET tt = t[gt=($timeaxis)] LET nt = `tt,RETURN=lsize` LET tn = tt[L=`nt`] DEFINE SYMBOL tn = `tn` IF `($rhs) GE tt[L=1] AND ($rhs) LE ($tn)` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[t=($rhs)], tt, "hours")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[t=($rhs)], tt, "minutes")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ELIF `($rhs) LT tt[L=1]` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[L=1], tt, "hours")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( tt[L=1], tt, "minutes")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ELIF `($rhs) GT ($tn)` THEN - DEFINE SYMBOL rhsdate = `TAX_DATESTRING( ($tn), tt, "hours")` + DEFINE SYMBOL rhsdate = `TAX_DATESTRING( ($tn), tt, "minutes")` DEFINE SYMBOL mask_title_($nmask_labels) = Where ($lhs) ($math_op_sym) ($rhsdate) ENDIF IF ($rhsdate"0|*>1") THEN DEFINE SYMBOL rhs ($rhsdate) diff --git a/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl b/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl index b1101791f..f72982c1d 100644 --- a/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl +++ b/JavaSource/resources/ferret/scripts/prop_prop_map_thumb.jnl @@ -7,9 +7,15 @@ DEFINE SYMBOL ferret_thumb_qc2 = 1 ! Dont use finest-resolution map underlay. LET/UNITS="`longitude,RETURN=units`"/TITLE="`longitude,RETURN=title`" lon = longitude LET/UNITS="`latitude,RETURN=units`"/TITLE="`latitude,RETURN=title`" lat = latitude -LET amin = `min(lon[i=@MIN]-5, 180)` -LET amax = `max(lon[i=@MAX]+5, -180)` +DEFINE SYMBOL lonlatshape = `lon,RETURN=shape` +IF ($lonlatshape"|POINT>1|*>0") THEN + LET amin = `min(lon-5, 180)` + LET amax = `max(lon+5, -180)` +ELSE + LET amin = `min(lon[($lonlatshape)=@MIN]-5, 180)` + LET amax = `max(lon[($lonlatshape)=@MAX]+5, -180)` +ENDIF GO LAS_is_range amin amax LET xax_lo = ($ppl$range_low) @@ -19,8 +25,13 @@ LET xax_del = ($ppl$range_inc) LET varnames = ..varnames IF `IS_ELEMENT_OF_STR(varnames, "lon360") GT 0` THEN - LET amin = `min(lon[i=@MIN]-5, 360)` - LET amax = `max(lon[i=@MAX]+5, 0)` + IF ($lonlatshape"|POINT>1|*>0") THEN + LET amin = `min(lon-5, 360)` + LET amax = `max(lon+5, 0)` + ELSE + LET amin = `min(lon[($lonlatshape)=@MIN]-5, 360)` + LET amax = `max(lon[($lonlatshape)=@MAX]+5, 0)` + ENDIF GO LAS_is_range amin amax @@ -41,8 +52,14 @@ IF `ABS(xax_hi - xax_lo) LT 1` THEN DEFINE SYMBOL dm_labels = dm IF `ABS(xax_hi - xax_lo) LT 0.06` THEN DEFINE SYMBOL dm_labels = dms DEFINE AXIS/x=`xax_lo`:`xax_hi`:`del_ax`/units="($lon_units%degrees_east%)" haxis -LET amin = `max(lat[i=@MIN]-5, -90)` -LET amax = `min(lat[i=@MAX]+5, 90)` +IF ($lonlatshape"|POINT>1|*>0") THEN + LET amin = `max(lat-5, -90)` + LET amax = `min(lat+5, 90)` +ELSE + LET amin = `max(lat[($lonlatshape)=@MIN]-5, -90)` + LET amax = `min(lat[($lonlatshape)=@MAX]+5, 90)` +ENDIF + GO LAS_is_range amin amax LET yax_lo = ($ppl$range_low) @@ -77,15 +94,19 @@ GO LAS_fland ($land_palette) DEFINE SYMBOL symquals = /SIZE=0.12/THICK=1 STAT lon -LET lonconst = `($stat_std) LT 0.1` +LET lonconst = `($stat_std"|bad>0.01|*") LT 0.1` STAT lat -LET latconst = `($stat_std) LT 0.1` +LET latconst = `($stat_std"|bad>0.01|*") LT 0.1` IF `lonconst + latconst EQ 2` THEN DEFINE SYMBOL symquals = /SIZE=0.3/THICK=3 +! needed for annotations file +IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) +IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) + + IF ($zvar"0|*>1") THEN RIBBON/VS/OVER/NOLAB/KEY=HORIZ,CONT,CENT/SYM=17($symquals)/\ PALETTE=($ferret_palette"red")/LEVELS=($ferret_fill_levels"v") lon, lat, ($zvar) ELSE PLOT/VS/OVER/NOLAB/NOKEY/SYM=17($symquals)/COLOR=($lonlatcolor"red") lon, lat ENDIF - diff --git a/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl b/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl index 83ddd24f3..27f2b065b 100644 --- a/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl +++ b/JavaSource/resources/ferret/scripts/prop_prop_plot.jnl @@ -9,6 +9,7 @@ ! 11/2017 back off finding direction variables based on attributes for now ! 12/2017 changes for efficiency getting variable types ! 1/2018 Time will only be the independent variable - no vertical time axis. +! 8/2020 Updates for working with DSG datasets ! prop_prop_plot.jnl creates a property-property plot, using the ! data variable in symbol data_0_var and the second variable from @@ -38,6 +39,10 @@ CANCEL SYMBOL ferret_fill_levels CANCEL SYMBOL ferret_contour_levels CANCEL SYMBOL ferret_palette +! pale gray line for underlay +SET MODE linecolors:7 +PPL color, 7, 90, 90, 90 !gray + ! Initialize data and variables ! Set up masks for constraints @@ -84,10 +89,9 @@ IF ($ferret_use_graticules"0|0|*>1) THEN SET MODE GRATICULE:(DASH=(0.1,0.04,0.1,0.04),COLOR=black) ENDIF - ! Set the plot argument. DEFINE SYMBOL plot_arg = ($xvar), ($yvar) - +DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var DEFINE SYMBOL qualifiers = ($qualifiers)/NOLAB IF `($ferret_thumb"0|*>1") AND ($data_count"0") LE 2` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/COLOR=red @@ -159,6 +163,14 @@ ENDIF ! If this is a Watch Circle plot, set that up. ! This is a hack, which can be generalized with properties or attributes. +LET itsa_lon_prop = 0 +LET itsa_lat_prop = 0 +LET itsa_tim_prop = 0 +LET itsa_lon_plot = 0 +LET itsa_lat_plot = 0 +LET itsa_tim_plot = 0 +LET itsa_map_plot = 0 + GO setup_watch_circle @@ -170,29 +182,55 @@ IF `its_watch_circle EQ 0` THEN ENDIF ENDIF -IF `($ngood_data"0|*>1") EQ 0` THEN - LET allp = xsequence(($xvar)) - DEFINE SYMBOL ngood_data = `allp[i=@ngd]` +IF `($ngood_data"0|*") EQ -1` THEN + GO LAS_results box + EXIT/SCRIPT ENDIF -IF ($put_label"0|*>1") THEN DEFINE SYMBOL all_missing = 1 +DEFINE SYMBOL xvar = constraints_mask*xvar +DEFINE SYMBOL yvar = constraints_mask*yvar +LET x_plot_var = ($xvar) +LET y_plot_var = ($yvar) +IF `($data_count"0") GT 2` THEN + DEFINE SYMBOL zvar = constraints_mask*zvar + LET z_plot_var = ($zvar) +ENDIF -DEFINE SYMBOL plot_arg = ($xvar), ($yvar) -IF `($data_count"0") GT 2` THEN DEFINE SYMBOL plot_arg = ($xvar), ($yvar), ($zvar) -IF `($all_missing"0") EQ 0` THEN !!!! or all the way to the bottom of this script +! compute # points plotted after mask applied -! ... let symbol size gradually increase as no. of obs gets small +LET compute_good = ($xvar)* ($yvar) + + +IF `($data_count"0") GT 2` THEN + DEFINE SYMBOL ztyp = `($zvar),return=dtype` + IF `($ztyp"0|FLOAT>1|*>0") AND ($zshape"0|POINT>0|($shape)>1|*>0")` THEN \ + LET compute_good = ($xvar)* ($yvar)* ($zvar) +ENDIF +STAT compute_good +DEFINE SYMBOL shape = `compute_good,RETURN=shape` +DEFINE SYMBOL ngood_data = ($stat_ngood) +DEFINE SYMBOL nbad_data = ($stat_nbad) + +IF ($put_label"0|*>1") THEN DEFINE SYMBOL all_missing = 1 +IF `($ngood_data) EQ 0` THEN DEFINE SYMBOL all_missing = 1 +DEFINE SYMBOL plot_arg = ($xvar), ($yvar) +DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var +sh sym xvar, yvar, zvar +sh var xvar,yvar +IF `($data_count"0") GT 2` THEN DEFINE SYMBOL plot_arg = x_plot_var, y_plot_var, z_plot_var +IF `($all_missing"0") EQ 0` THEN !!!! or all the way to the bottom of this script -DEFINE SYMBOL size_creep_factor `(($ngood_data"0")+300)/(($ngood_data"0")+100) - 1` ! [0,1] range +! ... let symbol size gradually increase as no. of obs gets small +DEFINE SYMBOL size_creep_factor `(($ngood_data)+300)/(($ngood_data)+100) - 1` ! [0,1] range LET sym_factr = 0.9 + 1.5*($size_creep_factor) DEFINE SYMBOL plot_command = PLOT/NOLAB/VS/sym=17/SIZE=`.12*sym_factr` -DEFINE SYMBOL underlay_command = PLOT/NOLAB/RIBBON/VS/sym=17/palette=gray_light/NOKEY/SIZE=`.08*sym_factr` - +DEFINE SYMBOL underlay_command = PLOT/NOLAB/RIBBON/VS/sym=17/palette=gray_light/NOKEY/SIZE=`.08*sym_factr` +DEFINE SYMBOL underlay_vars = x_plot_var, y_plot_var, y_plot_var ! gray dashed line underlying trajectories or time series @@ -202,6 +240,18 @@ IF `itsa_map_plot` THEN DEFINE SYMBOL underlay_command = ($underlay_command)/OVER ENDIF +! Set up gray dash line and underly of gray symbols as simple line plots not ribbon plots +! Make the time coordinate variable the first argument for the ribbon plot so the scaling is right. + +IF `itsa_tim_prop AND ($connect_dots"0|0|1|*>1")` THEN !! not a /VS plot. + DEFINE SYMBOL under_line = /COLOR=7/DASH=(0.1,0.04,0.1,0.04)/NOLAB($vlim) y_plot_var + DEFINE SYMBOL underlay_command = PLOT/NOLAB/sym=17/COLOR=7/NOKEY/SIZE=`.08*sym_factr`/THICK=1 + DEFINE SYMBOL underlay_vars = y_plot_var + + DEFINE SYMBOL plot_arg = ($data_0_var), ($data_1_var), z_plot_var +ENDIF + + ! Fewer and larger symbols, use thicker line IF `.12*sym_factr GT 0.3` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/THICK=3 @@ -213,12 +263,13 @@ ENDIF DEFINE SYMBOL plot_end_command = PLOT IF `($data_count"0") GT 2` THEN IF ($color_by_levels"0|*>1") THEN DEFINE SYMBOL ferret_fill_levels = ($color_by_levels) - DEFINE SYMBOL plot_command = ($plot_command)/RIBBON/LEVELS=($ferret_fill_levels"v")/MISSING=blank + DEFINE SYMBOL plot_command = ($plot_command)/RIBBON/LEVELS=($ferret_fill_levels"v") DEFINE SYMBOL plot_end_command = RIBBON ENDIF LET x_plot_var = ($xvar) LET y_plot_var = ($yvar) +IF `($data_count"0") GT 2` THEN LET z_plot_var = ($zvar) LET have_constr = `constraints_mask,RETURN=isready` IF `have_constr EQ 0` THEN LET constraints_mask = 1 @@ -227,22 +278,43 @@ IF `color_by_feature` THEN GO LAS_pp_colorby_feature ! put_label has been set if all data is missing or constraints return no data. +ELIF ($ferret_thumb"0|*>1") THEN + IF `itsa_tim_prop ` THEN + PLOT/color=red/sym=17/title=" "/set y_plot_var + ppl ylab "($ferret_title_1)" + go unlabel ($labnum_x) + go unlabel ($labnum_e) + go unlabel ($labnum_dset) + go unlabel ($labnum_datitl) + PPL PLOT + ELSE + PLOT/VS/color=red/sym=17/title=" "/set x_plot_var, y_plot_var + ppl xlab "($ferret_title_0)" + ppl ylab "($ferret_title_1)" + go unlabel ($labnum_x) + go unlabel ($labnum_e) + go unlabel ($labnum_dset) + go unlabel ($labnum_datitl) + PPL PLOT + ENDIF ELSE - IF ($color_by"0|*>1") THEN ! Get color-plot qualifiers DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") - IF ($ferret_plot_key"0|0|nokey>1|*>0") THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY - DEFINE SYMBOL dokey = 0 - ELSE - IF `STRINDEX(UPCASE("($qualifiers)"), "/KEY") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY - DEFINE SYMBOL dokey = 1 - ENDIF + IF `($ngood_data"0") GT 0` THEN + IF ($ferret_plot_key"0|0|nokey>1|*>0") THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY + DEFINE SYMBOL dokey = 0 + ELSE + IF `STRINDEX(UPCASE("($qualifiers)"), "/KEY") EQ 0` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY + DEFINE SYMBOL dokey = 1 + ENDIF - IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT + IF ($ferret_key_centerlab"0|0|*>1") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/KEY=CONT,CENT + + ENDIF DEFINE SYMBOL color_by_title = `zvar,RETURN=title` @@ -257,15 +329,24 @@ ELSE ENDIF ! on lat/lon plots, draw a gray line on the cruise tracks. - IF `itsa_map_plot AND ($connect_dots"0|0|1|*>1")` THEN PLOT/OVER($under_line) + IF `itsa_map_plot OR ($watch_plot"0|*>1") AND ($connect_dots"0|0|1|*>1") ` THEN PLOT/OVER($under_line) + + if ($watch_plot"0|*>1") THEN DEFINE SYMBOL underlay_command = ($underlay_command)/over/nolab/noaxis + +! on time plots, draw a gray line. This is the first plot, drawing the time axis + IF `itsa_tim_prop ` THEN PLOT($under_line) ! show locations where the color-by variable is missing. This way all missing data ! is underneath good data but PLOT/RIBBON/MISSING=gray can plot lots of missing pts over ! valid ones from data already on the page PPL COLOR,6,60,60,60 ! grey - - IF `($data_count"0") GT 2` THEN ($underlay_command) x_plot_var, y_plot_var, y_plot_var + IF `($data_count"0") GT 2 AND itsa_map_plot EQ 0 AND ($watch_plot"0|*>1") EQ 0` THEN + ($underlay_command)/set ($underlay_vars) + IF ($ax_label_x"0|*>1") THEN PPL xlab ($ax_label_x) + IF ($ax_label_y"0|*>1") THEN PPL ylab ($ax_label_y) + PPL PLOT + ENDIF DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/SET @@ -286,6 +367,9 @@ ELSE DEFINE SYMBOL qualifiers = ($qualifiers)/levels=($ferret_fill_levels)/KEY=CENTER/palette=($ferret_palette) ENDIF + IF `STRINDEX("($qualifiers)", "palette") EQ 0` THEN \ + DEFINE SYMBOL qualifiers = ($qualifiers)/palette=($ferret_palette"default|*>*) + IF `STRINDEX("($qualifiers)", "OVER") GT 0` THEN DEFINE SYMBOL plot_end_command ($plot_end_command)/OVER ($plot_command)($qualifiers) ($plot_arg) IF `($ferret_annotations%0|*>1%) AND ($dokey"0|1>1|*>1")` THEN GO key_at_top @@ -296,12 +380,11 @@ ENDIF ! color-by-feature or not... ! This allows for auto-levels on prop-prop plots. IF ($color_by"0|*>1") THEN - LET data_range = minmax(constraints_mask*zvar) + LET data_range = MINMAX(constraints_mask*zvar) DEFINE SYMBOL data_plotted_min = `data_range[i=1],prec=7` DEFINE SYMBOL data_plotted_max = `data_range[i=2],prec=7` ENDIF - IF `($color_by_title"0|*>1") AND ($ferret_annotations%0|*>1%) EQ 0` THEN \ LABEL/NOUSER `($ppl$width)-($ppl$xorg)-0.2`, -0.7, 1, 0, 0.12 Colored by ($color_by_title) @@ -317,17 +400,25 @@ LET q = ($yvar) IF `itsa_map_plot or itsa_tim_prop` THEN DEFINE SYMBOL do_rsquare = 0 -DEFINE SYMBOL line_color = blue ! regression line -IF ($polycolor%0|blue>1|*>0%) THEN DEFINE SYMBOL line_color = red +! ~ 85 points gives a confidence of 0.8 -IF ($do_rsquare"1|0|*>1) THEN GO LAS_regressx +IF `($do_rsquare"1|0|*>1) AND ($ngood_data"0") LT 85` THEN + DEFINE SYMBOL do_rsquare = 0 + IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/COLOR=blue moveable + DEFINE SYMBOL rsqlab = Too few points to compute + LET wid = `LABWID("($rsqlab)", 0.1)` + LABEL/NOUSER -0.5,-0.42,-1, 0, 0.1, Too few points to compute + LABEL/NOUSER -0.5,-0.6,-1, 0, 0.1, regression line +ENDIF -IF `($ngood_data"0") eq 0` THEN DEFINE SYMBOL do_rsquare = 0 +DEFINE SYMBOL line_color = blue ! regression line +IF ($polycolor%0|blue>1|*>0%) THEN DEFINE SYMBOL line_color = red ! Note do_rsquare is set in LAS_xytvar_setup, where plots with time, lon, or ! lat axes are set to NOT draw the regression line. IF ($do_rsquare"1|0|*>1) THEN + GO LAS_regressx ! Note that qhat in the regress script is defined as ! LET qhat = slope*p + intercep @@ -384,7 +475,11 @@ IF ($do_rsquare"1|0|*>1) THEN ENDIF -ENDIF ! all_missing or not... +ELSE ! all_missing, make a nominal plot so LAS_results has something to work with + + plot/vs/nolab/noax/sym=dot/vlim=-1:1/hlim=-1:1 {-2,2}, {-2,2} + +ENDIF ! notation with number of cruises, trajectories, or profiles and obs. GO feature_labels @@ -412,7 +507,6 @@ IF ($note_num"0|*>1") THEN ) ENDIF - GO LAS_results box ! ----- End of prop_prop_plot.jnl ------------------------------------------------ diff --git a/JavaSource/resources/ferret/scripts/reset_labels.jnl b/JavaSource/resources/ferret/scripts/reset_labels.jnl index 55efea8d1..50fbd4ee5 100644 --- a/JavaSource/resources/ferret/scripts/reset_labels.jnl +++ b/JavaSource/resources/ferret/scripts/reset_labels.jnl @@ -3,7 +3,11 @@ ! Define symbols used by the annotations xml ! 1/2018 issue 1854 Inside of a SHADE/SET, LET commands that redefine a variable can ! cause curvi coord data to be wiped out. As a workaround, cancel any vars we define - +! 3/2020 Issue 1773 If the data is really monthly or yearly, can configure with the +! ferret property month or year +! Here, implement a hack for datasets with timesteps defined e.g. +! as month-since 1-Jan-1990 so timesteps fall near the startor end of month +! THEN a request for Nov-1990 gets the timestep at 31-Oct-1990:15:00 IF ($xform_dms"0|*>1") THEN PPL XFOR (($xform_dms)) IF ($yform_dms"0|*>1") THEN PPL YFOR (($yform_dms)) @@ -35,8 +39,28 @@ IF `($data_count"1") EQ 1` THEN ENDIF IF ($labnum_t"0|*>1") THEN DEFINE SYMBOL time_lab ($lab($labnum_t)) + +! HACK: does the time match the region request down to month/year? + IF `($ferret_timelab_res"0|month>1|*>0") AND \ + STRCMP("($region_t_lo)", "($region_t_hi)") EQ 0` THEN + LET month = SUBSTRING("($time_lab)", 1, 3) + LET dash = STRINDEX("($REGION_T_LO)", "-") + LET rmonth = SUBSTRING ("($REGION_T_LO)", dash+1, 3) + IF `STRCMP(month, rmonth) NE 0` THEN + LET ryear = SUBSTRING ("($REGION_T_LO)", dash+5, 4) + DEFINE SYMBOL time_lab = TIME : `UPCASE(rmonth)`-`ryear` + ENDIF + ENDIF + IF `($ferret_timelab_res"0|year>1|*>0") AND \ + STRCMP("($region_t_lo)", "($region_t_hi)") EQ 0` THEN + LET dash = STRINDEX("($REGION_T_LO)", "-") + LET ryear = SUBSTRING ("($REGION_T_LO)", dash+5, 4) + IF `STRCMP("($time_lab)", ryear) NE 0` THEN + DEFINE SYMBOL time_lab = TIME : `ryear` + ENDIF + ENDIF ENDIF - + IF ($labnum_calend"0|*>1") THEN DEFINE SYMBOL calendar_lab ($lab($labnum_calend)) ENDIF diff --git a/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl b/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl index 73320690d..44e54f13f 100644 --- a/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl +++ b/JavaSource/resources/ferret/scripts/set_constraint_labels.jnl @@ -77,3 +77,4 @@ IF ($ferret_annotate_with"0|*>1") THEN ENDIF !-----------------End of set_constraint_labels --------------------------------- + diff --git a/JavaSource/resources/ferret/scripts/set_full_margins.jnl b/JavaSource/resources/ferret/scripts/set_full_margins.jnl index f9389c151..0a1a2a15c 100644 --- a/JavaSource/resources/ferret/scripts/set_full_margins.jnl +++ b/JavaSource/resources/ferret/scripts/set_full_margins.jnl @@ -5,6 +5,7 @@ ! 9/16 Set Y spacing to 0.07 throughout, needed for Time labels using PPLUS ! 9/17 Tall skinny plots need a bit more left-margin space for axis labels + ! Google Earth plots need no margins. This has already been set up. IF ($its_GE"0|*>1") THEN DEFINE VIEW/AXES/XLIM=0:1/YLIM=0:1 full_view @@ -16,31 +17,47 @@ DEFINE SYMBOL text_size = ($ferret_text_size"0.09") CAN view +let y_dn = 0.08 LET y_up = 0.92 LET y_up_t = 0.99 + IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN LET y_up = 0.9 LET y_up_t = 0.99 ENDIF IF ($wmark"0|*>1") THEN - LET y_up = `y_up - 0.04` - LET y_up_t = `y_up_t - 0.6` + +! These settings to make space for a watermark. +! Give the margin some extra vertial space. Note the +! viewport settings are in percentage of the window. + +! These if putting it in the upper left corner. + IF ($wmark%|ul>1|*>0%) THEN + LET y_up = `y_up - 0.05` + LET y_up_t = `y_up_t - 0.1` + ENDIF + +! These if putting it in the lower left + IF ($wmark%|ll>1|*>0%) THEN + LET y_dn = 0.16 + ENDIF + ENDIF -DEFINE VIEW/AXES/X=0.08:0.99/y=0.08:`y_up` full_view -DEFINE VIEW/AXES/X=0.08:0.99/y=0.08:`y_up` full_view2 +DEFINE VIEW/AXES/X=0.08:0.99/y=`y_dn`:`y_up` full_view +DEFINE VIEW/AXES/X=0.08:0.99/y=`y_dn`:`y_up` full_view2 ! tall skinny plots get the vertical axis labels chopped off. IF `($win_aspect) GT 2` THEN - DEFINE VIEW/AXES/X=0.11:0.99/y=0.08:`y_up` full_view - DEFINE VIEW/AXES/X=0.11:0.99/y=0.08:`y_up` full_view2 + DEFINE VIEW/AXES/X=0.11:0.99/y=`y_dn`:`y_up` full_view + DEFINE VIEW/AXES/X=0.11:0.99/y=`y_dn`:`y_up` full_view2 ENDIF ! Give prop-prop plots a little more space at the left for labels. IF ($its_prop_prop_plot"0|*>1") THEN - DEFINE VIEW/AXES/X=0.1:0.99/y=0.08:`y_up` full_view - DEFINE VIEW/AXES/X=0.1:0.99/y=0.08:`y_up` full_view2 + DEFINE VIEW/AXES/X=0.1:0.99/y=`y_dn`:`y_up` full_view + DEFINE VIEW/AXES/X=0.1:0.99/y=`y_dn`:`y_up` full_view2 ENDIF IF ($ferret_thumb"0|*>1") THEN @@ -49,24 +66,24 @@ IF ($ferret_thumb"0|*>1") THEN ENDIF IF ($ferret_view%0|yt>1|zt>1|t>1|*>0%) THEN - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up` full_view - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up` full_view2 + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up` full_view + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up` full_view2 ENDIF IF ($ferret_view%0|xt>1|*>0%) THEN - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up` full_view - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up` full_view2 + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up` full_view + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up` full_view2 ENDIF IF ($ferret_view%0|t>1|*>0%) THEN - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view2 + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up_t` full_view + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up_t` full_view2 ENDIF ! Thumbnail plots need bigger axis labels. Make the margins bigger. IF ($ferret_view%0|x>1|y>1|z>1|*>0%) THEN - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view - DEFINE VIEW/AXES/X=0.08:0.98/y=0.08:`y_up_t` full_view2 + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up_t` full_view + DEFINE VIEW/AXES/X=0.08:0.98/y=`y_dn`:`y_up_t` full_view2 ENDIF SET VIEW full_view diff --git a/JavaSource/resources/ferret/scripts/set_linesym.jnl b/JavaSource/resources/ferret/scripts/set_linesym.jnl index 98e9d5fa8..3c1ffde8a 100644 --- a/JavaSource/resources/ferret/scripts/set_linesym.jnl +++ b/JavaSource/resources/ferret/scripts/set_linesym.jnl @@ -50,16 +50,17 @@ ELSE let ngood = plotvar[($getgood)] let nbad = plotvar[($getbad)] + + IF ($dsgshape"0|*>1") THEN + stat plotvar + LET ngood = ($stat_ngood) + let nbad = ($stat_nbad) + ENDIF + ENDIF ! curvilinear or not LET npoints = ngood + nbad -DEFINE SYMBOL shape = `npoints,RETURN=shape` -IF ($shape"0|POINT>0|E>1") THEN - LET epoints = ngood + nbad - LET nmax = epoints[e=@max] - LET npoints = `nmax[e=1]` ! works around a bug where the context of `nmax[e=1]` is nfeatures long, not 1 -ENDIF LET nminpts = 120 IF ($itsa_multi_lineplot"0|*>1") THEN LET nminpts = 15 From 30f5552cf00dc49662b3f7554ad3e6d593900dda Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Mon, 28 Sep 2020 13:45:32 -0700 Subject: [PATCH 09/15] reconcile dsg script changes with svn trunk --- .../scripts/LAS_insitu_waterfall_setup.jnl | 111 ++++++++++ .../ferret/scripts/LAS_var_lon_lat_time.jnl | 44 ---- .../ferret/scripts/LAS_var_lon_lat_z_time.jnl | 62 ++++++ .../scripts/LAS_xytvar_griddat_setup.jnl | 190 ++++++++++++++++++ .../ferret/scripts/Profile_2D_poly.jnl | 144 ++----------- .../ferret/scripts/Trajectory_2D_poly.jnl | 69 ++++++- .../ferret/scripts/decimation_labels.jnl | 84 ++++++++ .../ferret/scripts/dsg_feature_name.jnl | 42 ++++ .../ferret/scripts/reshape_list_var.jnl | 33 --- .../ferret/scripts/setup_date_key.jnl | 28 +++ .../ferret/scripts/setup_dsg_constraints.jnl | 144 +++++++++++++ .../ferret/scripts/setup_prop_prop.jnl | 9 +- .../ferret/scripts/setup_watch_circle.jnl | 21 +- 13 files changed, 763 insertions(+), 218 deletions(-) create mode 100644 JavaSource/resources/ferret/scripts/LAS_insitu_waterfall_setup.jnl delete mode 100644 JavaSource/resources/ferret/scripts/LAS_var_lon_lat_time.jnl create mode 100644 JavaSource/resources/ferret/scripts/LAS_var_lon_lat_z_time.jnl create mode 100644 JavaSource/resources/ferret/scripts/LAS_xytvar_griddat_setup.jnl create mode 100644 JavaSource/resources/ferret/scripts/decimation_labels.jnl create mode 100644 JavaSource/resources/ferret/scripts/dsg_feature_name.jnl delete mode 100644 JavaSource/resources/ferret/scripts/reshape_list_var.jnl create mode 100644 JavaSource/resources/ferret/scripts/setup_date_key.jnl create mode 100644 JavaSource/resources/ferret/scripts/setup_dsg_constraints.jnl diff --git a/JavaSource/resources/ferret/scripts/LAS_insitu_waterfall_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_insitu_waterfall_setup.jnl new file mode 100644 index 000000000..6cfe8a506 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/LAS_insitu_waterfall_setup.jnl @@ -0,0 +1,111 @@ +!!!!! LAS_insitu_waterfall_setup.jnl + +! Initialize the dataset and set up for profile plots from DSG +! datasets using native-DSG enabled Ferret. +! ACM 8/2020 version for DSG datasets + +GO LAS_initialize_region 0 + +IF ($data_0_var"0|vid>1|*>0") THEN + DEFINE SYMBOL ferret_by_id = 1 + USE "($data_0_url)" + LET varnames = ..varnames + + DEFINE SYMBOL data_0_var = `varnames[i=1]` + CANCEL DATA "($data_0_url)" +ENDIF +GO LAS_initialize_data 0 + +! Check for errors (They often occur during dataset initialization.) + +IF ($error_status"0|*>1") THEN + MESSAGE/ERROR **ERROR ($error_string) + PROGRAM +ENDIF + +! Find the xyzt variables + +GO feature_get_direction_vars + +! Set the URL label for the first dataset. +GO LAS_url_label 0 + +! Create the profile variables and symbols + +DEFINE SYMBOL variable_lab = ($variable_lab) at depth (meters) + +! Set up to color by a feature-variable including possibly time + +IF `color_by_feature EQ 1 OR color_by_index EQ 1` THEN + IF ($data_var"0|($data_t_var)>1|*>0") THEN DEFINE SYMBOL ferret_plot_key = date_key + IF `($data_var"0|($data_t_var)>1|*>0") EQ 0` THEN + IF `($ferret_palette"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_palette = ten_by_levels + IF `($input_fill_levels"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_fill_levels = (1,($nfeatures),1) + DEFINE SYMBOL ferret_plot_title Colored by Profile Number + ENDIF + GO LAS_initialize_feature_id +ENDIF + +! Special color-by-time key +IF ($ferret_plot_key"0|date_key>1|*>0") THEN GO setup_date_key.jnl + + +! For annotations in LAS_results. If we are coloring by a +! feature-variable then ngood = npts + +DEFINE SYMBOL dtype = `($data_var),return=dtype` +IF `($dtype"0|CHAR>0|*>1") EQ 0` THEN + DEFINE SYMBOL error_string = Invalid data type for variable ($ferret_title_0). Choose another variable. + MESSAGE/ERROR **ERROR ($error_string) + EXIT/PROGRAM +ENDIF + +DEFINE SYMBOL shape = `($data_var),RETURN=shape` +IF ($shape"0|E>1|*>0") THEN + DEFINE SYMBOL ngood_data = ($numobs) +ELSE + LET allgood = ($data_var)[($shape"x")=@ngd] + DEFINE SYMBOL ngood_data = `allgood[e=@sum]` + DEFINE SYMBOL nbad_data = `($numobs) - ($ngood_data)` +ENDIF + +! Plot qualifiers (graticule lines etc) +GO LAS_set_plot_qualifiers + +! Open the window +GO LAS_open_window + +! Turn on annotate_key, which persists until turned off +! (unless key_annoatate property tells us otherwise). + +IF ($ferret_key_annotate"1|0|1|*>1") THEN + KEYMARK 1 +ELSE + KEYMARK 0 +ENDIF + +IF `($ribbon"1|0|1|*>1") AND ($ngood_data"0|0|*>1") GT 0` THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/KEY +ELSE + DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY +ENDIF + +DEFINE SYMBOL qualifiers = ($qualifiers)/LEVELS=($ferret_fill_levels"v") +IF ($program_name"|PyFerret>1|*>0") THEN DEFINE SYMBOL qualifiers = ($qualifiers)/SYMBOL=boxfill + +IF ($ribbon"0|*>1") THEN \ + DEFINE SYMBOL plot_command = PLOT/VS/RIBBON/LINE($qualifiers) + +! Variables for the waterfall plots ($data_var) , ($data_x_var), ($data_y_var), ($data_z_var), ($data_t_var) +! ... apply masks here? +! +! LET/TITLE="Depth"/UNITS="m" issurf = ! Surface locations ... should be location x,y first element of each profile... + +DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull1 +DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull2 + +DEFINE SYMBOL view1 = vfull1 +DEFINE SYMBOL view2 = vfull2 + +! End of file ------------ LAS_insitu_waterfall_setup.jnl-------------------------- + diff --git a/JavaSource/resources/ferret/scripts/LAS_var_lon_lat_time.jnl b/JavaSource/resources/ferret/scripts/LAS_var_lon_lat_time.jnl deleted file mode 100644 index 9930bfcd8..000000000 --- a/JavaSource/resources/ferret/scripts/LAS_var_lon_lat_time.jnl +++ /dev/null @@ -1,44 +0,0 @@ -! LAS_var_lon_lat_time.jnl -! 10/2017 -! -! Check attributes to determine if the variable is a longiutde, -! latitude, or formatted time. -! Argument is a variable name -! Defines symbols var_is_lon, var_is_lat, var_is_time with values of 0 or 1. - -cancel symbol var_is_lon, var_is_lat, var_is_time - -DEFINE SYMBOL invarname = ($1) -LET invarname = ($1) - -DEFINE SYMBOL var_is_lon = ($invarname"0|longitude>1|*>0) -IF `($var_is_lon) EQ 0` THEN - LET attnames = invarname.attnames - IF `IS_ELEMENT_OF_STR_N (attnames, "units") GT 0` THEN - LET units_str = invarname.units - IF `STRINDEX( UPCASE(units_str), "DEG") GT 0` THEN \ - DEFINE SYMBOL var_is_lon = `STRINDEX( UPCASE(units_str), "_E") GT 0` - ENDIF -ENDIF - -DEFINE SYMBOL var_is_lat = ($invarname"0|latitude>1|*>0) -IF `($var_is_lat) EQ 0` THEN - LET attnames = invarname.attnames - IF `IS_ELEMENT_OF_STR_N (attnames, "units") GT 0` THEN - LET units_str = invarname.units - IF `STRINDEX( UPCASE(units_str), "DEG") GT 0` THEN \ - DEFINE SYMBOL var_is_lat = `STRINDEX( UPCASE(units_str), "_N") GT 0` - ENDIF -ENDIF - -DEFINE SYMBOL var_is_time = ($invarname"0|time>1|*>0) -IF `($var_is_time) EQ 0` THEN - LET attnames = invarname.attnames - IF `IS_ELEMENT_OF_STR_N(attnames, "units") GT 0 AND IS_ELEMENT_OF_STR_N(attnames, "time_origin") GT 0` THEN - LET units_str = invarname.units - DEFINE SYMBOL var_is_time = `STRINDEX( UPCASE(units_str), "SINCE") GT 0` - ENDIF -ENDIF - -! End of file ------------LAS_var_lon_lat_time.jnl-------------------------- - diff --git a/JavaSource/resources/ferret/scripts/LAS_var_lon_lat_z_time.jnl b/JavaSource/resources/ferret/scripts/LAS_var_lon_lat_z_time.jnl new file mode 100644 index 000000000..cb7ab82cc --- /dev/null +++ b/JavaSource/resources/ferret/scripts/LAS_var_lon_lat_z_time.jnl @@ -0,0 +1,62 @@ +! LAS_var_lon_lat_z_time.jnl +! 10/2017 +! +! Check attributes to determine if the variable is a longiutde, +! latitude, depth/height or formatted time. +! Argument is a variable name +! Defines symbols var_is_lon, var_is_lat, var_is_dep, var_is_ht, var_is_time with values of 0 or 1. + +cancel symbol var_is_lon, var_is_lat, var_is_time, var_is_dep, var_is_ht + +DEFINE SYMBOL invarname = ($1) +LET invarname = ($1) + +DEFINE SYMBOL var_is_lon = ($invarname"0|longitude>1|*>0) +IF `($var_is_lon) EQ 0` THEN + LET attnames = ($invarname).attnames + IF `IS_ELEMENT_OF_STR_N (attnames, "units") GT 0` THEN + LET att_str = ($invarname).units + IF `STRINDEX( UPCASE(att_str), "DEG") GT 0` THEN \ + DEFINE SYMBOL var_is_lon = `STRINDEX( UPCASE(att_str), "_E") GT 0` + ENDIF +ENDIF + +DEFINE SYMBOL var_is_lat = ($invarname"0|latitude>1|*>0) +IF `($var_is_lat) EQ 0` THEN + LET attnames = ($invarname).attnames + IF `IS_ELEMENT_OF_STR_N (attnames, "units") GT 0` THEN + LET att_str = ($invarname).units + IF `STRINDEX( UPCASE(att_str), "DEG") GT 0` THEN \ + DEFINE SYMBOL var_is_lat = `STRINDEX( UPCASE(att_str), "_N") GT 0` + ENDIF +ENDIF + +DEFINE SYMBOL var_is_dep = ($invarname"0|depth>1|*>0) +IF `($var_is_dep) EQ 0` THEN + LET attnames = ($invarname).attnames + IF `IS_ELEMENT_OF_STR_N(attnames, "axis") GT 0` THEN + LET att_str = ($invarname).axis + DEFINE SYMBOL var_is_dep = `STRINDEX( UPCASE(att_str), "Z") GT 0` + ENDIF +ENDIF + +! Depth or height? +IF `($var_is_dep"0|1|*>0")` THEN + IF `IS_ELEMENT_OF_STR_N(attnames, "positive") GT 0` THEN + LET att_str = ($invarname).positive + DEFINE SYMBOL var_is_dep = `STRINDEX( UPCASE(att_str), "DOWN") GT 0` + DEFINE SYMBOL var_is_ht = `STRINDEX( UPCASE(att_str), "UP") GT 0` + ENDIF +ENDIF + + +DEFINE SYMBOL var_is_time = ($invarname"0|time>1|*>0) +IF `($var_is_time) EQ 0` THEN + LET attnames = ($invarname).attnames + IF `IS_ELEMENT_OF_STR_N(attnames, "units") GT 0 AND IS_ELEMENT_OF_STR_N(attnames, "time_origin") GT 0` THEN + LET att_str = ($invarname).units + DEFINE SYMBOL var_is_time = `STRINDEX( UPCASE(att_str), "SINCE") GT 0` + ENDIF +ENDIF + +! End of file ------------LAS_var_lon_lat_z_time.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/LAS_xytvar_griddat_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_xytvar_griddat_setup.jnl new file mode 100644 index 000000000..eda86a271 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/LAS_xytvar_griddat_setup.jnl @@ -0,0 +1,190 @@ +! LAS_xytvar_griddat_setup.jnl +! Set up property-property plots for gridded datasets + +! Draw the underlying axes of a property-property plot, +! formatted as a longitude, latitude or time axis. + +! variable p is the prop_var (independent axis) masked for any subset chosen and +! with XSEQUENCE applied to put it on an x axis +! variable q is the data_var (dependent axis) masked for any subset chosen and +! with XSEQUENCE applied to put it on an x axis + +! Define two viewports filling the window and do the axes in one, the +! plot in the other. If the annotations are being done separately, +! draw in the viewports defined in set_full_margins.jnl + +! May turn off axis labeling later +PPL TICS .6,.125,.6,.125 +PPL TICS .125,.2,.125,.2 +PPL axlabp,-1,-1 + +DEFINE SYMBOL xvar = constraints_mask*xvar +DEFINE SYMBOL yvar = constraints_mask*yvar +LET p = ($xvar) +LET q = ($yvar) + +! Initialize these, used only for DSG data in the calling script +LET itsa_map_plot = 0 +LET itsa_tim_plot = 0 +LET itsa_tim_prop = 0 + +CANCEL SYMBOL set_window_quals + +! size for the label that says a variable is all-missing +DEFINE SYMBOL miss_lab_siz = 0.14 + +! For thumbnail plots +DEFINE SYMBOL mainlab_size = 0.14 +DEFINE SYMBOL errlab_size = 0.16 +IF ($ferret_thumb"0|0|*>1") THEN + DEFINE SYMBOL poly_size = 1.3 + DEFINE SYMBOL is_thumb = 1 + DEFINE SYMBOL mainlab_size = 0.22 + DEFINE SYMBOL errlab_size = 0.2 + DEFINE SYMBOL thumb_alab_size = PPL AXLSZE,.14,.14 + DEFINE SYMBOL txl_lab_size = .14 + PPL TXLSZE,($txl_lab_size) + LET labfac = 1.8 + DEFINE SYMBOL ax_label_resize PPL LABSET,,`0.12*labfac`,`0.12*labfac` + DEFINE SYMBOL miss_lab_siz = 0.24 + + DEFINE SYMBOL do_rsquare = 0 + +ENDIF + +DEFINE SYMBOL win_asp = /ASPECT=.8 +DEFINE SYMBOL set_window_quals = /SIZE=($ferret_size"0.5")($win_asp) + +DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull1 +DEFINE VIEWPORT/XLIM=0:1/YLIM=0:1 vfull2 + +DEFINE SYMBOL view1 = vfull1 +DEFINE SYMBOL view2 = vfull2 +IF ($ferret_annotations"0|*>1") THEN + DEFINE SYMBOL view1 = full_view + DEFINE SYMBOL view2 = full_view2 +ENDIF + +SET VIEW ($view1) + +! If this symbol is set during this script, then +! the script will make a blank plot and exit. +CANCEL SYMBOL put_label + + +let pq = p*q +let pqmask = pq-pq +let p_var = p + pqmask +let q_var = q + pqmask + +! Define some variables used below +LET pminmax = MINMAX(p_var) +LET qminmax = MINMAX(q_var) + +! Check for all-bad data. pminmax and qminmax depend on both p and q. +! If bad, figure out which variable is all-bad and set the label string. + +DEFINE SYMBOL isbad = `pminmax[i=2] - pminmax[i=1] ` +IF ($isbad"0|bad>1|*>0") THEN + DEFINE SYMBOL qgood = `q[i=@ngd] GT 0` + DEFINE SYMBOL pgood = `p[i=@ngd] GT 0` + DEFINE SYMBOL bad_verb = is + IF `($pgood) EQ 0 AND ($qgood) NE 0` THEN DEFINE SYMBOL bad_title = ($ferret_title_0) + IF `($pgood) NE 0 AND ($qgood) EQ 0` THEN DEFINE SYMBOL bad_title = ($ferret_title_1) + IF `($pgood) EQ 0 AND ($qgood) EQ 0` THEN + DEFINE SYMBOl bad_verb = are + DEFINE SYMBOL bad_title = ($ferret_title_0) and ($ferret_title_1) + ENDIF +ENDIF + +IF ($bad_title"0|*>1") THEN + PLOT/VS/NOLAB/SYM=dot {0,1}, {0,1} + IF ($ferret_thumb"0|0|*>1") THEN + LET ylab_bad = `($ppl$ylen)-3*($miss_lab_siz)` + LABEL/NOUSER 0.2, `ylab_bad-0.4`, -1, 0, ($miss_lab_siz), @AS($bad_title)($bad_verb) All-Missing + DEFINE SYMBOL no_novalid_lab = 1 + CANCEL SYMBOL bad_title + ELSE + LET ylab_bad = `($ppl$ylen)-2*($miss_lab_siz)` + LABEL/NOUSER 0.2, `ylab_bad-0.2`, -1, 0, ($miss_lab_siz), @AS($bad_title) ($bad_verb) All-Missing + DEFINE SYMBOL no_novalid_lab = 1 + CANCEL SYMBOL bad_title + ENDIF + DEFINE SYMBOL ngood_data = -1 ! Dont do another label in LAS_results. + EXIT/SCRIPT +ENDIF + +! Define axes for both variables using the range in the data + +LET amin = pminmax[i=1] +LET amax = pminmax[i=2] + +GO LAS_is_range amin amax + +IF `($have_haxis"0|*>1") EQ 0` THEN \ +DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units="`p,RETURN=units`" haxis +DEFINE AXIS/x=`ax_lo`:`ax_hi`:`del_ax`/units="`p,RETURN=units`" haxis1 +DEFINE SYMBOL hlim = /hlim=`ax_lo`:`ax_hi` + +! Get the title and units from the original variables +LET/like=xvar dep_var = x[gx=haxis] + +LET qminmax = MINMAX(q_var) +LET amin = qminmax[i=1] +LET amax = qminmax[i=2] +GO LAS_is_range amin amax + +DEFINE AXIS/y=`ax_lo`:`ax_hi`:`del_ax`/units="($propunits)" vaxis +DEFINE SYMBOL vlim = /vlim=`ax_lo`:`ax_hi` + +LET/like=yvar indep_var = y[gy=vaxis] + +DEFINE SYMBOL axes_already_defined = 1 + + +IF `(($ax_label_x"0|*>1") + ($ax_label_y"0|*>1") GE 1) AND \ + (($ferret_thumb"0|0|*>1") EQ 0)` THEN + DEFINE VIEW/AXES/X=0.12:0.99/y=0.06:0.93 full_view + DEFINE VIEW/AXES/X=0.12:0.99/y=0.1:0.93 full_view2 + SET VIEW full_view +ENDIF + +IF ($ferret_thumb"0|0|*>1") THEN + DEFINE VIEW/AXES/X=0.12:0.99/y=0.1:0.93 full_view + DEFINE VIEW/AXES/X=0.12:0.99/y=0.1:0.93 full_view2 + SET VIEW full_view +ENDIF + +! Make the plot, keeping only axis labels +PLOT/VS($hlim)($vlim)/sym=dot/ribbon/pal=white/set xvar, yvar, xvar + ppl title + if ($lab1"0|*>1") THEN go unlabel 1 + if ($lab2"0|*>1") THEN go unlabel 2 + if ($lab3"0|*>1") THEN go unlabel 3 + if ($lab4"0|*>1") THEN go unlabel 4 + if ($lab5"0|*>1") THEN go unlabel 5 + if ($lab6"0|*>1") THEN go unlabel 6 +PPL RIBBON + + +! compute ngood and nbad data used later in setting symbol size + +LET compute_good = ($xvar)* ($yvar) +IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `compute_good[i=@ngd]` +IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `compute_good[i=@nbd]` + +IF `($data_count"0") GT 2` THEN + LET compute_good = ($xvar)* ($yvar)* ($zvar) + IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = `compute_good[i=@ngd]` + IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = `compute_good[i=@nbd]` +ENDIF + + +DEFINE SYMBOL xvar = constraints_mask*xvar +DEFINE SYMBOL yvar = constraints_mask*yvar +LET p = ($xvar) +LET q = ($yvar) + +! End of file ------------ LAS_xytvar_griddat_setup.jnl-------------------------- + + diff --git a/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl index baf480431..1fb61790b 100644 --- a/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl @@ -2,17 +2,22 @@ ! Profile_2D_poly.jnl ! ! Creates a 2D plot with a blank 'basemap' and an overlay of points -! drawn in the pie style from ($ferret_plot_var) defined in LAS_initialize_data_insitu. +! For Profile or Timeseries datasets as a map plot showing the stations +! If it is a TimeseriesProfile dataset or TrajectoryProfile dataset the extra +! setup needed is here. ! ! 10/17/17 Variables may be on the I or E direction; account for that getting @NGD or @NBD. ! 10/17/17 Simplify: this map plot does not do color-by, so no need for any of that setup. ! 4/ 4/18 Use the nice new PyFerret plot-shapes if running the right version of PyFerret +! 9/28/20 Use updated PyFerret and PLOT/ALONG=xy to plot this as a 2-D lon/lat plot +! ! Set the gif filename, changing it from .gif to the name from this request ! Set up to write info to the debug log so that FshowGO can be used GO LAS_initial_setup + ! Initialize the region and data. DEFINE SYMBOL data_initialization_script = feature_initialize_data_insitu @@ -37,136 +42,27 @@ DEFINE SYMBOL data_name_in = ($data_0_var) GO LAS_initialize_data 0 +LET gattnames = ..attnames +IF `IS_ELEMENT_OF_STR(gattnames, "featureType") GE 1` THEN + DEFINE SYMBOL feature_type = `..featureType` -LET gettype= ($ferret_plot_var) -DEFINE SYMBOL vtype = `gettype,RETURN=dtype` -DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") - -! The chosen "plot-by" variable has no effect on this result. -! It is only ever a set of locations on the map. Reduce possible -! complications with data type of variable etc by substituting longitude. - -DEFINE SYMBOL ferret_plot_var ($data_x_var) -DEFINE SYMBOL data_var ($data_x_var) - -! Check for errors (They often occur during dataset initialization.) - -IF ($error_status"0|*>1") THEN - MESSAGE/ERROR **ERROR ($error_string) - EXIT/PROGRAM -ENDIF - -! Set the URL label for the first dataset. -GO LAS_url_label 0 - -! For the annotations - -define axis/($dsgshape)=1:($numobs):1 simpleax -let countdata = ($data_0_var)[g($dsgshape)=simpleax] - -IF ($dsgshape"0|POINT>1|*>0) THEN - IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = 1 - IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = 1 -ELSE - IF ($is_string) THEN - DEFINE SYMBOL ngood_data = 0 - DEFINE SYMBOL nbad_data = 0 - ELSE - stat ($data_0_var) - IF `($ngood_data"-10|*>1") LT 0` THEN DEFINE SYMBOL ngood_data = ($stat_ngood) - IF `($nbad_data"-10|*>1") LT 0` THEN DEFINE SYMBOL nbad_data = ($stat_nbad) - ENDIF -ENDIF - -! Plot qualifiers (graticule lines etc) -GO LAS_set_plot_qualifiers - -! Open the window -GO LAS_open_window - -! Create the blank plot with bathymetries, -! coastlines, etc. - -DEFINE SYMBOL basemap_palette = grayscale -DEFINE SYMBOL basemap_levels = (-inf)(-10000,-1000,1000)(-1000,0,100) -GO LAS_XY_overlay_basemap - -PPL SHASET PROTECT +GO LAS_pp_set_feature_shapes -GO LAS_fland gray_dark -PPL SHASET PROTECT +DEFINE SYMBOL qualifiers = ($qualifiers)/SIZ=0.12/SYM=($pyshape20)/HIGHLIGHT -! Define plot qualifiers for polygon overlay +! Degenerate datasets with just one point will not be seen by PyFerret as a DSG dataset -DEFINE SYMBOL qualifiers = ($qualifiers)/OVER/NOLAB - -! There is no plot variable defined - only plotting locations - -! so do not plot the key. - -DEFINE SYMBOL qualifiers = ($qualifiers)/NOKEY - -! Just draw symbols at each location -! If lon and lat are on the obs axis, pull out a single location -! for each feature id. - -LET xpoints = ($data_x_var) -LET ypoints = ($data_y_var) - -! Draw the locations as a light-blue circle with blue outline. -IF `($program_name"0|PyFerret>1|*>0") AND ($FERRET_VERSION) GE 7.32` THEN - GO LAS_pp_set_feature_shapes - PLOT/VS/OVER/NOLAB/NOKEY/ribbon/highlight=blue/PALETTE=cyan/siz=0.15/sym=($pyshape20) xpoints, ypoints, ypoints -ELSE - PLOT/OVER/NOLAB/VS/THICK=3/SYM=28/SIZ=.08/COLOR=lightblue xpoints, ypoints - PLOT/OVER/NOLAB/VS/SYM=28/SIZ=.12/COLOR=blue xpoints, ypoints -ENDIF - -! These are expected by LAS_results -DEFINE SYMBOL data_plotted_min = 1 -DEFINE SYMBOL data_plotted_max = 1 - -! Add any constraint labels in the lower left, or as annotation notes. -! (The constraints themselves are handled in the data request from ERDDAP. -! We do not need masking for constraints in map plots.) - -IF `($ferret_annotations%0|*>1%)` THEN - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - DEFINE SYMBOL note_num = `($note_num"0") + 1`; \ - DEFINE SYMBOL note_($note_num)_lab = ($mask_title_($mmask)); \ - ENDIF) +IF ($shape"|POINT>1|*>0") THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/RIBBON/VS + DEFINE SYMBOL no_dsg = 1 ELSE - - IF `($nmask_labels"0|*>1") EQ 0` THEN DEFINE SYMBOL nmask_labels = 1 - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - DEFINE SYMBOL label_x = `-0.95*($ppl$xorg)` - DEFINE SYMBOL label_y = `-0.95*($ppl$yorg) + 0.2*(($nmask_labels)-1)` - - REPEAT/RANGE=1:`($nmask_labels)`:1/NAME=m (\ - DEFINE SYMBOL mmask = `m`;\ - IF ($mask_title_($mmask)"0|*>1) THEN ; \ - LABEL/NOUSER `($label_x)`, `($label_y)`, -1, 0, 0.12, ($mask_title_($mmask)) ; \ - DEFINE SYMBOL label_y = `($label_y) - 0.2`; \ - ENDIF) + DEFINE SYMBOL qualifiers = ($qualifiers)/ALONG=xy + IF ($feature_type"0|TrajectoryProfile>1|trajectoryProfile>1|*>0") THEN \ + DEFINE SYMBOL qualifiers = ($qualifiers)/line/fast ENDIF -! Add feature information on the top -GO feature_labels - -! If constraints are shown via constraint_0_lhs etc, define labels for those -GO set_constraint_labels - -! Save the results - -! Get rid of the label that would be drawn, no valid data -IF ($is_string"0") THEN DEFINE SYMBOL ngood_data = 1 +GO Trajectory_2D_poly -GO LAS_results box -! End of file ------------LAS_insitu_pie_xy.jnl-------------------------- +! End of file ------------ Profile_2D_poly.jnl -------------------------- diff --git a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl index 1683ac233..d7425acdd 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl @@ -72,6 +72,10 @@ ELSE LET datmin = ($stat_min) LET datmax = ($stat_max) ENDIF +IF ($no_dsg"0|*>1") THEN + DEFINE SYMBOL save_plot_var = ($ferret_plot_var) + DEFINE SYMBOL ferret_plot_var ($data_x_var), ($data_y_var), ($ferret_plot_var) +ENDIF ! Special color-by-time key IF ($ferret_plot_key"0|date_key>1|*>0") THEN @@ -210,7 +214,11 @@ IF `IS_ELEMENT_OF_STR(lonattnames, "actual_range") GT 0 AND \ LET latmin `lvar[i=@min],PREC=9` IF `lonmax-lonmin LT 0.1 AND latmax-latmin LT 0.1` THEN - DEFINE SYMBOL qualifiers = ($qualifiers)/SYM=21/SIZ=0.1 + IF `STRINDEX("($qualifiers)", "SYM") EQ 0` THEN + DEFINE SYMBOL qualifiers = ($qualifiers)/SYM=21/SIZ=0.1 + ELSE + DEFINE SYMBOL qualifiers = ($qualifiers)/SIZ=0.1 + ENDIF DEFINE SYMBOL is_mooring = 1 ENDIF ENDIF @@ -220,7 +228,7 @@ IF ($single_color"0|*>1") THEN ENDIF ! When there are just a few points (missing or valid), draw a colored symbol as well as the ribbon line. -!IF `($numobs) LE 30` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/SYM=17 +!IF `($numobs) LE 30 and (STRINDEX("($qualifiers)", "SYM") EQ 0)` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/SYM=17 ! Points will mark location of missing data if needed ! Use color=1 for black... @@ -253,7 +261,6 @@ ELSE PPL RIBBON/OVER ENDIF - ! Hack: histogram levels IF `STRINDEX("($ferret_fill_levels)", "H") GT 0 OR STRINDEX("($ferret_fill_levels)", "h") GT 0` THEN \ PLOT($qualifiers)/missing=black/nokey var_data @@ -263,12 +270,66 @@ SAY _________________ total time for line plot, seconds ! For the results script, IF ($ferret_plot_var"0|*>1") THEN + IF ($save_plot_var"0|*>1") THEN DEFINE SYMBOL ferret_plot_var = ($save_plot_var) DEFINE SYMBOL data_plotted_min = `datmin,prec=7` DEFINE SYMBOL data_plotted_max = `datmax,prec=7` ENDIF + +! Create labels for the Z and T region + +! Is there a Z region to label? + +IF `($no_dsg"0|*>1") EQ 0 AND ($region_z_lo"0") NE 0` THEN + + DEFINE SYMBOL n_left_labels = `($n_left_labels"0") + 1` + DEFINE SYMBOL zcoord = `($ferret_plot_var),return=zcoord` + + IF `($region_z_lo"0") EQ ($region_z_hi"($zf)")` THEN + let zq = ($region_z_lo"0") + DEFINE SYMBOL upper_left_($n_left_labels) = Depth: `zq,PREC=4` `($zcoord),RETURN=units` + ELSE + DEFINE AXIS/z=($region_z_lo"0"):($region_z_hi"0"):0.1/units="`($zcoord),RETURN=units`" zqencode + LET zq = z[gz=zqencode] + DEFINE SYMBOL upper_left_($n_left_labels) = Depth: `zq,RETURN=zstart,PREC=4` to `zq,RETURN=zend,PREC=4` `($zcoord),RETURN=units` + ENDIF + + DEFINE SYMBOL depth_lab = ($upper_left_($n_left_labels"0")) + + CANCEL VAR zq + CANCEL AXIS zqencode +ENDIF + +! There will always be a T region + +DEFINE SYMBOL n_left_labels = `($n_left_labels"0") + 1` + +IF `STRCMP("($region_t_lo)", "($region_t_hi)") EQ 0` THEN + DEFINE SYMBOL upper_left_($n_left_labels) = Time: ($region_t_lo) +ELSE + DEFINE SYMBOL upper_left_($n_left_labels) = Time: ($region_t_lo):($region_t_hi) +ENDIF +DEFINE SYMBOL time_lab = ($upper_left_($n_left_labels)) + +! IF it's a profile-as map plot, etc, then add a note about the data shown. + +IF `STRINDEX("($qualifiers)", "ALONG") GT 0` THEN + DEFINE SYMBOL note_num = `($note_num"0") + 1` + Define symbol dat_direction = Z + IF ($feature_type"0|Timeseries>1|*>0") THEN DEFINE SYMBOL dat_direction = T + DEFINE SYMBOL note_($note_num)_lab = Colored by average of each ($feature_type) in ($dat_direction) region selected +ENDIF + + +DEFINE SYMBOL note_num = `($note_num"0") + 1` +IF ($its_profile_map"0|*>1") THEN + DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s) locations shown +ELSE + DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s), ($ngood_data) points shown +ENDIF + -! Add labels at the top for the dataset name etc if they exist +! Add labels at the top for the dataset name etc if they exist GO labels_above_plot ! if constraints are shown via constraint_0_lhs etc, define labels for those diff --git a/JavaSource/resources/ferret/scripts/decimation_labels.jnl b/JavaSource/resources/ferret/scripts/decimation_labels.jnl new file mode 100644 index 000000000..96f5d7adf --- /dev/null +++ b/JavaSource/resources/ferret/scripts/decimation_labels.jnl @@ -0,0 +1,84 @@ +! decimation_labels.jnl + +! Don't label the decimation counts. It's too inaccurate and confusing. + + +IF ($nolabels_decimation_counts"0|*>1") THEN ! make points-shown annotations or not + + DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s) shown + + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL note_($note_num)_lab = Data subsampled for efficiency (explanation) +ELSE ! make points-shown annotations or not + + LET full_good = -9999 + + IF `(IS_ELEMENT_OF_STR_N(varnames, "nobs_full") EQ 0) OR\ + (IS_ELEMENT_OF_STR_N(varnames, "nobs_deci") EQ 0)` THEN + MESSAGE/ERROR **ERROR nobs_full and nobs_deci not in the netCDF file" + EXIT/PROGRAM + ENDIF + +! compute overall fraction for decimation of the features returned + LET frac_deci = `nobs_deci[m=@sum]/nobs_full[m=@sum]` + LET frac_deci_all = `nobs_deci[m=@sum]/nobs_full[m=@sum]` + + IF `frac_deci GT 1` THEN + LET frac_deci = 1 + + ELIF `frac_deci GT 0` THEN + LET full_good = ($ngood_data)/frac_deci + LET full_bad = ($nbad_data)/frac_deci + ENDIF + let full_all = `full_good` + +! Make the computation on a per-feature basis, the count of good data +! in the feature related to the decimation fraction for that feature + + LET frac_deci = nobs_deci/nobs_full ! fraction for each feature + + LET maxrow = `($rowvar)[m=@max]` + DEFINE AXIS/x=1:`maxrow`:1 xrow + LET xvar = x[gx=xrow] + + LET ok = IF ($data_var_in) THEN 1 + LET ok2d = EXPNDI_BY_M_COUNTS(ok, ($rowvar), xvar) + LET ok_feature = ok2d[x=@sum] + LET ok_feature_full = IF frac_deci GT 0 THEN ok_feature/frac_deci ELSE 0 + LET full_good = ok_feature_full[m=@SUM] + + IF `full_good GT 1.e6` THEN + DEFINE SYMBOL approx_msg = `full_good/1.e6,prec=3` million + ELIF `full_good GT 1.e3` THEN + DEFINE SYMBOL approx_msg = `full_good/1.e3,prec=2` thousand + ELSE + DEFINE SYMBOL approx_msg = `full_good,prec=3` + ENDIF + + IF `($nbad_data"0|*") GT 0` THEN + LET full_bad = full_good * ($nbad_data)/($ngood_data) + IF `full_bad GT 1.e6` THEN + DEFINE SYMBOL approx_bad = `full_bad/1.e6,prec=2` million + ELIF `full_bad GT 1.e3` THEN + DEFINE SYMBOL approx_bad = `full_bad/1.e3,prec=2` thousand + ELSE + DEFINE SYMBOL approx_bad = `full_bad,prec=2` + ENDIF + ENDIF + + DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s), approx. ($approx_msg) valid obs + IF ($approx_bad"0|*>1") THEN \ + DEFINE SYMBOL note_($note_num)_lab = ($prof_traj_shown) ($feature_type)($c_s), approx. ($approx_msg) valid obs plus ($approx_bad) missing + +! Put a link to the doc containing description of the decimation scheme. + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL note_($note_num)_lab = Subsample of ($ngood_data) valid points shown (explanation) + IF `($nbad_data"0") GT 0` THEN \ + DEFINE SYMBOL note_($note_num)_lab = Subsample of ($ngood_data) valid and ($nbad_data) missing \ +points shown (explanation) + +ENDIF ! make points-shown annotations or not + + +!---------------- end of decimation_labels.jnl ------------------------- + diff --git a/JavaSource/resources/ferret/scripts/dsg_feature_name.jnl b/JavaSource/resources/ferret/scripts/dsg_feature_name.jnl new file mode 100644 index 000000000..538bda275 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/dsg_feature_name.jnl @@ -0,0 +1,42 @@ + + +IF `($feature_variable"0|*>1") EQ 0` THEN EXIT/SCRIPT + +LET feature_name = ($feature_variable) + +! If the feature variable is a regular variable not a coordinate, +! make a string version of it. + +IF `STRINDEX("($feature_variable)", "(") EQ 0` THEN + +! are the feature-id's numeric"? and not just 1,2,3...? +! If so make them become the id string. + + DEFINE SYMBOL vtype = `($feature_variable),RETURN=dtype` + + IF `($vtype"0|CHAR>1|*>0") EQ 0` THEN + LET idlen = `($feature_variable)[m=@max]` + LET nlen = INT( 1+LOG(idlen) ) + LET/d=($dsetnum"1") feature_name = FLOATSTR(($feature_variable), "(i`nlen`)") + ENDIF + +! Is the feature-variable a coordinate variable? If it's numeric +! define the feature_name to be the values. + +ELSE + + LET cnames = ..coordnames + DEF SYM dname = `cnames[i=($q)]` + + let ee_var = _e[ge=($dname)] + LET nlen = INT(1+LOG(ee_var[m=@max])) + LET/d=($dsetnum"1") feature_name = FLOATSTR(ee_var, "(i`nlen`)") + +! Previously concocted id's based on the location/ time. With DSG datasets +! lets not do this. Use feature-ID variable whatever it is. + +ENDIF + +DEFINE SYMBOL feature_name = feature_name + +!---------------- end of dsg_feature_name.jnl ------------------------- diff --git a/JavaSource/resources/ferret/scripts/reshape_list_var.jnl b/JavaSource/resources/ferret/scripts/reshape_list_var.jnl deleted file mode 100644 index b97607940..000000000 --- a/JavaSource/resources/ferret/scripts/reshape_list_var.jnl +++ /dev/null @@ -1,33 +0,0 @@ -! reshape_list_var.jnl -! -! When writing a variable to an ascii file from list_traj_data.jnl, -! metadata variables need to be expanding to the obs axis. - -DEFINE SYMBOL reshape_var = ($1) - - -DEFINE SYMBOL trajshape = `($reshape_var),RETURN=shape` -LET shapeit = `($trajshape"0|E>1|POINT>1|*>0)` - -IF `shapeit EQ 0` THEN EXIT/SCRIPT - -LET gettype = ($reshape_var) -DEFINE SYMBOL vtype = `gettype,RETURN=dtype` -DEFINE SYMBOL is_string = ($vtype"0|CHAR>1|*>0") - -DEFINE SYMBOL expnd_fcn = EXPND_BY_LEN -IF ($is_string) THEN DEFINE SYMBOL expnd_fcn = EXPND_BY_LEN_STR - -LET total_obs = `longitude,return=isize` -SET var/name=($reshape_var)_in ($reshape_var) - -LET ($reshape_var)_xpnd = ($expnd_fcn)(($reshape_var)_in, ($rowvar), `total_obs`) -LET/TITLE="`($reshape_var)_in,RETURN=title`" ($reshape_var) = RESHAPE (($reshape_var)_xpnd, longitude) - -! add units if the original variable had units. -DEF SYM ($reshape_var)_units = `($reshape_var)_in,RETURN=units`NoUnItS -IF `STRCMP("($($reshape_var)_units)", "NoUnItS") NE 0` THEN - SET VAR/UNITS="`($reshape_var)_in,RETURN=units`" ($reshape_var) -ENDIF - -! End of script ---------- reshape_list_var.jnl---------------------------- diff --git a/JavaSource/resources/ferret/scripts/setup_date_key.jnl b/JavaSource/resources/ferret/scripts/setup_date_key.jnl new file mode 100644 index 000000000..7330b48e4 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/setup_date_key.jnl @@ -0,0 +1,28 @@ +! setup_date_key.jnl +! Set up to label the color key with dates + + +IF `($data_t_var"0|*>1") EQ 0` THEN + MESSAGE/ERROR **ERROR color by date but date-variable not defined + EXIT/PROGRAM +ENDIF + +DEFINE SYMBOL shape = `($data_t_var),RETURN=shape` +DEFINE SYMBOL indx = ($shape"0|POINT>0|X>i|Z>k|T>l|E>m*>0") + +IF `($indx"0|*>1") EQ 0` THEN + MESSAGE/ERROR **ERROR color by date but time is just one point + EXIT/PROGRAM +ENDIF + +GO define_dsg_taxis + +DEFINE SYMBOL datekey = 1 +DEFINE SYMBOL ferret_key_annotate = 0 + +DEFINE SYMBOL datekey_time_arg = ttvar + +IF `($ferret_plot_levels"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_plot_levels = 50 +IF `($ferret_fill_levels"0|*>1") EQ 0` THEN DEFINE SYMBOL ferret_fill_levels = ($ferret_plot_levels) + +! End of script ------------ setup_date_key.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/setup_dsg_constraints.jnl b/JavaSource/resources/ferret/scripts/setup_dsg_constraints.jnl new file mode 100644 index 000000000..00f134701 --- /dev/null +++ b/JavaSource/resources/ferret/scripts/setup_dsg_constraints.jnl @@ -0,0 +1,144 @@ +! setup_dsg_constraints.jnl +! Define mask that captures variable constraints for Prop-Prop plots +! of DSG datasets +! + +! A constraint comes as a set of 4 symbols +! each var ge one value and le another value. + +! constraint_n_lhs is the variable name +! constraint_n_op is the operation (le, ge) +! constraint_n_rhs is the value +! constraint_n_type must be "variable" (will there be other types of constraints?) + +DEFINE SYMBOL translate_math = 1 + +! Define var_mask variable with all of the variable constraints. +! When there is a longitude constraint, define symbols with the values, +! to be used in making the map underlying prop-prop plots. + +LET vnames = ..varnames + +DEFINE SYMBOL var_mask = var_mask_0 +LET var_mask_0 = 1 ! may be redefined below. +LET nmaskx = 0 + +let npts = nx_var + +LET text_mask = 1 +let var_mask = 1 +let constraints_mask = 1 + +LET nx_var = `($rowvar)[m=@sum]` + +! Define mask based on constraints. Check for variable constraints on +! a quoted variable e.g. 'K' + + +IF `($dsg_x_var"0|*>1") EQ 0` THEN DEFINE SYMBOL dsg_x_var = 0 +IF `($dsg_y_var"0|*>1") EQ 0` THEN DEFINE SYMBOL dsg_y_var = 0 +IF `($dsg_z_var"0|*>1") EQ 0` THEN DEFINE SYMBOL dsg_z_var = 0 +IF `($dsg_t_var"0|*>1") EQ 0` THEN DEFINE SYMBOL dsg_t_var = 0 +! IF ($constraint_($ic)_lhs"0|($dsg_x_var)*>1|*>0") THEN EXIT/LOOP;\ +! IF ($constraint_($ic)_lhs"0|($dsg_y_var)*>1|*>0") THEN EXIT/LOOP;\ +! IF ($constraint_($ic)_lhs"0|($dsg_z_var)*>1|*>0") THEN EXIT/LOOP;\ +! IF ($constraint_($ic)_lhs"0|($dsg_t_var)*>1|*>0") THEN EXIT/LOOP;\ + +REPEAT/RANGE=0:100/NAME=ic (\ + DEFINE SYMBOL ic = `ic`;\ + IF `($constraint_($ic)_lhs"0|*>1") EQ 0` THEN EXIT/LOOP;\ + DEFINE SYMBOL cvar = ($constraint_($ic)_lhs);\ + DEFINE SYMBOL cvarnq = ($constraint_($ic)_lhs);\ + GO LAS_unquote_string cvarnq;\ + LET has_var = `(IS_ELEMENT_OF_STR_N(vnames, "($cvarnq)") GT 0) OR (IS_ELEMENT_OF_STR_N(vnames, "($cvarnq)_") GT 0)`;\ + IF `has_var EQ 0` THEN EXIT/CYCLE;\ + IF `IS_ELEMENT_OF_STR_N(vnames, "($cvar)_") GT 0` THEN DEFINE SYMBOL cvar = ($cvar)_;\ + IF `($constraint_($ic)_type"0|variable>1|*>0") EQ 0` THEN EXIT/CYCLE;\ + LET var_mask_($ic) = IF ($cvar) ($constraint_($ic)_op) ($constraint_($ic)_rhs) THEN 1; \ + LET nc = `($cvar),RETURN=isize`;\ + LET var_mask_($ic) = IF ($cvar) ($constraint_($ic)_op) ($constraint_($ic)_rhs) THEN 1; \ + IF ($constraint_($ic)_rhs"0|NaN>1|*>0") THEN LET var_mask_($ic) = IF ($cvar) THEN 1;\ + LET nmaskx = `nmaskx+1`;\ + IF `nmaskx GT 1` THEN DEFINE SYMBOL var_mask = ($var_mask)* var_mask_($ic) ;\ + ) + +! Handle details for constraints in space and time + + +REPEAT/RANGE=0:100/NAME=ic (\ + DEFINE SYMBOL ic = `ic`;\ + IF `($constraint_($ic)_lhs"0|*>1") EQ 0` THEN EXIT/LOOP;\ + IF `STRINDEX("($constraint_($ic)_lhs%0%)", "($dsg_y_var)") AND ($constraint_($ic)_op"0|gt>1|*>0")` THEN DEFINE SYMBOL constr_y_min = ($constraint_($ic)_rhs) ;\ + IF `STRINDEX("($constraint_($ic)_lhs%0%)", "($dsg_y_var)") AND ($constraint_($ic)_op"0|le>1|*>0")` THEN DEFINE SYMBOL constr_y_max = ($constraint_($ic)_rhs) ;\ + IF `STRINDEX("($constraint_($ic)_lhs%0%)", "($dsg_z_var)") AND ($constraint_($ic)_op"0|gt>1|*>0")` THEN DEFINE SYMBOL constr_z_min = ($constraint_($ic)_rhs) ;\ + IF `STRINDEX("($constraint_($ic)_lhs%0%)", "($dsg_z_var)") AND ($constraint_($ic)_op"0|le>1|*>0")` THEN DEFINE SYMBOL constr_z_max = ($constraint_($ic)_rhs) ;\ + IF `STRINDEX("($constraint_($ic)_lhs%0%)", "($dsg_t_var)") AND ($constraint_($ic)_op"0|gt>1|*>0")` THEN DEFINE SYMBOL constr_tim_min = ($constraint_($ic)_rhs) ;\ + IF `STRINDEX("($constraint_($ic)_lhs%0%)", "($dsg_t_var)") AND ($constraint_($ic)_op"0|le>1|*>0")` THEN DEFINE SYMBOL constr_tim_max = ($constraint_($ic)_rhs) ;\ + ) + +IF `nmaskx GT 0` THEN LET var_mask = ($var_mask) + + +! define a region for the plot - needs constr_x_max to be defined if constr_x_min is, etc +! If that constraint was not defined, use the data max + +LET dir_var = XSEQUENCE(($dsg_x_var)) +IF `($constr_x_min"-1.e34|*>1") NE -1.e34 AND ($constr_x_max"-1.e34|*>1") EQ -1.e34` THEN DEFINE SYMBOL constr_x_max = `dir_var[x=@max]` +IF `($constr_x_max"-1.e34|*>1") NE -1.e34 AND ($constr_x_min"-1.e34|*>1") EQ -1.e34` THEN DEFINE SYMBOL constr_x_min = `dir_var[x=@min]` + +LET dir_var = XSEQUENCE(($dsg_y_var)) +IF `($constr_y_min"-1.e34|*>1") NE -1.e34 AND ($constr_y_max"-1.e34|*>1") EQ -1.e34` THEN DEFINE SYMBOL constr_y_max = `dir_var[x=@max]` +IF `($constr_y_max"-1.e34|*>1") NE -1.e34 AND ($constr_y_min"-1.e34|*>1") EQ -1.e34` THEN DEFINE SYMBOL constr_y_min = `dir_var[x=@max]` + +LET dir_var = XSEQUENCE(($dsg_y_var)) +IF `($constr_z_min"-1.e34|*>1") NE -1.e34 AND ($constr_z_max"-1.e34|*>1") EQ -1.e34` THEN DEFINE SzMBOL constr_z_max = `dir_var[x=@max]` +IF `($constr_z_max"-1.e34|*>1") NE -1.e34 AND ($constr_z_min"-1.e34|*>1") EQ -1.e34` THEN DEFINE SzMBOL constr_z_min = `dir_var[x=@max]` + +LET dir_var = XSEQUENCE(($dsg_y_var)) +IF `($constr_t_min"-1.e34|*>1") NE -1.e34 AND ($constr_t_max"-1.e34|*>1") EQ -1.e34` THEN DEFINE StMBOL constr_t_max = `dir_var[x=@max]` +IF `($constr_t_max"-1.e34|*>1") NE -1.e34 AND ($constr_t_min"-1.e34|*>1") EQ -1.e34` THEN DEFINE StMBOL constr_t_min = `dir_var[x=@max]` + +! Define a plot qualifier with the region - then maps etc will shrink to the requested size. +IF `($constr_x_min"-1.e34|*>1") NE -1.e34 ` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/x=($constr_x_min):($constr_x_max) +IF `($constr_y_min"-1.e34|*>1") NE -1.e34 ` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/y=($constr_y_min):($constr_y_max) +IF `($constr_z_min"-1.e34|*>1") NE -1.e34 ` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/z=($constr_z_min):($constr_z_max) +IF `($constr_t_min"-1.e34|*>1") NE -1.e34 ` THEN DEFINE SYMBOL qualifiers = ($qualifiers)/t=($constr_t_min):($constr_t_max) + +sh sym qualifiers + +! Now look for text constraints. If the constraint is on the feature variable, ignore it. +! Those constrataints will be passed as a Ferret property. + +LET ntxtconstr = 0 +REPEAT/RANGE=0:100/NAME=ic (\ + DEFINE SYMBOL ic = `ic`;\ + IF `($constraint_($ic)_lhs"0|*>1") EQ 0` THEN EXIT/LOOP;\ + DEFINE SYMBOL cvar = ($constraint_($ic)_lhs);\ + IF `($cvar"0|($feature_variable%A%)>0|*>1") EQ 0` THEN EXIT/CYCLE;\ + LET ignore = 0;\ + IF ($ignore_vars"0|*>1") THEN LET ignore = \ + `(IS_ELEMENT_OF_STR_N(ignore_constraints, "($cvar)") GT 0) OR \ + (IS_ELEMENT_OF_STR_N(ignore_constraints, "($cvar)_") GT 0)`;\ + IF `ignore GE 0` THEN EXIT/CYCLE;\ + IF `($constraint_($ic)_type"0|text>1|*>0") EQ 1` THEN LET ntxtconstr = `ntxtconstr+1`;\ + ) + +DEFINE SYMBOL ic = 0 +LET i_mask = _m[ge=($rowvar)] +DEFINE SYMBOL itxt = 0 +DEFINE SYMBOL text_mask = 0 + +IF `ntxtconstr EQ 0` THEN EXIT/SCRIPT + +REPEAT/RANGE=0:100/NAME=ic (GO set_text_constraints;\ + IF `text_constraints_done EQ 1` THEN EXIT/LOOP) + +! Text masks are zero and 1 so they can be added. +! Now make it a mask with missing and 1, to multiply with var_mask + +LET text_mask_zero = ($text_mask) +LET text_mask = IF text_mask_zero NE 0 THEN 1 + + + +! End of ------------- setup_dsg_constraints.jnl-------------------------- diff --git a/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl b/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl index a5eceb1b5..3c4ee774b 100644 --- a/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl +++ b/JavaSource/resources/ferret/scripts/setup_prop_prop.jnl @@ -356,10 +356,11 @@ IF `($data_count"0") GE 3` THEN ! color by 3rd variable DEFINE SYMBOL zshape = `($ferret_plot_var_2),return=shape` DEFINE SYMBOL zshape = ($zshape"|POINT>E|*") LET zvar = _($zshape"|X>i|Y>j|Z>k|T>l|E>m|F>n")[g($zshape)=($ferret_plot_var_2)] - ENDIF - DEFINE SYMBOL note_num = `($note_num"0") + 1` - DEFINE SYMBOL note_($note_num)_lab = ($data_2_title) is not numeric. Plot without color. - CANCEL SYMBOL ferret_plot_var + ELSE + DEFINE SYMBOL note_num = `($note_num"0") + 1` + DEFINE SYMBOL note_($note_num)_lab = ($data_2_title) is not numeric. Plot without color. + CANCEL SYMBOL ferret_plot_var + ENDIF ENDIF ENDIF diff --git a/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl b/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl index 94aeda99a..55fbe582c 100644 --- a/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl +++ b/JavaSource/resources/ferret/scripts/setup_watch_circle.jnl @@ -117,20 +117,21 @@ let q_var = q + pqmask ! Define axes for both variables using the range in the data !--------- -LET amin = p_var[i=@MIN] -LET amax = p_var[i=@MAX] -LET bmin = q_var[i=@MIN] -LET bmax = q_var[i=@MAX] +LET amin = p_var[t=@MIN] +LET amax = p_var[t=@MAX] +LET bmin = q_var[t=@MIN] +LET bmax = q_var[t=@MAX] +list amin,amax,bmin,bmax -LET locx = ($deploy_lon)[i=1] -LET locy = ($deploy_lat)[i=1] +LET locx = ($deploy_lon)[e=1] +LET locy = ($deploy_lat)[e=1] ! Compute radius of circle: max excursion from the deployment location. ! The plot range is the max of this size and the watch circle radius -LET radii = ((p_var - locx)^2 + (q_var - locy)^2)^0.5 -LET wc_rad_compute = radii[i=@max] +LET radii = ((p_var - (`locx`))^2 + (q_var - (`locy`))^2)^0.5 +LET wc_rad_compute = radii[t=@max] LET wc_rad = wc_rad_compute LET axis_add = wc_rad_compute @@ -208,7 +209,7 @@ PPL SHADE PLOT/VS/OVER/NOLAB/THICK=3/sym=21/SIZ=0.2/color=lightblue locx, locy PLOT/VS/OVER/NOLAB/THICK=3/sym=27/SIZ=0.18/color=black locx, locy -PLOT/VS/OVER/NOLAB/LINE/k=1:628/COLOR=6/pal=rnb locx + wc_rad*cos(k/100), locy + wc_rad*sin(k/100) +PLOT/VS/OVER/NOLAB/LINE/k=1:628/COLOR=6/pal=rnb `locx` + `wc_rad`*cos(k/100), `locy` + `wc_rad`*sin(k/100) ! If put_label was defined, something caused one or both variables to be all BAD. IF ($put_label"0|*>1") THEN @@ -269,4 +270,6 @@ DEFINE SYMBOL yvar = constraints_mask*yvar LET p = ($xvar) LET q = ($yvar) +define symbol watch_plot = 1 + ! End of file setup_watch_circle.jnl-------------------------- From 91dd5784d33146187c0901d9bb098c13d9032e02 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Mon, 28 Sep 2020 13:48:24 -0700 Subject: [PATCH 10/15] remove obsolete script feature_initialize_vars.jnl --- .../scripts/feature_initialize_vars.jnl | 136 ------------------ 1 file changed, 136 deletions(-) delete mode 100644 JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl diff --git a/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl b/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl deleted file mode 100644 index 815acce71..000000000 --- a/JavaSource/resources/ferret/scripts/feature_initialize_vars.jnl +++ /dev/null @@ -1,136 +0,0 @@ -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! $Header$ -! feature_initialize_vars.jnl -! -! Define variables and symbols based on feature identification variables -! in a DSG dataset -! -! feature_ID -- unique identifier for each trajectory or profile - -!acm 2/2009 Additions to the symbol definitions at the end to -! allow for null strings: replace these with "none" - -! Cancel the XY region. These limits have nothing to do with the -! I and J axes of the intermediate data file. - -IF `($ferret_memory"25.6") LT 200` THEN SET MEM/siz=200 - -! Create the 'feature_evnt' variable which increments for each new -! trajectory or profile. - -! NOTE: The calculation of individual trajectories or profiles only works if the -! NOTE: intermediate netCDF files is ordered by feature_ID. Make sure that -! NOTE: the SQL query (dsg request?) ends with: 'ORDER BY feature_ID'. - -DEFINE SYMBOL feature_max_labels = 200 -DEFINE SYMBOL numobs = `($data_var),return = isize` -LET num_e = `($data_var),return = msize` - -IF `num_e GT ($numobs)` THEN DEFINE SYMBOL numobs = `num_e` - -LET attnames = ($data_var).attnames -IF `IS_ELEMENT_OF_STR_N(attnames, "positive") GT 0` THEN - DEFINE SYMBOL pos = `($data_var).positive` - IF ($pos"0|down>1|*>0") THEN DEFINE SYMBOL plot_pos_down = 1 -ENDIF - -! Are the rowsize variables in the E direction? -DEFINE SYMBOL rdir = `($rowvar),RETURN=shape` -DEFINE SYMBOL rind = ($rdir"|X>I|E>M|POINT>M") - -LET n_subset = `($rowvar),RETURN=msize` -DEFINE AXIS/X=1:`n_subset`:1 xmask_axis - -IF `($numobs) EQ 1` THEN - LET nfeatures = 1 - DEFINE SYMBOL feature_max = 1 - - LET feature_numbers = i[gx=xmask_axis] - LET feature_mask = 1 + 0*feature_numbers - - LET longest = 1 - LET ccarg = XSEQUENCE(($data_var)) - LET data_var_c = EXPNDI_BY_Z_COUNTS(ccarg, XSEQUENCE(($rowvar)),`longest`) - - LET feature_n = x[i=1:1] - LET subset_mask = x[i=1:1] - - LET feature_mask_obs = 1 - DEFINE SYMBOL have_feature_mask = 1 - DEFINE SYMBOL have_feature_nums = 1 - -ELSE - -! Create ID's feature_numbers = i on obs axis. - - LET nfeatures = 1 - IF `($rind"0|I>1|*>0")` THEN LET nfeatures = `($rowvar),RETURN=isize` - IF `($rind"0|M>1|*>0")` THEN LET nfeatures = `($rowvar),RETURN=msize` - LET feature_numbers = i[gx=xmask_axis] - IF `($subset_mask"0|*>1") EQ 0` THEN LET feature_mask = 1 + 0*feature_numbers ! may redefine later - -! Scramble the IDs if we are coloring by ID, scramble them so features nearby in the alphabet -! more likely to get different colors. Create a 2D variable, reshape to it, then unravel -! that back out. - - DEFINE SYMBOL vshape = `($data_var),RETURN=shape` - LET color_by_index = `($vshape"0|E>1|*>0)` - LET color_by_feature = `STRCMP("($data_var)", "($feature_variable)") EQ 0` - - IF `color_by_feature EQ 1 OR color_by_index EQ 1` THEN - - LET color_by_feature = 1 - LET feature_numbers = _m[ge=($rowvar)] - - ! scramble - - define symbol factor = 0 - let nf = nfeatures - - repeat/range=2:15/name=fac (if `mod(nf,fac) eq 0` THEN DEFINE SYMBOL factor = `fac`) - let factor = 3 - IF `($factor"0") eq 0` then - let nf = `nf + 1` - repeat/range=2:15/name=fac (if `mod(nf,fac) eq 0` THEN DEFINE SYMBOL factor = `fac`) - ENDIF - IF `($factor"0") gt 2` THEN - - LET feature_numbers1 = _m[ge=($rowvar)] - let yfac = ($factor) - let xfac = INT(nfeatures/yfac) - IF `xfac*yfac LT nfeatures` THEN LET xfac = `xfac+1` - DEFINE AXIS/x=1:`xfac`:1 xfaxis - DEFINE AXIS/y=1:`yfac`:1 yfaxis - LET xyvar = x[gx=xfaxis]+y[gy=yfaxis] - - LET var2d = RESHAPE(feature_numbers1, xyvar) - LET feature_numbers2 = ESEQUENCE(TRANSPOSE_XY (var2d) ) - LET feature_numbers = feature_numbers2[ge=feature_numbers1] - - ENDIF - - DEFINE SYMBOL have_feature_nums = 1 -! Large number of color levels, but not larger than # of features. - - IF ($ferret_fill_levels"1|*>0") THEN - DEFINE SYMBOL ferret_fill_levels = 55 - IF `nfeatures LT 55` THEN DEFINE SYMBOL ferret_fill_levels = `nfeatures` - IF `nfeatures LT 30` THEN DEFINE SYMBOL ferret_fill_levels = (1,`nfeatures+1`,1) - ENDIF - - ENDIF ! feature var is the plot var - - DEFINE SYMBOL feature_max = `nfeatures` - LET longest = ($rowvar)[($rind)=@max]+2 - - LET ccarg = XSEQUENCE(($data_var)) - LET data_var_c = EXPNDI_BY_Z_COUNTS(ccarg, xsequence(($rowvar)),`longest`) - -! If a subset of feature ids is given then plot only those on a Prop/Prop -! plot, but using the symbols and colors as determined by the whole dataset. - -! Format the feature list and define the mask. - GO feature_list_mask -ENDIF - -!---------------- end of feature_initialize_vars.jnl ------------------------- From 57bd81e9c0e2124f256196b5d2e64d69b005e75d Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Mon, 28 Sep 2020 16:12:57 -0700 Subject: [PATCH 11/15] adding to comments --- JavaSource/resources/ferret/scripts/LAS_open_window.jnl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl index 3fa6d84ad..76fd81bf1 100644 --- a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl @@ -63,10 +63,15 @@ DEFINE SYMBOL wmark = 0 IF `($ferret_wmark_image"0|*>1") AND ($PROGRAM_NAME"|PyFerret>1|*>0) AND \ ($ferret_version) GE 7.63` THEN DEFINE SYMBOL wmark = ul +! Watermark: ! The set window/aspect= /size= of classic Ferret sets up PPLUS symbols ! WITDTH and HEIGHT of the window. Here, set the window using pixel sizes -! with the larger dimension of size 1000 for our typical setting of large plots, +! with the larger dimension of size ~1000 pix for the typical setting of large plots, ! and assuming 100 pixels width for plot margins. This approximates the sizes we see +! in classic-Ferret and PyFerret using SET WINDOW/ASPECT. +! Placing the watermark in locations other than the upper left needs work. What +! is shown here when setting wmark=ll, to put it in the lower right, instead puts +! it about a third of the way above the bottom of the plot. IF `($set_window_quals"0|*>1") EQ 0` THEN From b3126a5e2bec9bafa3bb8d5d7c397bf5fe250024 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Tue, 29 Sep 2020 11:58:42 -0700 Subject: [PATCH 12/15] change in symbol size --- JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl index 1fb61790b..71aaa20be 100644 --- a/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Profile_2D_poly.jnl @@ -48,7 +48,7 @@ IF `IS_ELEMENT_OF_STR(gattnames, "featureType") GE 1` THEN GO LAS_pp_set_feature_shapes -DEFINE SYMBOL qualifiers = ($qualifiers)/SIZ=0.12/SYM=($pyshape20)/HIGHLIGHT +DEFINE SYMBOL qualifiers = ($qualifiers)/SIZ=0.15/SYM=($pyshape20)/HIGHLIGHT ! Degenerate datasets with just one point will not be seen by PyFerret as a DSG dataset From 9cc2bf78295a4adec99b2cad783f27e9379e2f1b Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Tue, 29 Sep 2020 11:59:04 -0700 Subject: [PATCH 13/15] Update the annotation again --- JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl index d7425acdd..9cf370aaa 100644 --- a/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl +++ b/JavaSource/resources/ferret/scripts/Trajectory_2D_poly.jnl @@ -316,7 +316,7 @@ IF `STRINDEX("($qualifiers)", "ALONG") GT 0` THEN DEFINE SYMBOL note_num = `($note_num"0") + 1` Define symbol dat_direction = Z IF ($feature_type"0|Timeseries>1|*>0") THEN DEFINE SYMBOL dat_direction = T - DEFINE SYMBOL note_($note_num)_lab = Colored by average of each ($feature_type) in ($dat_direction) region selected + DEFINE SYMBOL note_($note_num)_lab = Colored by data in each ($feature_type) averaged over the ($dat_direction) region selected ENDIF From c780fe46ed4762d0dac9600466a67842c4801409 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Tue, 29 Sep 2020 11:59:22 -0700 Subject: [PATCH 14/15] write the operation-name to the debug file --- JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl index 9d52e3064..7e40101bd 100644 --- a/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl @@ -30,9 +30,15 @@ SHOW MEMORY IF `($initialize_script_arg) EQ 0` THEN EXIT/SCRIPT +! add the operation script name to the debug output. + +SAY +SAY The operation script is ($operation_service_action) +SAY IF ($program_name"0|PyFerret>1|*>0") THEN EXIT/SCRIPT + ! Reset the default gif filename used internally by Ferret. ! This must be done before PPLUS is opened. Some of the scripts use PPL ! symbol editing, so even before any plot commands are issued, pplus is From 240de90e32e4c7f1969a250d5251d8d84e26b0d6 Mon Sep 17 00:00:00 2001 From: Ansley Manke Date: Wed, 30 Sep 2020 10:19:27 -0700 Subject: [PATCH 15/15] temporary settings for watermarks --- .../ferret/scripts/LAS_open_window.jnl | 59 +------------ .../ferret/scripts/LAS_setup_watermark.jnl | 86 +++++++++++++++---- .../ferret/scripts/set_full_margins.jnl | 8 +- 3 files changed, 78 insertions(+), 75 deletions(-) diff --git a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl index 76fd81bf1..7aaeec9f9 100644 --- a/JavaSource/resources/ferret/scripts/LAS_open_window.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_open_window.jnl @@ -50,66 +50,13 @@ IF `($win_aspect) GT 100` THEN DEFINE SYMBOL win_aspect = 1 IF `($win_aspect) LT 0.01` THEN DEFINE SYMBOL win_aspect = 1 -! Set up the window. In PyFerret now use pixels to define the -! size and aspect ratio which will make the optional watermark -! easier to locate on the page. - -! Here the value of symbol wmark is "ul" for the upper right-hand corner -! Settings for lower left is sketched out where this is used, in -! LAS_setup_watermark.jnl and set_full_margins.jnl. +! Set up the window. In PyFerret make the optional watermark +! on the page. DEFINE SYMBOL wmark = 0 IF `($ferret_wmark_image"0|*>1") AND ($PROGRAM_NAME"|PyFerret>1|*>0) AND \ - ($ferret_version) GE 7.63` THEN DEFINE SYMBOL wmark = ul - -! Watermark: -! The set window/aspect= /size= of classic Ferret sets up PPLUS symbols -! WITDTH and HEIGHT of the window. Here, set the window using pixel sizes -! with the larger dimension of size ~1000 pix for the typical setting of large plots, -! and assuming 100 pixels width for plot margins. This approximates the sizes we see -! in classic-Ferret and PyFerret using SET WINDOW/ASPECT. -! Placing the watermark in locations other than the upper left needs work. What -! is shown here when setting wmark=ll, to put it in the lower right, instead puts -! it about a third of the way above the bottom of the plot. - -IF `($set_window_quals"0|*>1") EQ 0` THEN - - IF ($PROGRAM_NAME"|PyFerret>1|*>0) THEN - -! The sizes in ferret_size are 0.8333, 0.5, etc and are square roots of -! the nominal set win/size= settings in classic Ferret. - - LET win_base_size = ($ferret_size"0.5")^0.5 * 1000 - - LET pix_xtra = 0.1* win_base_size - - IF `($win_aspect) LE 1` THEN - LET pix_x = win_base_size - LET pix_y = win_base_size* ($win_aspect) + pix_xtra - ELSE - LET pix_y = win_base_size - LET pix_x = (win_base_size + pix_xtra*($win_aspect)) / ($win_aspect) - ENDIF - - DEFINE SYMBOL set_window_quals = ($set_window_quals)/XPIXEL=`pix_x`/YPIXEL=`pix_y` - -! Add any watermark settings added to set_window_quals - - IF ($wmark"0|*>1") THEN GO LAS_setup_watermark - - ELSE ! not pyferret, - - DEFINE SYMBOL set_window_quals = ($set_window_quals)/SIZE=($ferret_size"0.5") - - IF ($ferret_set_aspect"1|default>1|no>0|yes>1|0|1") THEN - IF `($region_x_range"0") NE 0 AND ($region_y_range"0") NE 0` THEN \ - DEFINE SYMBOL set_window_quals = ($set_window_quals)/ASPECT = ($win_aspect):axis - ENDIF - - ENDIF - -ENDIF + ($ferret_version) GE 7.63` THEN GO LAS_setup_watermark ! Open the window. For PyFerret, use /OUTLINE to take care of the pesky white-line issue IF ($program_name"0|PyFerret>1|*>0") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)/OUTLINE=0.7 1 diff --git a/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl b/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl index 048dd7c08..60e5299fd 100644 --- a/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl +++ b/JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl @@ -1,26 +1,82 @@ ! LAS_setup_watermark.jnl ! Add the settings for a watermark image to the -! quqlifiers in symbol set_window_quals +! qualifiers in symbol set_window_quals +! +! If they asked for a watermark, place it on the page. This uses "plot inches" +! expressed as fractions of 1000 measured from the upper-left corner. +! Make a plot to load pplus symbols -! How do we know what the size of the watermark image is? -! Assume it's ~100 pixels; The LAS configurer creates the right size image? -! The linux command returns the image info including size in pixels. +! Ferret properties for the dataset, variable or the entire LAS: +! * The image name +! * The (approx) image size, in pixels. Assumes 100 if not given. +! The linux command "identify" returns the image info including size in pixels: ! identify -ping imagefile.png +! +! * A scale factor to use, default 1 +! +! * The opacity to use in percent, default 50 +! +! * Where to place the watermark within the image. These are defined here: +! ulc, urc, llc, lrc upper left corner, upper right corner, lower left... +! uli, uli, lli, lri upper left within the image, ... +! More, such as centered along the bottom ? +! +! +! /home/users/ansley/socat_cat.png +! 200 +! 0.5 +! 50 +! lli +! +! -LET wmscale = 1 ! scale factor: -LET wmopac = 50 ! percent opacity +IF `($ferret_wmark_image"0|*>1") EQ 0` THEN EXIT/SCRIPT -! Watermark in the upper left -IF ($wmark"0|ul>1|*>0") THEN - LET wmxloc = 5 ! pixels from upper left corner - LET wmyloc = 5 ! pixels from upper left corner +LET wmsize = ($ferret_wmark_size"100|*") ! image size +LET wmscale = ($ferret_wmark_scale"1|*") ! scale factor to use +LET wmopac = ($ferret_wmark_opacity"50|*") ! opacity to use + + +! Location for the watermark within ghe plot + +! ulc, urc, llc, lrc for upper left corner, upper right corner... +! By default, or if unrecognized value, use upper left corner + +DEFINE SYMBOL wmark_loc = ($ferret_wmark_loc"ulc|uli|ulc|urc|llc|lrc|uli|uli|lli|lri|*>ulc|uli") + +!!!! Right now the only one that works well is upper=left corner + +DEFINE SYMBOL wmark_loc = ulc + +! To account for the size of the watermark image. +let fudge = wmscale* wmsize + +! Make a plot to get pplus symbols for this window + +shade/x=0:1/y=0:1/nolab/noax x+y + +show sym ppl$width, ppl$xorg, ppl$height, ppl$yorg +DEFINE SYMBOL x_rt_margin = `($ppl$width) - ($ppl$xlen) - ($ppl$xorg)` +DEFINE SYMBOL y_up_margin = `($ppl$height) - ($ppl$ylen) - ($ppl$yorg)` + +show sym ppl$width, ppl$xlen, ppl$xorg, x_rt_margin +show sym ppl$height, ppl$ylen, ppl$yorg, y_up_margin + + +! Watermark in the upper left corner +IF ($wmark_loc"0|ulc>1|*>0") THEN + LET wmxloc = 5 + LET wmyloc = 5 ENDIF -! Watermark in the lower left -IF ($wmark"0|ll>1|*>0") THEN - LET wmxloc = 5 ! pixels from upper left corner - LET wmyloc = pix_y - 100 ! pixels from upper left corner +! Watermark in the lower left corner +IF ($wmark_loc"0|llc>1|*>0") THEN + LET wmxloc = 5 + LET wmyloc = 100* (($ppl$ylen) + ($y_up_margin)) - fudge ENDIF -IF ($wmark"0|*>1") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)\ + +DEFINE SYMBOL set_window_quals = ($set_window_quals)\ /wmark="($ferret_wmark_image)"/wmscale=`wmscale`/wmopac=`wmopac`/wmxloc=`wmxloc`/wmyloc=`wmyloc` + +SET WINDOW/CLEAR diff --git a/JavaSource/resources/ferret/scripts/set_full_margins.jnl b/JavaSource/resources/ferret/scripts/set_full_margins.jnl index 0a1a2a15c..c4bf2a21e 100644 --- a/JavaSource/resources/ferret/scripts/set_full_margins.jnl +++ b/JavaSource/resources/ferret/scripts/set_full_margins.jnl @@ -26,20 +26,20 @@ IF `STRLEN("($ferret_view)") GE 2 AND ($win_aspect"1") LT 0.2` THEN LET y_up_t = 0.99 ENDIF -IF ($wmark"0|*>1") THEN +IF ($wmark_loc"0|*>1") THEN ! These settings to make space for a watermark. ! Give the margin some extra vertial space. Note the ! viewport settings are in percentage of the window. ! These if putting it in the upper left corner. - IF ($wmark%|ul>1|*>0%) THEN - LET y_up = `y_up - 0.05` + IF ($wmark_loc%|ulc>1|*>0%) THEN + LET y_up = `y_up - 0.07` LET y_up_t = `y_up_t - 0.1` ENDIF ! These if putting it in the lower left - IF ($wmark%|ll>1|*>0%) THEN + IF ($wmark_loc%|llc>1|*>0%) THEN LET y_dn = 0.16 ENDIF