Skip to content

Commit 88c37a1

Browse files
authored
Merge pull request #322 from iiasa/issue/313
Adjust packaging of Git LFS artefacts
2 parents ae96255 + 16d912c commit 88c37a1

File tree

8 files changed

+76
-36
lines changed

8 files changed

+76
-36
lines changed

.github/workflows/publish.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
jobs:
1414
publish:
1515
uses: iiasa/actions/.github/workflows/publish.yaml@main
16+
with:
17+
lfs: true
1618
secrets:
1719
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
18-
TESTPYPI_TOKEN: ${{ secrets.TESTPYPI_TOKEN }}

doc/api/tools-costs.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ The tool uses the following data sources for the regional differentiation of cos
105105

106106
The tool also uses :mod:`.ssp.data` (via :func:`.exo_data.prepare_computer`) to adjust the costs of technologies based on GDP per capita.
107107

108+
.. _costs-usage:
109+
108110
Usage
109111
=====
110112

@@ -121,7 +123,7 @@ Those settings include the following; click each for the full description, allow
121123
:attr:`~.Config.scenario_version`,
122124
:attr:`~.Config.base_year`,
123125
:attr:`~.Config.convergence_year`,
124-
:attr:`~.Config.use_vintages`,
126+
:attr:`~.Config.use_vintages`,
125127
:attr:`~.Config.fom_rate`, and
126128
:attr:`~.Config.format`.
127129

@@ -130,7 +132,10 @@ Those settings include the following; click each for the full description, allow
130132
- "inv_cost": the investment costs of the technologies in each region.
131133
- "fix_cost": the fixed O&M costs of the technologies in each region.
132134

133-
To use the tool with the default settings, simply create a :class:`.Config` object and pass it as an argument to :func:`.create_cost_projections`::
135+
To use the tool, you **must** first obtain a copy of the SSP input data.
136+
See the documentation at :mod:`message_ix_models.project.ssp.data`.
137+
138+
Next, create a :class:`.Config` object and pass it as an argument to :func:`.create_cost_projections`::
134139

135140
from message_ix_models.tools.costs import Config, create_cost_projections
136141

@@ -149,7 +154,7 @@ See the file :file:`message_ix_models/tools/costs/demo.py` for multiple examples
149154

150155

151156
.. note:: The data produced are for all valid combinations of :math:`(y^V, y^A)`—including those that are beyond the `technical_lifetime` of the |t| to which they apply.
152-
This may produce large data frames, depending on the number of technologies, regions, and scenarios.
157+
This may produce large data frames, depending on the number of technologies, regions, and scenarios.
153158
At the moment, :mod:`.tools.costs` does not filter out these combinations.
154159
If this is problematic, the user may consider filtering the data for valid combinations of :math:`(y^V, y^A)`.
155160

doc/data.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ These are the preferred location for:
8282

8383
- Outputs, such as data or plot files generated by reporting.
8484
- Data files not distributable with :mod:`message_ix_models`, for instance those with access conditions (registration, payment, etc.).
85+
86+
These include, among others, :mod:`.project.ssp.data`.
8587
- Caches: temporary data files used to speed up other code by avoiding repeat of slow operations.
8688

