Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
48b2ad3
make temporal downscaling methods more explicit about their inputs, b…
ifthompson Jul 31, 2023
97fa148
add a generic temporal downscaling function to use some weight/proxy
ifthompson Jul 31, 2023
50eb3fd
config option for spatial bounds
ifthompson Jul 31, 2023
bf186db
new output writing
ifthompson Aug 1, 2023
08e12b3
add spatial bounds option to temporal downscaling methods
ifthompson Aug 1, 2023
f6d15bf
if single layer file but multiple variables declared, use that for all
ifthompson Aug 2, 2023
99f388d
remove desal from withdrawals
ifthompson Aug 2, 2023
3fae35a
add supersector_iterations config option to control how many times to…
ifthompson Aug 3, 2023
3ce17e5
Merge pull request #72 from JGCRI/improve_temporal_rebase
thurber Aug 19, 2024
28323aa
update package version number and name in a metadata call for get_exa…
hassaniazi Aug 26, 2024
0b75f98
ensure gcam could be queries for other nestings than the sector subse…
hassaniazi Dec 6, 2024
a690442
add basin name mappings for old and new gcam names. also remove extra…
hassaniazi Dec 6, 2024
f1fa995
add a quick function to extract basin names from resource string for …
hassaniazi Dec 6, 2024
1ebad61
include a workflow to disaggregated water source for each demand type…
hassaniazi Dec 6, 2024
4e93953
incorporate water source disaggregation into main tethys class
hassaniazi Dec 6, 2024
1fc9616
only have water source shares for withdrawal; fix queries; hack to ca…
thurber Mar 14, 2025
e24d6dd
fix
thurber Jun 9, 2025
d29d640
support `irrigation_conveyance_efficiency` configuration
thurber Jun 25, 2025
b32ac44
remove early return
thurber Jun 25, 2025
225a419
code to test dynamic population against static
crvernon Oct 31, 2025
a231a31
Merge pull request #76 from JGCRI/feature/dynamic-population
crvernon Nov 17, 2025
72e8d95
fix metadata incl package name
hassaniazi Jun 4, 2026
c256a90
fix package versions for a robust set up across machines esp with gca…
hassaniazi Jun 4, 2026
75ee3c7
make the temporal tests pass with explicityly handling kwargs in tdme…
hassaniazi Jun 4, 2026
647be6a
restore legacy temporal api in model.py as well in line with the last…
hassaniazi Jun 4, 2026
b970d43
bridge legacy kwargs and the new temporal_config() formal with a form…
hassaniazi Jun 4, 2026
bb14a68
remove redundant pytest install for the prod build
hassaniazi Jun 4, 2026
1a83af1
catch version-specific issues and use editable dev install in deployment
hassaniazi Jun 4, 2026
1802990
bump up the version
hassaniazi Jun 4, 2026
cb8eb24
upgrade action upload artifact to deploy
hassaniazi Jun 4, 2026
bb4b8b5
only build paper for main
hassaniazi Jun 4, 2026
c6a6e3d
avoid returning resource names at the first underscore e.g, unlikely …
hassaniazi Jun 4, 2026
216a9eb
avoid hard coding demand type
hassaniazi Jun 4, 2026
a125612
make region_masks and years mandatory to fail fast before going further
hassaniazi Jun 4, 2026
fa5a4d6
avoid missing share value of a basin with any zero source in a period…
hassaniazi Jun 4, 2026
151b16b
handle data type for better IO
hassaniazi Jun 4, 2026
2dee8db
retail other vars for muni temporal method and avoid hard coding
hassaniazi Jun 4, 2026
03e5be0
retain other vars for temporal method and avoid hard coding
hassaniazi Jun 4, 2026
350a7c9
retain other vars for temporal method and avoid hard coding
hassaniazi Jun 4, 2026
5f1fd2c
retain other vars for weights temporal method and avoid hard coding
hassaniazi Jun 4, 2026
aa984ed
correct typo
hassaniazi Jun 4, 2026
05dbd4d
Merge pull request #77 from JGCRI/source-disagg
hassaniazi Jun 4, 2026
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
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,26 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.11']

env:
OS: ${{ matrix.os }}
PYTHON: '3.9'
PYTHON: ${{ matrix.python-version }}

steps:

- uses: actions/checkout@v1

- name: Set up Python
uses: actions/setup-python@master
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install click-default-group
pip install .
pip install -e .[dev]

