1 | initial version |
To display a Data array from xarray using pyGMT's plotting function, follow these steps:
import pygmt
import xarray as xr
ds = xr.open_dataset('data.nc')
data_array = ds['data_variable']
region = [xmin, xmax, ymin, ymax]
projection = 'your_projection_here'
fig = pygmt.Figure()
pygmt.grdimage()
function to display the data array on the plot:fig.grdimage(data_array, region=region, projection=projection, cmap='jet')
Customize the plot as needed using pyGMT's other plotting functions.
Show the plot:
fig.show()