How to fill empty pixels of grd files

Added by Alexander 7 days ago

Hi,
I'm looking for a way to fill out the missing values with interpolated values in a coastline boundary condition.
Is there a way to replace zero values (fill value pixels) in grd files with the same as surface-made pixels?
For example, as an implementation of grdsample.

Thank you

Alex


Replies (3)

RE: How to fill empty pixels of grd files - Added by Paul 4 days ago

Think it is a bit unclear what you are asking. You have a grid with some zero pixels which means NaN (not-a-number or not filled). You then want to interpolate values to replace those zeros based on the surface as defined elsewhere? If this is the case then I think grdmath your.grd 0 NAN = tmp.grd to replace those zeros with NaNs then grd2xyz new.grd -s | surface -Rnew.grd -Gfilled.grd.

RE: How to fill empty pixels of grd files - Added by Alexander 4 days ago

The described scheme with surface is used now. Can it be facilitated in case of input grd file (directly, without reformat file) and how to use the coastline as a limiter. The way does not take into account the land as a limiter.
Interpolated parameter is a sea surface temperature (SST).

Sorry, but what is the syntax surface -Rnew.grd -Gfilled.grd (-R is ROI argument)
maybe other letter surface -Finput.grd -Gfilled.grd

MAN
"surface reads randomly-spaced (x,y,z) triples from standard input [or table]" no any grd file

RE: How to fill empty pixels of grd files - Added by Paul 1 day ago

We are unlikely to clutter surface with more options. We have an experimental program grdfill that we hope to expand to offer services along the lines you have. But you could easily write a short script to do the things you want. The input grid conversion to table input is one step. If you want the coast line to be included as data (i.e. zero value) you could dump that from pscoast. If you want to exclude data over land you use grdmask, etc. There are just too many ways people may want to do stuff and hence a short script is an acceptable solution.

(1-3/3)