Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
noaaroland committed Dec 12, 2020
2 parents 0b80bf0 + 240de90 commit de399a2
Show file tree
Hide file tree
Showing 58 changed files with 2,328 additions and 4,493 deletions.
3 changes: 2 additions & 1 deletion JavaSource/resources/ferret/scripts/LAS_annotations_xml.jnl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ DEFINE SYMBOL out = <annotations>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions JavaSource/resources/ferret/scripts/LAS_initial_setup.jnl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -25,13 +21,24 @@ 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

! 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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--------------------------
47 changes: 14 additions & 33 deletions JavaSource/resources/ferret/scripts/LAS_initialize_feature_id.jnl
Original file line number Diff line number Diff line change
@@ -1,81 +1,62 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 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
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

Expand Down
111 changes: 111 additions & 0 deletions JavaSource/resources/ferret/scripts/LAS_insitu_waterfall_setup.jnl
Original file line number Diff line number Diff line change
@@ -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--------------------------

18 changes: 8 additions & 10 deletions JavaSource/resources/ferret/scripts/LAS_insitu_write_webrowset.jnl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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 --------------------------
17 changes: 14 additions & 3 deletions JavaSource/resources/ferret/scripts/LAS_is_range.jnl
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +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
Expand Down
Loading

0 comments on commit de399a2

Please sign in to comment.