8789
These kinds of data **must not** be committed to :mod:`message_ix_models`.
@@ -105,12 +107,26 @@ This location **should** be outside the Git-controlled directories for :mod:`mes
105107
In other words, users **should** at least use (2) or (3) to specify such directories.
106108
If not, they **may** use :file:`.gitignore` files to hide these from Git.
107109

110+
.. _cache-data:
111+
108112
(4B) Cache data
109113
~~~~~~~~~~~~~~~
110114

111-
Code **should** use :func:`.platformdirs.user_cache_path` to identify a system-specific path to a cache directory.
115+
User code **should** use :attr:`.Config.cache_path` (equivalently :py:`Context.core.cache_path`) to identify a system-specific path to a cache directory.
112116
For example:
113117

118+
.. code-block:: python
119+
120+
from message_ix_models.util.config import Config
121+
122+
cfg = Config()
123+
124+
cfg.cache_path
125+
126+
This is also a way to identify the cache path used on a particular system where :mod:`message_ix_models` is installed.
127+
128+
Internal code that cannot access a :class:`~.util.config.Config` or :class:`.Context` instance **should** instead use :func:`platformdirs.user_cache_path` directly:
129+
114130
.. code-block:: python
115131
116132
from platformdirs import user_cache_path
@@ -125,7 +141,6 @@ For example:
125141
# Construct a file path within this directory
126142
p = dir_.joinpath("data-file-name.csv")
127143
128-
129144
General guidelines
130145
==================
131146

doc/project/ssp.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,20 @@ Data
3333
.. automodule:: message_ix_models.project.ssp.data
3434
:members:
3535

36-
Although free of charge, neither the 2017 or 2024 SSP data can be downloaded automatically.
37-
Both sources require that users first submit personal information to register before being able to retrieve the data.
38-
:mod:`message_ix_models` does not circumvent this requirement.
39-
Thus:
36+
Although free of charge, both the 2017 and 2024 SSP data are provided under licenses that prevent distribution with or automated retrieval by :mod:`message_ix_models`.
37+
Both sources require that users first submit personal information to register before being able to retrieve the data,
38+
and restrict the distribution of the complete, original files.
4039

41-
- A copy of the data are stored in :mod:`message_data`.
42-
- :mod:`message_ix_models` contains only a ‘fuzzed’ version of the data (same structure, random values) for testing purposes.
40+
Thus, :mod:`message_ix_models` contains only a ‘fuzzed’ version of the data (same structure, random values) for testing purposes.
4341

44-
.. todo:: Allow users without access to :mod:`message_data` to read a local copy of this data from a :attr:`.Config.local_data` subdirectory.
42+
In order to use these data via the tools in this module, the user must obtain a copy of the files
43+
—for instance, by manually completing the registration and download steps—
44+
and place them in the directory :attr:`.Config.cache_path` (see :ref:`cache-data`)
45+
or :file:`message_ix_models/data/ssp/` within the environment where :mod:`message_ix_models` is installed.
46+
For :class:`SSPUpdate`, the specific file names required are the ones given by :data:`.pooch.SOURCE`::
47+
48+
1706548837040-ssp_basic_drivers_release_3.0_full.csv.gz
49+
1710759470883-ssp_basic_drivers_release_3.0.1_full.csv.gz
4550

4651
.. autosummary::
4752
SSPOriginal

doc/whatsnew.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Documentation
103103
:doc:`project/prisma`,
104104
:doc:`project/sparccle`, and
105105
:doc:`project/uptake` (:pull:`282`).
106+
- Expand the :ref:`costs-usage` section of the :mod:`.tools.costs` documentation to describe the requirement for SSP input data (:issue:`313`, :pull:`322`).
106107

107108
v2025.1.10
108109
==========

message_ix_models/project/ssp/data.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,29 @@
1818
class SSPOriginal(ExoDataSource):
1919
"""Provider of exogenous data from the original SSP database.
2020
21-
To use data from this source, call :func:`.exo_data.prepare_computer` with the
22-
arguments:
21+
This database is accessible from https://tntcat.iiasa.ac.at/SspDb/dsd.
2322
24-
- `source`: Any value from :data:`.SSP_2017` or equivalent string, for instance
25-
"ICONICS:SSP(2017).2". The specific SSP for which data is returned is determined
26-
from the value.
27-
- `source_kw` including:
23+
To use data from this source:
2824
29-
- "model": one of:
25+
1. Read the general documentation for :mod:`.project.ssp.data`.
26+
2. If necessary, obtain copy of the original data file(s).
27+
3. Call :func:`.exo_data.prepare_computer` with the arguments:
3028
31-
- IIASA GDP
32-
- IIASA-WiC POP
33-
- NCAR
34-
- OECD Env-Growth
35-
- PIK GDP-32
29+
- `source`: Any value from :data:`.SSP_2017` or equivalent string, for instance
30+
"ICONICS:SSP(2017).2". The specific SSP for which data is returned is
31+
determined from the value.
32+
- `source_kw` including:
3633
37-
- "measure": The measures available differ according to the model; see the source
38-
data for details.
34+
- "model": one of:
35+
36+
- IIASA GDP
37+
- IIASA-WiC POP
38+
- NCAR
39+
- OECD Env-Growth
40+
- PIK GDP-32
41+
42+
- "measure": The measures available differ according to the model; see the
43+
source data for details.
3944
4045
Example
4146
-------
@@ -117,12 +122,17 @@ def __call__(self):
117122
class SSPUpdate(ExoDataSource):
118123
"""Provider of exogenous data from the SSP Update database.
119124
120-
To use data from this source, call :func:`.exo_data.prepare_computer` with the
121-
arguments:
125+
This database is accessible from https://data.ece.iiasa.ac.at/ssp.
126+
127+
To use data from this source:
128+
129+
1. Read the general documentation for :mod:`.project.ssp.data`.
130+
2. If necessary, obtain copy of the original data file(s).
131+
3. Call :func:`.exo_data.prepare_computer` with the arguments:
122132
123-
- `source`: Any value from :data:`.SSP_2024` or equivalent string, for instance
124-
"ICONICS:SSP(2024).2".
125-
- `release`: One of "3.0.1", "3.0", or "preview".
133+
- `source`: Any value from :data:`.SSP_2024` or equivalent string, for instance
134+
"ICONICS:SSP(2024).2".
135+
- `release`: One of "3.0.1", "3.0", or "preview".
126136
127137
Example
128138
-------

message_ix_models/util/config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,12 @@ def hexdigest(self, length: int = -1) -> str:
165165
class Config:
166166
"""Core/top-level settings for :mod:`message_ix_models` and :mod:`message_data`."""
167167

168-
#: Base path for cached data, e.g. as given by the :program:`--cache-path` CLI
169-
#: option. Default: the directory :file:`message-ix-models` within the directory
170-
#: given by :func:`.platformdirs.user_cache_path`.
168+
#: Base path for cached data. By default, the directory :file:`message-ix-models`
169+
#: within the directory given by :func:`.platformdirs.user_cache_path`. This **may**
170+
#: be something like :file:`$HOME/.cache/message-ix-models/`.
171+
#: The :program:`--cache-path` CLI option modifies this value.
172+
#:
173+
#: See also :ref:`cache-data`.
171174
cache_path: Optional[Path] = None
172175

173176
#: Paths of files containing debug outputs. See

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"Intended Audience :: Developers",
1717
"Intended Audience :: Science/Research",
18-
"License :: OSI Approved :: Apache Software License",
1918
"Natural Language :: English",
2019
"Operating System :: OS Independent",
2120
"Programming Language :: Python",
@@ -29,6 +28,7 @@ classifiers = [
2928
"Topic :: Scientific/Engineering",
3029
"Topic :: Scientific/Engineering :: Information Analysis",
3130
]
31+
license = "Apache-2.0"
3232
requires-python = ">=3.9"
3333
dependencies = [
3434
"click",

0 commit comments

Comments
 (0)