Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved and completed time preprocessors list (PR 439 child 1) #508

Merged
merged 2 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 5 additions & 12 deletions esmvalcore/_recipe_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from ._data_finder import get_start_end_year
from ._task import get_flattened_tasks, which
from .preprocessor import PreprocessingTask
from .preprocessor import PreprocessingTask, TIME_PREPROCESSORS

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -131,8 +131,7 @@ def data_availability(input_files, var, dirnames, filenames):
if missing_years:
raise RecipeError(
"No input data available for years {} in files {}".format(
", ".join(str(year) for year in missing_years),
input_files))
", ".join(str(year) for year in missing_years), input_files))


def tasks_valid(tasks):
Expand All @@ -149,16 +148,10 @@ def tasks_valid(tasks):

def check_for_temporal_preprocs(profile):
"""Check for temporal operations on fx variables."""
temporal_preprocs = [
'extract_season',
'extract_month',
'annual_mean',
'seasonal_mean',
'time_average',
'regrid_time',
]
temp_preprocs = [
preproc for preproc in profile if preproc in temporal_preprocs]
preproc for preproc in profile
if profile[preproc] and preproc in TIME_PREPROCESSORS
]
if temp_preprocs:
raise RecipeError(
"Time coordinate preprocessor step(s) {} not permitted on fx "
Expand Down
14 changes: 14 additions & 0 deletions esmvalcore/preprocessor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@
'cleanup',
]

TIME_PREPROCESSORS = [
'extract_time',
'extract_season',
'extract_month',
'daily_statistics',
'monthly_statistics',
'seasonal_statistics',
'annual_statistics',
'decadal_statistics',
'climate_statistics',
'anomalies',
'regrid_time',
]

DEFAULT_ORDER = tuple(__all__)

# The order of initial and final steps cannot be configured
Expand Down