Skip to content
Snippets Groups Projects
Commit 389897da authored by Oriol Tintó's avatar Oriol Tintó
Browse files

Adding warning when the analyzer falls back to lossless compression due to NaNs.

parent 7d8a2c33
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,8 @@ def analyze_data_array(data_array: xarray.DataArray, options: AnalysisOptions) - ...@@ -45,6 +45,8 @@ def analyze_data_array(data_array: xarray.DataArray, options: AnalysisOptions) -
# Check if the array contains any nan # Check if the array contains any nan
contains_nan = np.isnan(data_array.values).any() contains_nan = np.isnan(data_array.values).any()
if contains_nan: if contains_nan:
logging.warning(f"The variable {data_array.name!r} contains NaN. Falling to 'lossless'.\n"
"It is possible to prevent that replacing the NaN values using the parameter --fill-na")
return "lossless", {**{COMPRESSION_RATIO_LABEL: 1.0}, **{met: 0. for met in ANALYSIS_DIAGNOSTIC_METRICS}} return "lossless", {**{COMPRESSION_RATIO_LABEL: 1.0}, **{met: 0. for met in ANALYSIS_DIAGNOSTIC_METRICS}}
# Define the functions that will be used to find optimal parameters # Define the functions that will be used to find optimal parameters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment