What’s new
Next release
Adjust for compatibility with pyam 1.7 (released 2022-12-19) (PR #78).
v1.14.1 (2022-10-28)
Fix
cumprod()
for 1-dimensionalAttrSeries
(PR #74).Adjust for compatibility with pint 0.20 (released 2022-10-25) (PR #74).
v1.14.0 (2022-09-27)
Add new computations
assign_units()
andconvert_units()
. These have simpler behaviour thanapply_units()
and should be preferred in most situations (PR #72).Following pandas (v1.4.0, released 2022-01-22) and xarray (v0.21.0, released 2022-01-27), support for Python 3.7 is dropped (PR #72). genno supports and is tested on Python 3.8 and newer.
v1.13.0 (2022-08-17)
1-dimensional quantities are handled in
relabel()
and as weights insum()
(PR #68).load_file()
will read a header comment like# Units: kg / s
and apply the indicated units to the resulting quantity (PR #68).div()
andmul()
become the canonical names, matchingoperator
and other parts of the Python standard library (PR #68).ratio()
andproduct()
are retained as aliases, for compatibility.Ensure data passed to
Plot.generate()
has a “value” column; use short units format by default (PR #68).
v1.12.0 (2022-07-18)
New computation
index_to()
(PR #65).general: configuration items are more flexible (PR #65).
comp: null
or omitted allows to specify a simple collection of other computations.A bare string
key:
is left as-is; only keys with (a) dimension(s) and/or tag are parsed toKey
.
Bug fix:
Computer.convert_pyam()
handles its tag argument correctly, generating keys likefoo:x-y-z:iamc
orbar::iamc
when applied to existing keys likefoo:x-y-z
orbar
(PR #65). Previously the generated keys would be e.g.bar:iamc
, which incorrectly treats “iamc” as a (sole) dimension rather than a tag.Computer.require_compat()
can handle arbitrary module names as strings, as well as module objects (PR #63).
v1.11.0 (2022-04-20)
Migration notes
The index keyword argument to Computer.add_single()
/ add()
is deprecated (PR #60) and will be removed in or after v3.0.0.
Indexing behaviour changes slightly: Computer.full_key()
always returns the Key
which matches its arguments and has the greatest number of dimensions.
For instance:
c.add_product("foo", "bar:a-b-c", "baz:x-y-z", sums=True)
…will generate a key <foo:a-b-c-x-y-z>
and all partial sums over subsets of its dimensions; c.full_key("foo")
will return this key.
Care should be taken to avoid adding 2+ keys with the same name, tag, and number of dimensions:
c.add("foo:a-b-c", ...)
c.add("foo:l-m-n", ...)
c.add("foo:x-y-z", ...)
This situation is ambiguous and the behaviour of Computer.full_key()
is undefined.
Instead, add a tag
to disambiguate.
All changes
Key.product()
acceptsstr
arguments (PR #60).New class method
Key.bare_name()
(PR #60).Infer dimensions for e.g.
X:*:tag
in general: configuration items (PR #60).Handle the fail argument to
Computer.aggregate()
through aggregate: configuration items (PR #60).New computations
relabel()
andrename_dims()
(PR #60).Improve perfomance for adding large number of computations to
Computer
(PR #60).
v1.10.0 (2022-03-31)
Add
testing.assert_units()
(PR #58).
v1.9.2 (2022-03-03)
Silence
collect_units()
when units are explicitly “”, rather thanNone
(PR #56).Add explicit implementations of
__radd__()
,__rmul__()
,__rsub__()
and__rtruediv__()
for e.g.4.2 * Quantity(...)
(PR #55)Improve typing of
Quantity.shift()
(PR #55)
v1.9.1 (2022-01-27)
Note that installing genno[pyam]
(including via genno[compat]
) currently forces the installation of an old version of pint
; version 0.17 or earlier.
Users wishing to use genno.compat.pyam
should first install genno[pyam]
, then pip install --upgrade pint
to restore a recent version of pint (0.18 or newer) that is usable with genno.
v1.9.0 (2021-11-23)
Fix error messages raised by
AttrSeries.sel()
on incorrect usage (PR #52).genno
no longer supports Python 3.6 or earlier, followingxarray
(PR #52).
v1.8.1 (2021-07-27)
Bug fixes
v1.8.0 (2021-07-27)
Improve caching (PR #50):
Handle a lambda functions in
cache()
-decorated code.Add
Encoder.register()
andEncoder.ignore()
for downstream code to extend hashing of function arguments into cache keys.Expand docs.
v1.7.0 (2021-07-22)
Add
computations.interpolate()
and supportingAttrSeries.interp()
(PR #48). This code works around issues pandas#25460 and pandas#31949.Computer.cache()
now also invalidates cache if the compiled bytecode of the decorated function changes (PR #48).Separate and expand docs of Caching to show how to check modification time and/or contents of files (#49, PR #48).
Add
Quantity.units
attribute for access to units (PR #48).AttrSeries.dims
andAttrSeries.coords
behave likeDataArray
for 1-D quantities (PR #48)
v1.6.0 (2021-07-07)
v1.5.2 (2021-07-06)
v1.5.1 (2021-07-01)
Bug fix:
infer_keys()
raisesAttributeError
under some circumstances (PR #45).
v1.5.0 (2021-06-27)
Adjust
test_assign_coords()
for xarray 0.18.2 (PR #43).Make
Key.dims
order-insensitive so thatKey("foo", "ab") == Key("foo", "ba")
(PR #42); make corresponding changes toComputer
(PR #44).Fix “
AttributeError
: ‘COO’ object has no attribute ‘item’” onSparseDataArray.item()
(PR #41).
v1.4.0 (2021-04-26)
plotnine.Plot.save()
automatically converts inputs (specified withPlot.inputs
) fromQuantity
toDataFrame
, but others (e.g. basic Python types) are passed through unchanged (PR #40).plotnine.Plot.save()
generates no output file ifgenerate()
returnsNone
/emptylist
.Quote
dict
argument toComputer.aggregrate()
(for grouped aggregation) to avoid collisions between its contents and other graph keys.
v1.3.0 (2021-03-22)
Bump minimum version of
sparse
from 0.10 to 0.12 and adjust to changes in this version (PR #39)Remove
SparseDataArray.equals()
, obviated by improvements insparse
.
Improve
AttrSeries
(PR #39)Implement
drop_vars()
andexpand_dims()
.assign_coords()
can relabel an entire dimension.sel()
can acceptDataArray
indexers and rename/combine dimensions.
v1.2.1 (2021-03-08)
Bug fix: Provide abstract
Quantity.to_series
method for type checking in packages that depend ongenno
.
v1.2.0 (2021-03-08)
Quantity
becomes an actual class, rather than a factory function;AttrSeries
andSparseDataArray
are subclasses (PR #37).AttrSeries
gains methodsbfill()
,cumprod()
,ffill()
, andshift()
(PR #37)computations.load_file()
uses the skipinitialspace parameter topandas.read_csv()
; extra dimensions not mentioned in the dims parameter are preserved (PR #37).AttrSeries.sel()
acceptsxarray.DataArray
for xarray-style indexing (PR #37).
v1.1.1 (2021-02-22)
Bug fix:
Computer.add_single()
incorrectly callscheck_keys()
on iterables (e.g.pandas.DataFrame
) that are not computations (PR #36).
v1.1.0 (2021-02-16)
computations.add()
transforms compatible units, and raises an exception for incompatible units (PR #31).Improve handling of scalar quantities (PR #31).
Plot
is fault-tolerant: if any of the input quantities are missing, it becomes a no-op (PR #31).Computer.configure()
accepts a fail argument, allowing partial handling of configuration data/files, with errors logged but not raised (PR #31).New
computations.pow()
(PR #31).
v1.0.0 (2021-02-13)
Adjust for usage by
ixmp.reporting
andmessage_ix.reporting
(PR #28):Reduce minimum Python version to 3.6. This is lower than the minimum version for xarray (3.7), but matches ixmp, etc.
Remove
compat.ixmp
; this code has been moved toixmp.reporting
, replacing what was there. Likewise, removecompat.message_ix
.Simplify the form & parsing of
iamc:
section entries in configuration files:Remove unused feature to add
group_sum()
to the chain of tasks.Keys now conform more closely to the arguments of
Computer.convert_pyam()
.
Move argument-checking from
as_pyam()
toconvert_pyam()
.- Simplify semantics of
genno.config.handles()
decorator. Remove
CALLBACKS
feature, for now.
- Simplify semantics of
Computer.get_comp()
andrequire_compat()
are now public methods.Expand tests.
Protect
Computer
configuration fromdask.optimization.cull()
; this prevents infinite recursion if the configuration contains strings matching keys in the graph. Addunquote()
(#25, PR #26).Simplify
collect_units()
and improve unit handling inratio()
(#25, PR #26).Add file-based caching via
Computer.cache()
andgenno.caching
(#20, PR #24).
v0.4.0 and earlier
v0.4.0 (2021-02-07)
Add file-based configuration in
genno.config
and associated documentation (#8, PR #16).
v0.3.0 (2021-02-05)
Add Plotnine (compat.plotnine) compatibility (PR #15).
Add a Concepts and usage overview to the documentation (PR #13).
v0.2.0 (2021-01-18)
Increase test coverage to 100% (PR #12).
Port code from
message_ix.reporting
(PR #11).Add
compat.pyam
.Add a name parameter to
load_file()
.
v0.1.0 (2021-01-10)
Initial code port from
ixmp.reporting
.