diff --git a/CHANGES.rst b/CHANGES.rst index ca8e9f1e..636b88db 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,8 @@ Changes ================== * fix to remove realization coordinate from ensembles +* added chunk datasets for local files also +* update xclim to == 0.15.2 0.5.1 (2020-04-18) ================== @@ -23,7 +25,7 @@ Changes * fix #103 (drs_filename) add defaults when `project_id` is unknown * drs_filenames: use dash instead of underscores in variable names -* fix #80 frequency attrs of computed datasets +* fix #80 frequency attrs of computed datasets 0.4.0 (2020-03-10) ================== diff --git a/docs/source/notebooks/dap_subset.ipynb b/docs/source/notebooks/dap_subset.ipynb index 29b13255..3242e561 100644 --- a/docs/source/notebooks/dap_subset.ipynb +++ b/docs/source/notebooks/dap_subset.ipynb @@ -553,7 +553,7 @@ "Attributes:\n", " units: mm/day\n", " cell_methods: time: mean (interval: 30 minutes)\n", - " history: pr=max(0,pr) applied to raw data;\\n[2020-04-04 16:13:21] ...\n", + " history: pr=max(0,pr) applied to raw data;\\n[2020-04-05 10:27:31] ...\n", " standard_name: lwe_thickness_of_precipitation_amount\n", " long_name: Average precipitation during wet days (sdii)\n", " description: Annual simple daily intensity index (sdii) : annual avera..." @@ -576,7 +576,7 @@ "Attributes:\n", " units: mm/day\n", " cell_methods: time: mean (interval: 30 minutes)\n", - " history: pr=max(0,pr) applied to raw data;\\n[2020-04-04 16:13:21] ...\n", + " history: pr=max(0,pr) applied to raw data;\\n[2020-04-05 10:27:31] ...\n", " standard_name: lwe_thickness_of_precipitation_amount\n", " long_name: Average precipitation during wet days (sdii)\n", " description: Annual simple daily intensity index (sdii) : annual avera..." @@ -610,7 +610,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.7" + "version": "3.8.2" } }, "nbformat": 4, diff --git a/docs/source/notebooks/finch-usage.ipynb b/docs/source/notebooks/finch-usage.ipynb index 47bf4e9d..a466a21c 100644 --- a/docs/source/notebooks/finch-usage.ipynb +++ b/docs/source/notebooks/finch-usage.ipynb @@ -54,7 +54,7 @@ " ----------\n", " tasmin : ComplexData:mimetype:`application/x-netcdf`, :mimetype:`application/x-ogc-dods`\n", " NetCDF Files or archive (tar/zip) containing netCDF files.\n", - " freq : {'YS', 'MS', 'QS-DEC', 'AS-JUL'}string\n", + " freq : string\n", " Resampling frequency\n", " \n", " Returns\n", @@ -104,7 +104,7 @@ "output_type": "stream", "text": [ "Process status: ProcessSucceeded\n", - "Link to process output: https://pavics.ouranos.ca/wpsoutputs/be502914-76b0-11ea-9d75-0800276e9ee6/frost-days_SRES-A2-experiment_20460101-20650101.nc\n" + "Link to process output: https://pavics.ouranos.ca/wpsoutputs/98bd37b6-7749-11ea-bda5-0800276e9ee6/frost-days_SRES-A2-experiment_20460101-20650101.nc\n" ] } ], @@ -228,7 +228,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.7" + "version": "3.8.2" } }, "nbformat": 4, diff --git a/environment.yml b/environment.yml index 47ef2919..e9a39128 100644 --- a/environment.yml +++ b/environment.yml @@ -14,6 +14,6 @@ dependencies: - xarray>=0.14 - sentry-sdk - siphon - - xclim>=0.15.0, <0.16 + - xclim==0.15.2 - pywps==4.2.4 - parse diff --git a/finch/processes/__init__.py b/finch/processes/__init__.py index d2d0916b..c46f6deb 100644 --- a/finch/processes/__init__.py +++ b/finch/processes/__init__.py @@ -34,14 +34,11 @@ def get_indicators(module): for i in indicators: # Todo: remove me after xclim fixes the identifier name - if i.compute.__name__ == 'hot_spell_max_length': - i.identifier = 'hot_spell_max_length' + if i.compute.__name__ == "hot_spell_max_length": + i.identifier = "hot_spell_max_length" not_implemented = [ "DC", # lat input type is not implemented and start_up_mode argument seems to be missing? - "growing_season_length", # mid_date parameter not implemented - "growing_season_end", # mid_date parameter not implemented - "last_spring_frost", # before_date parameter not implemented ] indicators = [i for i in indicators if i.identifier not in not_implemented] ensemble_indicators = [i for i in indicators if uses_accepted_netcdf_variables(i)] @@ -114,7 +111,9 @@ def _build_xclim(): processes = get_processes(all_processes=True) objs = {p.__class__.__name__: p.__class__ for p in processes} - mod = xclim.indicators.build_module("finch.processes.xclim", objs, doc="""XCLIM Processes""") + mod = xclim.indicators.build_module( + "finch.processes.xclim", objs, doc="""XCLIM Processes""" + ) sys.modules["finch.processes.xclim"] = mod return mod diff --git a/finch/processes/wps_base.py b/finch/processes/wps_base.py index 83613279..6daa3b4d 100644 --- a/finch/processes/wps_base.py +++ b/finch/processes/wps_base.py @@ -2,7 +2,6 @@ from typing import Dict, List from dask.diagnostics import ProgressBar -from dask.diagnostics.progress import format_time from pywps import ComplexInput, FORMATS, LiteralInput, Process from pywps.app.Common import Metadata from sentry_sdk import configure_scope @@ -121,9 +120,11 @@ def convert_xclim_inputs_to_pywps(params: Dict) -> List[PywpsInput]: elif name in ["thresh"]: inputs.append(make_thresh(name, attrs["default"], attrs["desc"])) elif name in ["freq"]: - inputs.append(make_freq(name, attrs["default"])) + inputs.append(make_freq(name, attrs["default"], attrs["desc"])) elif name in ["window"]: inputs.append(make_window(name, attrs["default"], attrs["desc"])) + elif name in ["mid_date", "before_date"]: + inputs.append(make_date_of_year(name, attrs["default"], attrs["desc"])) else: # raise NotImplementedError(name) LOGGER.warning("not implemented: {}".format(name)) @@ -168,6 +169,18 @@ def make_window(name, default, abstract=""): ) +def make_date_of_year(name, default, abstract=""): + return LiteralInput( + name, + "Date of the year", + abstract=abstract, + data_type="string", + min_occurs=0, + max_occurs=1, + default=default, + ) + + def make_nc_input(name): return ComplexInput( name, diff --git a/requirements.txt b/requirements.txt index e15c8d2b..9d329671 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pywps>=4.2.0<4.3 -xclim>=0.13.0 +xclim==0.15.2 geopandas jinja2 click diff --git a/tests/test_wps_xclim_indices.py b/tests/test_wps_xclim_indices.py index a6137597..16afd4c3 100644 --- a/tests/test_wps_xclim_indices.py +++ b/tests/test_wps_xclim_indices.py @@ -43,6 +43,8 @@ def test_processes(client, netcdf_datasets): literal_inputs = { "freq": "MS", "window": "3", + "mid_date": "07-01", + "before_date": "07-01", } keep_defaults = ["thresh", "thresh_tasmin", "thresh_tasmax"]