Grdrotater

Hi. Hope I got the right subforum.
Does grdrotater work with rasters (at all)?
Beginning to suspect it does not.
Trying
gmt grdrotater @earth_relief_05m -V -E5/-20/2 -Foutline-wblock.txt -Grot_er5m.grd -nc > rot_clip_path1.txt

for the sake of argument, where “outline-wblock.txt” is a valid, polygon, the returned rot_clip_path1.txt is empty, and the entire grid earth_relief_05m is rotated, rather than, as I was expecting, just the part of it within the bounding polygon.
Using grdrotater with -S option, to rotate “just” the polygon is successful however.
To wit
gmt grdrotater -S -E5/-20/0.2 -Foutline-wblock.txt -Drot_clip_path1.txt
produces the correct output for rot_clip_path1.txt

The same seems to be occurring with grdcut, which should work in roughly the same way - i.e. I am unable to extract a polygon bounded piece of a grid.

Using gmt v6.3.0

Hope someone can help.
Best
David

Hi @David_Hindle, says the post is withdrawn. Did you solve your problem or was there an error on your part?

1 Like

Hi Pol
The post I withdrew was an addendum to the main post which I added before realising I could edit the first post - I was just giving my gmt version no.
So, no, the problem still stands. That command as I gave it does not work as I would expect it to on v6.3. Not for a raster (I assume it’s .grd ?)
Moreover, I looked everywhere on the interweb and found absolutely no examples or questions on the topic which made me suspect there is an undiscovered problem. Or perhaps I am doing something wrong.
Any ideas/help appreciated. I am stuck atm.
Cheers
David

If you could post the outline-wblock.txt file then I could see if I can reproduce it.

1 Like

Hi
Hope this works - I tried it with and without the “>”
I also tried an output of the outline of France into an xy file as the cutting polygon and it too, only works as a polygon itself (-S) and won’t cut out the raster

outline-wblock.txt (1.0 KB)

Thanks, I have determined a few problems and fixes have been submitted to GitHub. Now we wait for approval and merging:

  1. https://github.com/GenericMappingTools/gmt/pull/7118
  2. https://github.com/GenericMappingTools/gmt/pull/7119
1 Like

As for grdcut, it worked fine provided you use the +c modifier in -F.

1 Like

Hi
Thanks as always for your efforts! Working Sundays too! I just cooked the roast here the last 2 hours (DE so not Thanksgiving, but it was a chicken).

Regarding grdcut, I’d only tried it in gmt v6.0 so I guess that had updated?
You could / I will use grdcut and then grdrotate on the output raster to do what grdrotate wants / will to do in 1 go, I suppose?

Best Wishes
David

Sure, for workarounds you could use grdcut -Fyourpolygon+c to get a smaller grid then run grdrotate on that.

Both fixes have been approved and merged so there is always building from source. Sorry, have now knowledge of 6.0 vs master and when we added +c etc. I only use the latest version, and any bug reported needs to be reproducible in the latest version.