Skip to content

Commit

Permalink
Insufficient cov details - timeout_cleanup by default
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Oct 18, 2022
1 parent be436d7 commit 710a4f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions xscen/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,9 +1070,10 @@ def _subset_file_coverage(
or guessed_nb_hrs_sum.nanos / period_nb_hrs.nanos < coverage
):
logging.warning(
f"{df['id'].iloc[0] + ': ' if 'id' in df.columns else ''}Insufficient coverage "
f"({guessed_nb_hrs / period_nb_hrs}, {len(df[files_in_range])}, "
f"{guessed_nb_hrs_sum.nanos / period_nb_hrs.nanos}."
f"{df['id'].iloc[0] + ': ' if 'id' in df.columns else ''}Insufficient coverage."
f"% covered, min to max : {guessed_nb_hrs / period_nb_hrs:.1%}, "
f"% covered, sum of hours : {guessed_nb_hrs_sum.nanos / period_nb_hrs.nanos:.1%}, "
f"number of files in range : {len(df[files_in_range])}."
)
return pd.DataFrame(columns=df.columns)

Expand Down
6 changes: 3 additions & 3 deletions xscen/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from xclim.core.calendar import get_calendar

from .config import parse_config
from .scripting import TimeoutException, timeout
from .scripting import TimeoutException
from .utils import translate_time_chunk

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -359,7 +359,7 @@ def save_to_zarr(
encoding: dict = None,
mode: str = "f",
itervar: bool = False,
timeout_cleanup: bool = False,
timeout_cleanup: bool = True,
) -> None:
"""
Saves a Dataset to Zarr, rechunking if requested.
Expand Down Expand Up @@ -388,7 +388,7 @@ def save_to_zarr(
If True, (data) variables are written one at a time, appending to the zarr.
If False, this function computes, no matter what was passed to kwargs.
timeout_cleanup : bool
If True and a :py:class:`xscen.scripting.TimeoutException` is raised during the writing,
If True (default) and a :py:class:`xscen.scripting.TimeoutException` is raised during the writing,
the variable being written is removed from the dataset as it is incomplete.
This does nothing if `compute` is False.
Expand Down

0 comments on commit 710a4f0

Please sign in to comment.