From c669fedbe2722652a22eb2cefeaa64a4f63bc08e Mon Sep 17 00:00:00 2001 From: Joaquim Date: Thu, 24 Sep 2026 13:27:21 +0100 Subject: [PATCH 1/2] Add grdimage pbr test --- test/grdview/pbr.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/grdview/pbr.sh diff --git a/test/grdview/pbr.sh b/test/grdview/pbr.sh new file mode 100644 index 00000000000..7ca89c42622 --- /dev/null +++ b/test/grdview/pbr.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Test physically based shading (-F) of a 3-D surface: cast shadows, ambient occlusion and tone +# mapping with a vertical exaggeration of 3, draped over the relief it was computed from + +ps=pbr.ps + +gmt grdmath -R-15/15/-15/15 -I0.1 X Y HYPOT DUP 2 MUL PI MUL 8 DIV COS EXCH NEG 10 DIV EXP MUL = somb.nc +gmt makecpt -Cjet -T-0.5/1 > pal.cpt + +gmt grdview somb.nc -Cpal.cpt -F225/30+o+s+t+v3 -JX12c -JZ3c -p135/35 -Baf -Bzaf -BWSneZ -P -Xc > $ps + +rm -f somb.nc pal.cpt From 55513944a942dc78725260cbd1cbb292795ec727 Mon Sep 17 00:00:00 2001 From: Joaquim Date: Thu, 8 Oct 2026 01:30:28 +0100 Subject: [PATCH 2/2] Fix grdblend bug #9248 --- src/grdblend.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/grdblend.c b/src/grdblend.c index 7b15340ab4c..7feb39b71ac 100644 --- a/src/grdblend.c +++ b/src/grdblend.c @@ -499,7 +499,11 @@ GMT_LOCAL int grdblend_init_blend_job(struct GMT_CTRL *GMT, char **files, unsign if (srtm_job) GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Convert tile from JPEG2000 to netCDF grid [%s]\n", B[n].file); - if (gmt_get_tempname (GMT->parent, "grdblend_reformatted", ".nc", buffer)) + char template[GMT_LEN32] = {""}; + /* One template per grid, as for the resampled ones above: MSVC's _mktemp_s hands back the + same name every time, so a fixed template made every reformatted grid overwrite the last */ + sprintf(template, "grdblend_reformatted_%d", n); + if (gmt_get_tempname(GMT->parent, template, ".nc", buffer)) return GMT_RUNTIME_ERROR; snprintf (cmd, GMT_LEN256, "%s %s %s -V%c", B[n].file, Rargs, buffer, V_level[GMT->current.setting.verbose]); if (gmt_M_is_geographic (GMT, GMT_IN)) strcat (cmd, " -fg"); @@ -520,7 +524,9 @@ GMT_LOCAL int grdblend_init_blend_job(struct GMT_CTRL *GMT, char **files, unsign } B[n].memory = false; /* Since we read from file, even if it was a mem-grid before */ t = B[n].G->header; /* Since it got reallocated */ - if (grdblend_overlap_check (GMT, &B[n], h, 0)) continue; /* In case grdconvert changed the region */ + /* In case grdconvert changed the region. Only for longitudes, as the checks above: on a + Cartesian grid this +-360 "adjustment" shifts the tile's columns off the output grid */ + if (gmt_M_x_is_lon(GMT, GMT_IN) && grdblend_overlap_check(GMT, &B[n], h, 0)) continue; } if (B[n].weight < 0.0) { /* Negative weight means invert sense of taper */ B[n].weight = fabs (B[n].weight);