Feature #440

grdhisteq should handle multiple grids

Added by Florian over 4 years ago. Updated over 4 years ago.

Status:FeedbackStart date:2013-11-13
Priority:NormalDue date:
Assignee:-% Done:


Target version:Candidate for next minor release


Lets say you have multiple grids of the same region and want to plot them with grdimage in the same histogram equalized color scale. You cannot do this straight because grdhisteq does not read multiple gridfiles. Instead you would have to, e.g.:

for file in <many gridfiles>; do
  grd2xyz -ZTLf ${file}
  <calculate xmax and ymax>
done | xyz2grd -Gcombined.nc -I1 -R0/${xmax}/0/${ymax} -r -ZTLf
grdhisteq combined.nc -D > topo.t
makecpt -W -Ttopo.t -Cno_green
It would be nice to have this in one step.


#1 Updated by Paul over 4 years ago

  • Status changed from New to Feedback

Looks like you imagine your grids to be tiles that make up a large area and you build a combined grid, then call grdhisteq. One simplification would be to call grdblend to stitch all those grids together instead of that slow loop. Since grdhisteq needs to sort all those values anyway it has to be able to hold the grid in memory. So grdblend first followed by grdhisteq would not be too much hardship, no?

#2 Updated by Florian over 4 years ago

No, actually I have several grids of exactly the same region that I don't want to blend. Say you have DEMs from different sources that you want to visually compare. You want the color scale to be the same in each plot for obvious reasons.

#3 Updated by Paul over 4 years ago

Sure, so whether tiles overlap fully, partially, or not at all we just want to build a long z array and process it. Should not be too hard, grd2cpt already works with multiple grids.

Also available in: Atom PDF