Hi,
I have some Cartesian data on a 1 degree lat/lon grid in an xarray dataset that I want to plot using grdimage(), it has latitude, longitude and the value to be contoured, z. I want to overlay contour lines of ocean depth over the filled contours, similar to this plot (please ignore the black lines).
I’ve tried using grdproject() but the data ends up as all NaN values.
ds = xr.Dataset()
ds['z'] = (('lon', 'lat'), data)
isow_ds['lon'] = lon
isow_ds['lat'] = lat
grid = gmt.grdproject(grid=ds.z, projection=projection, region=region, spacing=(1.0, 1.0), inverse=True)
If I don’t use grdproject() and pass the dataarray to grdimage, I get the following error, even though I define the region using the same min/max lat/lon as I do to select the data.
fig.grdimage(
grid=ds.z,
projection=projection,
region=region,
cmap='jet'
)
grdimage [WARNING]: Your grid y's or latitudes appear to be outside the map region and will be skipped.
grdimage [WARNING]: No grid or image inside plot domain
I’m not sure which (if either) is the correct approach, or what to do to get this working.
Many thanks,
Emma