[pyngl-talk] PyNGL and xarray
meier-fleischer at dkrz.de
Wed Mar 27 10:12:33 MDT 2019
you can use xarray already you have to add .values to the
lat = xr.open_dataset('your_file').lat
lon = xr.open_dataset('your_file').lon
res.sfXArray = lon.values
res.sfYArray = lat.values
lon.values will give you the xarray data array lon as a numpy array.
See also xarray.pydata.org/en/stable/generated/xarray.DataArray.values.html
Am 27.03.19 um 14:14 schrieb Mateus da Silva Teixeira via pyngl-talk:
> I'm beginning to use Python since the news about NCL is being placed
> in maintenance mode, and since it was said that PyNIO will also be
> placed in maintenance mode, I'm using other libraries to open data
> files and PyNGL for graphics.
> Reading about Ngl.contour_map(), I found that it expects a numpy array
> with data to plot and coordinates information are given to sfXArray
> and sfYArray resources.
> Is there a plan to use xarray.DataArray as a data model for PyNGL? It
> has large similarities with NCL's variable model, which is borrowed
> from netCDF model.
> I'm asking it because it seems more natural to use xarray, which
> contains all metadata for a variable, than use a numpy array.
> Thanks and excuse me if it's a already defined topic in future
> development of PyNGL.
> Best regards,
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pyngl-talk