Reputation: 11
The input for metpy.cross_section() is an xarray Dataset or DataArray that "must have attached projection information."
To use MetPy cross secion I need to write my own xarray Dataset as my NWP data with meta data cannot be read autamatically into an xarray Dataset. However it is unclear to me what meta data is required for MetPy to be able to understand my projection.
I realise that it is the metpy.parse_cf() that gives MetPy the projection information but I can't find any information on metpy.parse_cf(), i.e. what variables are the necessary ones. At the moment metpy.parse_cf() is a black box to me.
Upvotes: 1
Views: 588
Reputation: 489
The "attached projection information" required for the cross section function is having the crs
coordinate and axis
coordinate attributes that MetPy adds to the dataset when using ds.metpy.parse_cf()
(as described in the xarray with MetPy tutorial).
MetPy creates the crs
coordinate and axis
coordinate attributes using metadata in the dataset according to the CF Conventions. If your GRIB-to-xarray dataset reader includes this information for the data on a Lambert Conformal grid, then the crs
coordinate should be created properly (you can check this by ensuring it reads "Projection: lambert_conformal_conic"). However, if your dataset reader does not include this metadata, you may have to add it yourself.
Upvotes: 2