Is there a way to create (open/load) an Iris Cube using a fileobject (binary stream), or alternatively, from a netCDF4 dataset object?
Specifically, I have a file served over a URL, but not by an OpenDAP server; iris.load_cube()
& friends fail on this.
I realise that Iris prefers lazy loading, and therefore uses a URI instead of in-memory data, but this is not always feasible.
For a plain netCDF4 Dataset
object, I can do the following:
from urllib.request import urlopen
import netCDF4 as nc
url = 'https://crudata.uea.ac.uk/cru/data/temperature/HadCRUT.4.6.0.0.median.nc'
with urlopen(url) as stream:
ds = nc.Dataset('HadCRUT', memory=stream.read())
So I'm looking to do something similar for an Iris Cube
, or read the netCDF4 dataset into a cube, without going through a temporary file on disk. I had hoped something would exist in the Iris functionality, but I have not (yet) been able to find it in the reference documentation.
from Create Iris Cube from a fileobject or netCDF4 dataset
No comments:
Post a Comment