Extending a grid to a larger area

I have a GMT grid at a 3-arcsecond spacing that I would like to coregister with another grid that is on a 6-arcsecond spacing for a slightly larger area. I know that it is a very smooth grid, so I am not worried about aliasing and I was trying to use grdsample -R6asec.nc to sample the first grid to the same area as the other grid. This runs and samples at the 6-arcsecond spacing, but it uses the smaller region of the input grid. Is there an optional flag to get it to write the output on the specified region, filling with no data around the edges if necessary?

I think I did this many years ago, but I can’t remember what I used and that was GMT4 anyway, so I don’t know if options have changed.

No, grdsample does not let you extrapolate more than 1/2 grid step (from memory). But you can always do a grd2xyz | regrid ...

I did not want to extrapolate, only fill any new area with “no data” or NaN values. I guess the grd2xyz | regrid method may be the only way.

I took it to mean extrapolation.

I am looking at grdblend and I think that will do what I want, filling the area with “no data” where there is no input data.

Yes, it seems that grdblend does what I need for this task. The only trick is that I have to put the input grid file name into a “blend” text file as the option of putting the input grid name on the command line requires a minimum of two grids.

After running grdsample to resample your 3-arcsecond grid to 6-arcsecond, you can use grdcut -N to extract a subregion of your grid. The -N option allows the output grid to have a larger region than the input grid.

1 Like