From 2da67da3201b18269faadab457444e664f6b5ff1 Mon Sep 17 00:00:00 2001 From: Paul Wessel Date: Wed, 22 Nov 2023 16:27:39 +0100 Subject: [PATCH 1/2] Oops, grdfft -D -I are repeatable options (#8055) but the updated parser forgot to allow that. Pointed out on the forum. --- doc/rst/source/grdfft.rst | 4 ++-- src/grdfft.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/rst/source/grdfft.rst b/doc/rst/source/grdfft.rst index 43e6eab14bf..1eae596479a 100644 --- a/doc/rst/source/grdfft.rst +++ b/doc/rst/source/grdfft.rst @@ -77,7 +77,7 @@ Optional Arguments to multiplying by :math:`k_r` in the frequency domain (:math:`k_r` is radial wave number). Append a scale to multiply by :math:`k_r \cdot`\ *scale*) instead. Alternatively, append **g** to indicate that your data are geoid - heights in meters and output should be gravity anomalies in mGal. + heights in meters and output should be gravity anomalies in mGal. Repeatable. [Default is no scale]. .. _-E: @@ -155,7 +155,7 @@ Optional Arguments radial wave number). Append a scale to divide by :math:`k_r \cdot`\ *scale* instead. Alternatively, append **g** to indicate that your data set is gravity anomalies in mGal and output should be geoid heights in - meters. [Default is no scale]. + meters. Repeatable. [Default is no scale]. .. _-N: diff --git a/src/grdfft.c b/src/grdfft.c index 68e2342a391..be078bb5019 100644 --- a/src/grdfft.c +++ b/src/grdfft.c @@ -584,7 +584,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) { GMT_Usage (API, 1, "\n-C"); GMT_Usage (API, -2, "Continue field upward (+) or downward (-) to (meters). "); GMT_Usage (API, 1, "\n-D[|g]"); - GMT_Usage (API, -2, "Differentiate, i.e., multiply by kr [ and optionally by ]. Use -Dg to get mGal from m]."); + GMT_Usage (API, -2, "Differentiate, i.e., multiply by kr [ and optionally by ]. Use -Dg to get mGal from m] (repeatable)."); GMT_Usage (API, 1, "\n-E[r|x|y][+w[k]][+n]"); GMT_Usage (API, -2, "Estimate spEctrum in the radial r [Default], x, or y-direction. " "Given one grid X, write f, Xpower[f] to output file (see -G) or standard output. " @@ -608,7 +608,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) { GMT_Usage (API, -2, "Filename for output grid file OR 1-D data table (see -E). " "Note: Optional for -E (spectrum written to standard output); required otherwise."); GMT_Usage (API, 1, "\n-I[|g]"); - GMT_Usage (API, -2, "Integrate, i.e., divide by kr [ and optionally by scale]. Use -Ig to get m from mGal]."); + GMT_Usage (API, -2, "Integrate, i.e., divide by kr [ and optionally by scale]. Use -Ig to get m from mGal] (repeatable)."); GMT_FFT_Option (API, 'N', GMT_FFT_DIM, "Choose or inquire about suitable grid dimensions for FFT, and set modifiers."); GMT_Usage (API, 1, "\n-Q Perform no operations, just do forward FFF and write output if selected in -N."); GMT_Usage (API, 1, "\n-S|d"); @@ -695,8 +695,8 @@ static int parse (struct GMT_CTRL *GMT, struct GRDFFT_CTRL *Ctrl, struct F_INFO "Option -C: Cannot read zlevel\n"); grdfft_add_operation (GMT, Ctrl, GRDFFT_UP_DOWN_CONTINUE, 1, par); break; - case 'D': /* d/dz */ - n_errors += gmt_M_repeated_module_option (API, Ctrl->D.active); + case 'D': /* d/dz [repeatable] */ + Ctrl->D.active = true; par[0] = (opt->arg[0]) ? ((opt->arg[0] == 'g' || opt->arg[0] == 'G') ? MGAL_AT_45 : atof (opt->arg)) : 1.0; n_errors += gmt_M_check_condition (GMT, par[0] == 0.0, "Option -D: scale must be nonzero\n"); grdfft_add_operation (GMT, Ctrl, GRDFFT_DIFFERENTIATE, 1, par); @@ -748,8 +748,8 @@ static int parse (struct GMT_CTRL *GMT, struct GRDFFT_CTRL *Ctrl, struct F_INFO n_errors += gmt_M_repeated_module_option (API, Ctrl->G.active); n_errors += gmt_get_required_file (GMT, opt->arg, opt->option, 0, GMT_IS_GRID, GMT_OUT, GMT_FILE_LOCAL, &(Ctrl->G.file)); break; - case 'I': /* Integrate */ - n_errors += gmt_M_repeated_module_option (API, Ctrl->I.active); + case 'I': /* Integrate [repeatable]*/ + Ctrl->I.active = true; par[0] = (opt->arg[0] == 'g' || opt->arg[0] == 'G') ? MGAL_AT_45 : atof (opt->arg); n_errors += gmt_M_check_condition (GMT, par[0] == 0.0, "Option -I: scale must be nonzero\n"); grdfft_add_operation (GMT, Ctrl, GRDFFT_INTEGRATE, 1, par); From 0e1efcf838a071812e5897ddd1f83a5085a6c01b Mon Sep 17 00:00:00 2001 From: Paul Wessel Date: Wed, 22 Nov 2023 16:52:24 +0100 Subject: [PATCH 2/2] Fix anim09 to first build global grid (#8054) * Fix anim09 to first build global grid Do not want @earth_relief_15s to be called again and again in main.sh. First assemble it in pre and do its gradient. * Update anim09.rst Also update text. --------- Co-authored-by: Federico Esteban --- doc/examples/anim09/anim09.sh | 5 +++-- doc/rst/source/animations/anim09.rst | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/examples/anim09/anim09.sh b/doc/examples/anim09/anim09.sh index b90cce2396a..2a1222e2fe7 100755 --- a/doc/examples/anim09/anim09.sh +++ b/doc/examples/anim09/anim09.sh @@ -22,7 +22,8 @@ cat << 'EOF' > pre.sh #!/usr/bin/env bash # Pre-script: Runs once to produce files needed for all frames gmt begin - gmt grdgradient @earth_relief_30s -A90 -Nt2.5 -Gearth_relief_30s+2.5_int.nc + gmt grdcut -Rd @earth_relief_30s -Gearth_relief_30s.nc + gmt grdgradient earth_relief_30s.nc -A90 -Nt2.5 -Gearth_relief_30s+2.5_int.nc gmt makecpt -Cgeo -H > MOR_topo.cpt gmt end EOF @@ -39,7 +40,7 @@ cat << 'EOF' > main.sh # and the other view parameters from the include file. gmt begin gmt grdimage -Rg -JG${MOVIE_COL0}/${MOVIE_COL1}/${MOVIE_WIDTH}+z${ALTITUDE}+a${MOVIE_COL2}+t${TILT}+w${MOVIE_COL3}+v${WIDTH}/${HEIGHT} \ - -Y0 -X0 @earth_relief_30s -Iearth_relief_30s+2.5_int.nc -CMOR_topo.cpt + -Y0 -X0 earth_relief_30s.nc -Iearth_relief_30s+2.5_int.nc -CMOR_topo.cpt gmt events MOR_names.txt -L100 -Et+r6+f6 -T${MOVIE_FRAME} -F+f12p,Helvetica-Bold,yellow gmt end EOF diff --git a/doc/rst/source/animations/anim09.rst b/doc/rst/source/animations/anim09.rst index f36dc3adf00..3f5ec6eadc9 100644 --- a/doc/rst/source/animations/anim09.rst +++ b/doc/rst/source/animations/anim09.rst @@ -14,7 +14,7 @@ grid and overlay a few labels for named features. - Path: MOR_PAC_twist_path.txt - Labels: MOR_names.txt -We create a global intensity grid using shading from East and a CPT file; these are +We create a global intensity grid using shading from East, a global relief grid and a CPT file; these are created by the preflight script. We add a 1 second fade in and a 1 second fade out for the animation The resulting movie was presented at the Fall 2019 AGU meeting in an eLighting talk: