Skip to content

Commit

Permalink
Replace warning suppression in crop_gribs worker (#277)
Browse files Browse the repository at this point in the history
The 'warnings' module import and its associated catch-block have been removed
from crop_gribs.py. Instead, a 'no_warn' argument has been added directly to the
'to_grib()' function call. This results in a cleaner, more efficient, and more
direct way to suppress warnings within the specific context.
  • Loading branch information
douglatornell authored Jun 19, 2024
1 parent 1dc149f commit f191688
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions nowcast/workers/crop_gribs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import logging
import os
import warnings
from pathlib import Path

import arrow
Expand Down Expand Up @@ -271,9 +270,7 @@ def _xarray_to_grib(ssc_ds, ssc_grib_file):
:param :py:class:`xarray.Dataset` ssc_ds:
:param :py:class:`pathlib.Path` ssc_grib_file:
"""
with warnings.catch_warnings():
warnings.simplefilter("ignore")
xarray_to_grib.to_grib(ssc_ds, ssc_grib_file)
xarray_to_grib.to_grib(ssc_ds, ssc_grib_file, no_warn=True)


def _handle_stalled_observer(eccc_grib_files, fcst_hr, config):
Expand Down

0 comments on commit f191688

Please sign in to comment.