Skip to content

Commit

Permalink
Replace deprecated alias A with Y
Browse files Browse the repository at this point in the history
  • Loading branch information
saschahofmann committed Sep 19, 2024
1 parent f22dad0 commit 9440e0b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions tests/test_indicators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# pylint: disable=unsubscriptable-object,function-redefined
# Tests for the Indicator objects
from __future__ import annotations

import gc
import json
from inspect import signature
Expand Down Expand Up @@ -885,6 +884,6 @@ def test_freq_doc():
from xclim import atmos

doc = atmos.latitude_temperature_index.__doc__
allowed_periods = ["A"]
allowed_periods = ["Y"]
exp = f"Restricted to frequencies equivalent to one of {allowed_periods}"
assert exp in doc
7 changes: 3 additions & 4 deletions xclim/core/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
"""

from __future__ import annotations

import re
import warnings
import weakref
Expand All @@ -109,9 +108,8 @@
from dataclasses import asdict, dataclass
from functools import reduce
from inspect import Parameter as _Parameter
from inspect import Signature
from inspect import Signature, signature
from inspect import _empty as _empty_default # noqa
from inspect import signature
from os import PathLike
from pathlib import Path
from types import ModuleType
Expand Down Expand Up @@ -167,6 +165,7 @@
load_module,
)


# Indicators registry
registry = {} # Main class registry
base_registry = {}
Expand Down Expand Up @@ -1495,7 +1494,7 @@ class ResamplingIndicator(CheckMissingIndicator):
If None, this will be determined by the global configuration.
allowed_periods : Sequence[str], optional
A list of allowed periods, i.e. base parts of the `freq` parameter.
For example, indicators meant to be computed annually only will have `allowed_periods=["A"]`.
For example, indicators meant to be computed annually only will have `allowed_periods=["Y"]`.
`None` means "any period" or that the indicator doesn't take a `freq` argument.
"""

Expand Down
3 changes: 1 addition & 2 deletions xclim/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""

from __future__ import annotations

import functools
import importlib.util
import logging
Expand All @@ -24,6 +23,7 @@
from dask import array as dsk
from yaml import safe_dump, safe_load


logger = logging.getLogger("xclim")


Expand Down Expand Up @@ -578,7 +578,6 @@ def adapt_clix_meta_yaml( # noqa: C901
"""Read in a clix-meta yaml representation and refactor it to fit xclim's yaml specifications."""
from ..indices import generic # pylint: disable=import-outside-toplevel

# freq_names = {"annual": "A", "seasonal": "Q", "monthly": "M", "weekly": "W"}
freq_defs = {"annual": "YS", "seasonal": "QS-DEC", "monthly": "MS", "weekly": "W"}

if isinstance(raw, os.PathLike):
Expand Down
7 changes: 4 additions & 3 deletions xclim/indicators/atmos/_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from xclim.core.indicator import Daily, Indicator, ResamplingIndicatorWithIndexing
from xclim.core.utils import InputKind


__all__ = [
"australian_hardiness_zones",
"biologically_effective_degree_days",
Expand Down Expand Up @@ -1383,7 +1384,7 @@ def cfcheck(self, tas, snd=None):
"Mean temperature of warmest month multiplied by the difference of latitude factor coefficient minus latitude. "
"Metric originally published in Jackson, D. I., & Cherry, N. J. (1988).",
cell_methods="",
allowed_periods=["A"],
allowed_periods=["Y"],
var_name="lti",
compute=indices.latitude_temperature_index,
parameters={"lat": {"kind": InputKind.VARIABLE}, "lat_factor": 60},
Expand Down Expand Up @@ -1419,7 +1420,7 @@ def cfcheck(self, tas, snd=None):
"Botanical Gardens (ANBG) classification scheme divides categories into 5-degree Celsius zones, starting from -15 "
"degrees Celsius and ending at 20 degrees Celsius.",
cell_methods="",
allowed_periods=["A"],
allowed_periods=["Y"],
var_name="hz",
compute=indices.hardiness_zones,
parameters={"method": "anbg"},
Expand All @@ -1440,7 +1441,7 @@ def cfcheck(self, tas, snd=None):
"scheme divides categories into 10 degree Fahrenheit zones, with 5-degree Fahrenheit half-zones, "
"starting from -65 degrees Fahrenheit and ending at 65 degrees Fahrenheit.",
cell_methods="",
allowed_periods=["A"],
allowed_periods=["Y"],
var_name="hz",
compute=indices.hardiness_zones,
parameters={"method": "usda"},
Expand Down

0 comments on commit 9440e0b

Please sign in to comment.