Project

General

Profile

How to mute warnings

Added by Jay Su about 5 years ago

cdo complained about
Warning (cdfScanVarAttr): Inconsistent data type for attribute time:valid_range, ignored!

How should I set not to allow this warning shown in STDOUT?

Thanks,


Replies (17)

RE: How to mute warnings - Added by Jay Su about 5 years ago

cdo v1.9.6

RE: How to mute warnings - Added by Jay Su about 5 years ago

Does it make sense to anyone? Thanks,

RE: How to mute warnings - Added by Ralf Mueller about 5 years ago

try -s option

hth
ralf

RE: How to mute warnings - Added by Jay Su about 5 years ago

Already tried -s option:

cdo -s -L -f nc4 -sellonlatbox,10.0,80.0,10.0,80.0 infile outfile

RE: How to mute warnings - Added by Jay Su almost 5 years ago

Still cant mute the warning after -s.

RE: How to mute warnings - Added by Ralf Mueller almost 5 years ago

hi!

This seems to be a serious one about inconsistent input. you can still pipe the output through a grep-based filter like

cdo -s -L -f nc4 -sellonlatbox,10.0,80.0,10.0,80.0 infile outfile | grep -v Warning

hth
ralf

RE: How to mute warnings - Added by Karin Meier-Fleischer almost 5 years ago

I agree with Ralf, warnings have their meaning. What about correcting the time attribute valid_range (or delete)?

The valid_range attribute of time has the type

time:valid_range = "time_min, time_max"

What does your time:valid_range attribute look like?

-Karin

RE: How to mute warnings - Added by Jay Su almost 5 years ago

Thank you Ralf and Karin,

cdo -s -L -f nc4 -sellonlatbox,10.0,80.0,10.0,80.0 infile outfile | grep -v Warning

Strange it's does not work. I instead used subprocess.DEVNULL to mute.

Yes,
valid_range = vmin, vmax
Do we ask the double quote, "vmin, vmax", here?

RE: How to mute warnings - Added by Karin Meier-Fleischer almost 5 years ago

You need the double quotes for setting the time attribute valid_range.

RE: How to mute warnings - Added by Paul MAUGER 9 months ago

Hello,

I tried all the solutions proposed here (-s ; | grep -v Warning ; even with | grep Warning > /dev/null 2>&1) but I keep getting warning messages printed.

Warning (cdf_set_var): Inconsistent variable definition for XLAT_U!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_U!
Warning (cdf_set_var): Inconsistent variable definition for XLAT_V!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_V!
Warning (cdf_set_var): Inconsistent variable definition for XLAT_U!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_U!
Warning (cdf_set_var): Inconsistent variable definition for XLAT_V!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_V!
Warning (cdf_read_coordinates): Time varying grids unsupported, using grid at time step 1!
Warning (cdf_read_coordinates): Time varying grids unsupported, using grid at time step 1!

I know my script works as it should and I would like to avoid them.

Thank you

RE: How to mute warnings - Added by elvish yadav 7 months ago

Warning (cdfScanVarAttr): Inconsistent data type for attribute time:valid_range, ignored!

RE: How to mute warnings - Added by Karin Meier-Fleischer 7 months ago

Try the CDO option -w.

From the docu:

-w     Disable warning messages.

RE: How to mute warnings - Added by Paul MAUGER 7 months ago

I personally get this error message : cdo: illegal option -- w
Moreover it makes the script crash. So much for that.

RE: How to mute warnings - Added by Karin Meier-Fleischer 7 months ago

Which CDO version do you use?

RE: How to mute warnings - Added by Paul MAUGER 7 months ago

Climate Data Operators version 1.9.5

Anyway, if there's an upgrade, I don't have the right on the cluster I'm working on.
That's not important. As long as my script works fine even with warnings, it's OK.

RE: How to mute warnings - Added by Estanislao Gavilan 7 months ago

Hi Paul,

that an old version. I recommend you to upgrade. You do not need to install a new cdo in your cluster. You could set a conda environment with the conda cdo version (see documentation). If you do not have the priviledges to set it, you should ask your IT servive. Once you have set it, you can use cdo as standalone or link it to the python library.

RE: How to mute warnings - Added by elvish yadav 7 months ago

I agree with Ralf, warnings have their meaning. What about correcting the time attribute valid_range (or delete)?

    (1-17/17)