v0.48.0
This release includes a number of breaking changes and new features. If upgrading from a previous version of pycontrails
, please read the changes below carefully. Open an issue if you experience problems.
Breaking changes
- When running
Cocip
and otherpycontrails
models, themet
andrad
parameter must now contain predefined metadata attributesprovider
,dataset
, andproduct
describing the met source. An error will now be raised inCocip
if these attributes are not present. - Deprecate passing arbitrary
kwargs
into theMetDataArray
constructor. - No longer convert accumulated radiation data to average instantaneous data in
ERA5
andHRES
interfaces. This logic is now handled downstream by the model (e.g.,Cocip
). This change allows for more flexibility in therad
data passed into the model and avoids unnecessary computation in theMetDataSource
interfaces. - Add new
MetDataSource.set_met_source_metadata
abstract method. This should be called within the implementing classopen_metdataset
method. - No longer take a finite difference in the time dimension for HRES radiation data. This is now also handled natively in
Cocip
. - No longer convert relative humidity from a percentage to a fraction in
ERA5
andHRES
interfaces. - Require the
HRES
stream
parameter to be one of["oper", "enfo"]
. Require thefield_type
parameter to be one of["fc", "pf", "cf", "an"]
. - Remove the
steps
andstep_offset
properties in theGFSForecast
interface. Now thetimesteps
attribute is the only source of truth for determining AWS S3 keys. Change thefilename
method to take in adatatime
timestep instead of anint
step. No longer assign the first step radiation data to the zeroth step. - Change the return type of
ISSR.eval
,SAC.eval
, andPCR.eval
fromMetDataArray
toMetDataset
. This is more consistent with the return type of otherpycontrails
models and more closely mirrors the behavior of vector models. Set outputattrs
metadata on the globalMetDataset
instead of the individualMetDataArray
in each case.
Features
- Rewrite parts of the
pycontrails.core.datalib
module for higher performance and readability. - Add optional
attrs
andattrs_kwargs
parameters toMetDataset
constructor. This allows the user to customize the attributes on the underlyingxarray.Dataset
object. This update makesMetDataset
more consistent withVectorDataset
. - Add three new properties
provider_attr
,dataset_attr
, andproduct_attr
toMetDataset
. These properties give metadata describing the underlying meterological data source. - Add new
Model.transfer_met_source_attrs
method for more consistent handling of met source metadata on thesource
parameter passed intoModel.eval
. - No longer require
geopotential
data when computingtau_cirrus
. If neithergeopotential
norgeopotential_height
are available, geopotential is approximated from the geometric height. No longer require geopotential on themet
parameter inCocip
orCocipGrid
. - Remove the
Cocip
shift_radiation_time
parameter. This is now inferred directly from therad
metadata. An error is raised if the necessary metadata is not present. - Allow
Cocip
to run with both instantaneous (W m-2
) and accumulated (J m-2
) radiation data. - Allow
Cocip
to run with accumulated ECMWF HRES radiation data.
Fixes
- Correct radiation unit in the
ACCF
wrapper model [#64]. Both instantaneous (W m-2
) and accumulated (J m-2
) radiation data are now supported, and theACCF
wrapper will handle each appropriately. - Avoid unnecessary writing and reading of temporary files in
ERA5.cache_dataset
andHRES.cache_dataset
. - Fix timestep resolution bug in
GFSForecast
. When thegrid
parameter is 0.5 or 1.0, forecasts are only available every 3 hours. Previously, thetimesteps
property would define an hourly timestep.
Internals
- Include
name
parameter inMetDataArray
constructor. - Make the
coordinates.slice_domain
function slightly more performant by explicitly dropping nan values from therequest
parameter. - Round unwieldy floating point numbers in
GeoVectorDataset._display_attrs
. - Remove the
ecmwflibs
package from theecmwf
optional dependencies. - Add NPY to
ruff
rules. - Add convenience
MetDataset.standardize_variables
method. - Remove the
p_settings
attribute on theACCF
interface. This is now constructed internally withinACCF.eval
. Replace theACCF._update_accf_config
method with a_get_accf_config
function.