Skip to content

Commit

Permalink
Update docs and meta package
Browse files Browse the repository at this point in the history
  • Loading branch information
wpreimes committed Aug 29, 2024
1 parent ff997ef commit a81732e
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 66 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ jobs:
- name: Install dependencies and package
shell: bash -l {0}
run: |
# conda install -c conda-forge pyresample netCDF4
pip install -e .[testing]
pip install git+https://github.com/TUW-GEO/repurpose@9e233bacd8989b4fa6f7eebb699025ffd231b8e9 # todo delete
- name: Run all tests
shell: bash -l {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build:
python:
install:
- method: pip
path: .
path: .[docs]

sphinx:
configuration: docs/conf.py
Expand Down
4 changes: 1 addition & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1

RUN micromamba install -y -n base -c conda-forge python=3.12
RUN cd c3s_sm && \
pip install . &&\
pip uninstall repurpose --yes && \
pip install git+https://github.com/TUW-GEO/repurpose@9e233bacd8989b4fa6f7eebb699025ffd231b8e9
pip install .

RUN micromamba clean --all --yes

Expand Down
3 changes: 1 addition & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ fi
# Tag/branch/commit in https://git.eodc.eu/cci-sm-work/cci_sm_ecvps_py_src
GIT_BRANCH_TAG_COMMIT=$1

# TODO: Change to upstream repo
GIT_URL="https://github.com/wpreimes/c3s_sm.git"
GIT_URL="https://github.com/TUW-GEO/c3s_sm.git"

echo "Calling Dockerfile at $this_dir/docker/Dockerfile"
echo "Checking out source tag $GIT_BRANCH_TAG_COMMIT"
Expand Down
14 changes: 1 addition & 13 deletions docs/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,4 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.10
- ipykernel
- nbsphinx
- mock
- pillow
- sphinx<7
- sphinx_rtd_theme
- pip
- pip:
- recommonmark
- readthedocs-sphinx-ext
- myst_parser

- python=3.10
47 changes: 19 additions & 28 deletions docs/pages/reading.ipynb

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ install_requires =
netCDF4
xarray
pynetcf>=0.2.2
repurpose>=0.11
repurpose>=0.12
parse
cadati
smecv_grid>=0.3
Expand All @@ -62,9 +62,17 @@ exclude =
# PDF = ReportLab; RXP
# Add here test requirements (semicolon/line-separated)
docs =
xarray
dask
matplotlib
jupyter
dask
sphinx<7
sphinx_rtd_theme
mock
pillow
recommonmark
readthedocs-sphinx-ext
myst_parser
nbsphinx

testing =
pytest
Expand Down
14 changes: 7 additions & 7 deletions src/c3s_sm/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pandas as pd
from dateutil.relativedelta import relativedelta
from cadati.dekad import day2dekad
from repurpose.process import parallel_process_async
from repurpose.process import parallel_process
import traceback

from c3s_sm.const import variable_lut, freq_lut, check_api_read
Expand Down Expand Up @@ -285,12 +285,12 @@ def download_and_extract(target_path,

curr_year += 1

results = parallel_process_async(download_c3ssm, STATIC_KWARGS=STATIC_KWARGS,
ITER_KWARGS=ITER_KWARGS, n_proc=1,
log_path=os.path.join(target_path, '000_log'),
loglevel='INFO', backend='threading',
logger_name='dl_logger',
show_progress_bars=True)
results = parallel_process(download_c3ssm, STATIC_KWARGS=STATIC_KWARGS,
ITER_KWARGS=ITER_KWARGS, n_proc=1,
log_path=os.path.join(target_path, '000_log'),
loglevel='INFO', backend='threading',
logger_name='dl_logger',
show_progress_bars=True)

try:
update_image_summary_file(target_path)
Expand Down
8 changes: 4 additions & 4 deletions src/c3s_sm/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from parse import parse
from c3s_sm.const import fntempl as _default_template
import xarray as xr
from repurpose.process import parallel_process_async
from repurpose.process import parallel_process

def collect_ts_cov(data_path: str, n_proc=1, progressbar=False):
"""
Expand Down Expand Up @@ -41,9 +41,9 @@ def _func(f: str) -> tuple:

return start, end, cell, parameters

se = parallel_process_async(_func, ITER_KWARGS=dict(f=fl),
show_progress_bars=progressbar,
backend='threading', n_proc=n_proc)
se = parallel_process(_func, ITER_KWARGS=dict(f=fl),
show_progress_bars=progressbar,
backend='threading', n_proc=n_proc)

periods = {}
parameters = None
Expand Down
16 changes: 13 additions & 3 deletions src/c3s_sm/reshuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import warnings
from datetime import datetime
import pandas as pd
import pygeogrids
from smecv_grid.grid import SMECV_Grid_v052
from parse import parse
from netCDF4 import Dataset
Expand All @@ -23,7 +24,11 @@
from c3s_sm.const import fntempl as _default_template
import c3s_sm.metadata as metadata
from c3s_sm.metadata import C3S_daily_tsatt_nc, C3S_dekmon_tsatt_nc
from c3s_sm.misc import update_ts_summary_file, collect_ts_cov, read_summary_yml, update_image_summary_file
from c3s_sm.misc import (
update_ts_summary_file,
read_summary_yml,
update_image_summary_file,
)

def reshuffle(*args, **kwargs):
warnings.warn("`c3s_sm.reshuffle.reshuffle` is deprecated, "
Expand Down Expand Up @@ -251,10 +256,15 @@ def img2ts(img_path, ts_path, startdate, enddate, parameters=None,
else:
input_dataset = ImageBaseConnection(input_dataset)

if isinstance(grid, pygeogrids.CellGrid):
_cellsize = None
else:
_cellsize = 5

reshuffler = Img2Ts(input_dataset=input_dataset, outputpath=ts_path,
startdate=startdate, enddate=enddate, input_grid=grid,
imgbuffer=imgbuffer, cellsize_lat=5.0,
cellsize_lon=5.0, global_attr=global_attributes,
imgbuffer=imgbuffer, cellsize_lat=_cellsize,
cellsize_lon=_cellsize, global_attr=global_attributes,
zlib=True, unlim_chunksize=1000,
ts_attributes=ts_attributes, n_proc=n_proc,
backend='multiprocessing')
Expand Down

0 comments on commit a81732e

Please sign in to comment.