Interpolating just over the land part without the sea

Hi,

I have the data in a text file as: longitude, latitude, and noise. They represent individual points and I have created the attached figure, but is there a way to create the Figure by interpolating the data and plotting the results as an interpolated surface but only for the land part (so that the interpolations doesn’t go over the sea part) - similar to the command “gmt pscoast“ when plotting the sea and the continental part. Also, how can I plot only the interpolated surface for a specific country – for ex. Germany. I have tried using “surface” but is creating the interpolated values over the entire imagine.
Thank you in advance. coord+noise_amplitude.txt (6.5 KB)

The first thing is to decide what interpolation scheme is appropriate for your data. Maybe nearest neighbour would be better?

Then interpolate your data to a grid using the interpolation scheme you have chosen (nearneigbour, surface or one of the others GMT can do).

Then you could create a land-sea mask using grdlandmask on the same grid as your interpolated data. Apply this land-sea mask so the sea gets masked out to NaNs, 0, or whatever is appropriate.

Finally plot the data.

Alternatively, if you don’t want to do masking, just plot the interpolated data. Then overlay the land and sea (using coast) with the sea filled in with some colour, but the land not filled in.

Hi Tim,

I have tried only the easiest solution - from my point of view - the one with "overlay the land and sea (using coast) with the sea filled in with some colour, but the land not filled in" and it works super nice.

Thank you very much.

Sorin