- name: Test and generate coverage report on Linux
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
12 changes: 10 additions & 2 deletions .github/workflows/paper.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
---
on: [push]
name: paper

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
paper:
Expand All @@ -15,7 +23,7 @@ jobs:
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Details on methodology and advanced usage are available on the [User Guide](http

Install `tethys` using pip:

`pip install tethys-downscale`
`pip install tethys-downscaling`

## Contributing to Tethys

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

project = 'tethys'
copyright = '2021, Battelle Memorial Institute'
author = 'Chris R. Vernon'
author = 'Isaac Thompson, Chris R. Vernon, Hassan Niazi'

# The full version, including alpha/beta/rc tags
release = version
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ As a prerequisite, you'll need to have `Python <https://www.python.org/downloads

**tethys** can be installed from GitHub using pip::

pip install tethys-downscale
pip install tethys-downscaling

This will automatically install the dependencies. In order to avoid package version conflicts, consider using a virtual environment.

Expand Down
51 changes: 35 additions & 16 deletions docs/source/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,24 @@ Configuration File
------------------
**tethys** uses a `YAML <https://yaml.org/spec/1.2.2/>`_ configuration file. The options in this file correspond to the arguments passed to the :ref:`Tethys class <tethys.model>`. Options not present in the config file will use the default. An overview is provided in the following table, with more details and examples below.

======================== =========================================================
Option Description
======================== =========================================================
:ref:`years` list of years to be included spatial downscaling
:ref:`resolution` resolution in degrees for spatial downscaling
:ref:`demand_type` choice between "withdrawals" (default) or "consumption"
:ref:`perform_temporal` choice between "false" (default) or "true"
:ref:`gcam_db` relative path to a GCAM database
:ref:`csv` relative path to csv file containing inputs
:ref:`output_file` name of file to write outputs to
:ref:`downscaling_rules` mapping from water demand sectors to proxy variables
:ref:`proxy_files` mapping of spatial proxy files to their years/variables
:ref:`map_files` list of files containing region maps
:ref:`temporal_methods` mapping of sector to temporal downscaling method
:ref:`temporal_files` files that will be accessible during temporal downscaling
======================== =========================================================
======================================= =============================================================================
Option Description
======================================= =============================================================================
:ref:`years` list of years to be included spatial downscaling
:ref:`resolution` resolution in degrees for spatial downscaling
:ref:`demand_type` choice between "withdrawals" (default) or "consumption"
:ref:`perform_temporal` choice between "false" (default) or "true"
:ref:`gcam_db` relative path to a GCAM database
:ref:`csv` relative path to csv file containing inputs
:ref:`output_file` name of file to write outputs to
:ref:`downscaling_rules` mapping from water demand sectors to proxy variables
:ref:`proxy_files` mapping of spatial proxy files to their years/variables
:ref:`map_files` list of files containing region maps
:ref:`temporal_methods` mapping of sector to temporal downscaling method
:ref:`temporal_files` files that will be accessible during temporal downscaling
:ref:`source_disaggregation` if true, share of surface water vs groundwater withdrawal will be written out
:ref:`irrigation_conveyance_efficiency` if set, irrigation withdrawal will be divided by this number
======================================= =============================================================================


years
Expand Down Expand Up @@ -272,6 +274,23 @@ Mapping of files that will be accessible to temporal downscaling methods.
CDD: data/temporal/CDD_monthly.nc


source_disaggregation
^^^^^^^^^^^^^^^^^^^^
If true, share of surface water vs groundwater withdrawal will be written out to a file called gridded_runoff_shares.nc
.. code-block:: yaml

source_disaggregation: true


irrigation_conveyance_efficiency
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If set, irrigation withdrawal will be divided by this number, representing GCAM's irrigation conveyance efficiency

.. code-block:: yaml

irrigation_conveyance_efficiency: 0.829937


Generalization
--------------
**tethys** was developed with consideration for GCAM's breakdown of water demand, but was designed to be as flexible as possible with support for user-specified downscaling configurations.
Expand Down
10 changes: 4 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
PyYAML>=6.0
gcamreader>=1.2.5
gcamreader>=1.4.0
numpy>=1.22
pandas>=1.2.4
netCDF4>=1.6
xarray>=2022.09.0
rioxarray>=0.12.4
tqdm>=4.66.2
matplotlib>=3.8.3
dask[complete]>=2022.12.1
bokeh!=3.0.*,>=2.4.2
geopandas>=0.14.3
dask_geopandas>=0.3.1
hvplot>=0.9.2
dask>=2022.12.1
distributed>=2022.12.1
setuptools<81
26 changes: 14 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,37 @@ def get_requirements():
url='https://github.com/JGCRI/tethys',
packages=find_packages(),
license='BSD-2-Clause',
author='Isaac Thompson, Chris Vernon',
author='Isaac Thompson, Chris Vernon, Hassan Niazi',
python_requires='>=3.9, <4',
include_package_data=True,
install_requires=[
'PyYAML>=6.0',
'gcamreader>=1.2.5',
'gcamreader==1.4.0',
'numpy>=1.22',
'pandas>=1.2.4',
'netCDF4>=1.6',
'dask[complete]>=2022.12.1',
'dask_geopandas>=0.3.1',
'dask==2024.8.0',
'distributed==2024.8.0',
'xarray>=2022.09.0',
'rioxarray>=0.12.4',
'tqdm>=4.66.2',
'matplotlib>=3.8.3',
'setuptools<81',
'bokeh!=3.0.*,>=2.4.2',
'geopandas>=0.14.3',
'dask_geopandas>=0.3.1',
'hvplot>=0.9.2',
],
extras_require={
'dev': [
'build~=0.5.1',
'nbsphinx~=0.8.6',
'setuptools~=57.0.0',
'sphinx~=4.0.2',
'sphinx-panels~=0.6.0',
'sphinx-rtd-theme~=0.5.2',
'sphinx-mathjax-offline~=0.0.1',
'twine>=3.4.1',
'build==0.10.0',
'nbsphinx==0.8.12',
'sphinx==4.5.0',
'sphinx-panels==0.6.0',
'sphinx-rtd-theme==0.5.2',
'sphinx-mathjax-offline==0.0.2',
'pytest>=8.3.0',
'pytest-cov>=5.0.0',
'click-default-group>=1.2.4',
]
}
Expand Down
Loading
Loading