Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend feature vintage_and_active_years() #572

Merged
merged 31 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
71f238f
Extend tests for feature revision vtg_act_yrs
OFR-IIASA Mar 24, 2022
43a6054
Adjust vintage_and_active_years to account for tec. lifetime
OFR-IIASA Mar 31, 2022
53f055a
Sort module imports
OFR-IIASA Mar 31, 2022
b1a61b1
Remove obsolete tests; moved to separate file
OFR-IIASA May 17, 2022
ca14b00
Reapply updated version of black
OFR-IIASA May 17, 2022
8557e05
Account for definition of map_tec_lifetime
OFR-IIASA May 18, 2022
b7c4974
Update release notes
OFR-IIASA May 18, 2022
05bc01d
Use a utility function to reduce duplicated code in yv/ya tests
khaeru May 23, 2022
703effe
Consolidate setup of time horizon in yv/ya tests
khaeru May 23, 2022
539b732
Add utility functions to generate expected output from yv/ya tests
khaeru May 23, 2022
ae77ade
Simplify yv/ya tests using utility code
khaeru May 23, 2022
04bda72
Further consolidate setup in yv/ya tests
khaeru May 23, 2022
e91b943
Simplify and comment utility code in yv/ya tests
khaeru May 23, 2022
5d0cdcd
Reflow comments, add docstrings in vintage_and_active_years tests
khaeru May 23, 2022
dc3e846
Reflow comments & docstrings, add type hints in 3 Scenario methods
khaeru May 23, 2022
c2a0565
Ensure consistent dtypes in yv/ya tests
khaeru May 23, 2022
292edf4
Add docstring examples, tests for alt. usage of vintage_and_active_years
khaeru May 23, 2022
d621cc1
Test vintage_and_active_years with "gappy" technical_lifetime
khaeru May 23, 2022
5d9795b
Use pd.concat(…, ignore_index=True) instead of 2 chained calls
khaeru May 23, 2022
7706b2b
Correct error in yv/ya arg test, remove workaround
khaeru May 23, 2022
aed60cb
Simplify/flatten vintage_and_active_years
khaeru May 23, 2022
b54cbed
Expand docstring of vintage_and_active_years
khaeru May 23, 2022
ef67c97
Force np.int64 on Windows in yv/ya tests
khaeru May 23, 2022
6608156
Adjust signature of vintage_and_active_years
khaeru May 24, 2022
04576ae
Update comments in tests of yv_ya
khaeru May 24, 2022
ac8c23b
Add yv_ya() as shorthand for vintage_and_active_years()
khaeru May 24, 2022
4620578
Add Scenario.y0 as a shorthand for .firstmodelyear
khaeru May 24, 2022
8a868ad
Expand discussion of #572 in release notes
khaeru May 24, 2022
921ea78
Update .gitignore; include "225a" and similar directories
khaeru May 24, 2022
642a703
Ensure consistent dtypes in tests of yv_ya
khaeru May 24, 2022
0fedf74
Un-exclude windows-latest-py3.10 job in "pytest" CI workflow
khaeru May 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ jobs:
# for the message_ix project.
# - "3.10.0-alpha.1" # Development version

exclude:
# JPype1 (for ixmp) binary wheels are not available for this combination
- os: windows-latest
python-version: "3.10"

fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
49 changes: 24 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
# GAMS, R, Python-specific auxiliary files
*.~gm
# Python, R, etc.
*-checkpoint.ipynb
*.bak
*.dat
*.egg-info
*.~op
*.pyc
*.gdx
*.lst
*.log
*.eggs
*.lxi
*.gch
*.gpr
/model/2*/**
/model/$gms*
*.dat
*.tmp
*.RData*
*.pyc
*-checkpoint.ipynb
*.RData*
*.tmp
*#
*~
#*
*#
.
*.eggs

# MESSAGEix specifics
# GAMS
*.~gm
*.~op
*.gch
*.gdx
*.gpr
*.log
*.lst
message_ix/model/2*/**
message_ix/model/$gms*
message_ix/model/MESSAGE_master.gms
message_ix/model/cplex.opt

# Apple file system
.DS_Store

# Sphinx
doc/_build
doc/bibtex.json
Expand All @@ -42,16 +37,20 @@ dist
# testdb
.cache/**
tests/data/nightly
.Rproj.user

# pytest and related
.benchmarks
.coverage*
.mypy_cache
prof/
.pytest_cache
coverage.xml
htmlcov
prof/

# JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# JetBrains IDEs incl. PyCharm
/**/.idea
# RStudio
.Rproj.user

# macOS
.DS_Store
23 changes: 19 additions & 4 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
.. Next release
.. ============
Next release
============

.. All changes
.. -----------
Migration notes
---------------

- The `in_horizon` argument to :meth:`.vintage_and_active_years` is deprecated, and will be removed in :mod:`message_ix` 4.0 or later.
At the same time, the behaviour will change to be the equivalent of providing `in_horizon` = :obj:`False`, i.e. the method will no longer filter to the scenario time horizon by default.
To prepare for this change, user code that expects values confined to the time horizon can be altered to use :meth:`.pandas.DataFrame.query`:

.. code-block:: python
df = scen.vintage_and_active_years().query(f"{scen.y0} <= year_vtg")
All changes
-----------

- Extend functionality of :meth:`.vintage_and_active_years`; add aliases
:meth:`.yv_ya`, :meth:`.ya`, and :attr:`.y0` (:pull:`572`).

.. _v3.5.0:

Expand Down
3 changes: 3 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ The full API is also available from R; see :doc:`rmessageix`.
to_excel
var
vintage_and_active_years
y0
years_active
ya
yv_ya

.. automethod:: add_macro

Expand Down
Loading