IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
226 stars 118 forks source link

Add `time_domain` and `time` attributes #599

Closed danielhuppmann closed 2 years ago

danielhuppmann commented 2 years ago

Note: this PR is targeted to the feature/year-and-datetime branch that collects all developments related to #597.

Description of PR

This PR adds the time_domain attribute (value: year, datetime, mixed) and a time attribute that returns an Index of the time domain.

Previously, there was either a year attribute (returning a list of integers) or a time attribute (returning an pandas.Index) depending on the time domain.

Now, the time attribute exists for any IamDataFrame (returning an index depending on the time domain). The year attribute continues to exist for IamDataFrame instances that have (only) yearly data.

codecov[bot] commented 2 years ago

Codecov Report

Merging #599 (a4062e2) into feature/year-and-datetime (32f01e9) will increase coverage by 0.0%. The diff coverage is 100.0%.

Impacted file tree graph

@@                    Coverage Diff                    @@
##           feature/year-and-datetime    #599   +/-   ##
=========================================================
  Coverage                       94.1%   94.2%           
=========================================================
  Files                             50      50           
  Lines                           5358    5383   +25     
=========================================================
+ Hits                            5047    5072   +25     
  Misses                           311     311           
Impacted Files Coverage Δ
pyam/time.py 96.0% <ø> (-0.1%) :arrow_down:
pyam/core.py 94.4% <100.0%> (+0.1%) :arrow_up:
tests/conftest.py 100.0% <100.0%> (ø)
tests/test_core.py 100.0% <100.0%> (ø)
tests/test_time.py 100.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 32f01e9...a4062e2. Read the comment docs.