# How can I convert the negative values of the ERA5 PET data into positive?

I planned to use the ERA5 Potential evapotranspiration data for drought analsysis (SPEI), however values are presented in negative number. Of course I understand the logic for presenting PET negative. But, I want to convert it into positive and I should all the PET data positive. I knowledge those who help me to change the negative value in to positive. I am using cdo for data processing. Thank you! Mekonnen Adnew Degefu

• Thank you Nemesi, it works. First I multiply by -1 but I use as follow: cdo -b 32 mulc,-1 infile.nc outfile.nc then to remove the condensation data which become negative in the outfile.nc, I used the following I suggested: cdo setrtoc,-1.e99,0,0 infile.nc outfile.nc Thank you very much. Mekonnen Adnew Degefu – Mekonnen Adnew degefu Nov 24 '19 at 21:02
• Hi Mekonnen, If my reply helped you, please, accept it, so that remains as the "fix" for issues similar to yours for other operators. Thanks – Nemesi Nov 28 '19 at 18:34

You can multiply all the values by -1

cdo mulc,-1 infile.nc outfile.nc


If you want also to get rid of the condensation data (and, please, note that I am not implying that that is the right thing to do), you can do something like this

cdo setrtoc,0,9999,0 ifile.nc ofile.nc


Hope this helps

We are missing some information about the ERA5 data. Do you have it in grib2 or netcdf format? Nevertheless, take a look at the documentation. You can do it with cdo's abs command. It would be something like this:

cdo expr,absPET="abs(PET)" -mergetime infile1 infile2 infile3 outputfile


which makes a new variable absPET in the output file. expr makes it possible to evaluate expressions, like abs().

• if you take the absolute value you lose the distinction between evapotranspiration and condensation. In fact: "The ECMWF Integrated Forecasting System convention is that downward fluxes are positive. Therefore, negative values indicate evaporation and positive values indicate condensation" better multiply all the values by -1. Then if you want you can change all "condensation" values (now negative) with zero or NA. – Nemesi Nov 22 '19 at 12:52
• I was not aware that condensation was included in what OP calls PET and since it was asked how to make all the values positive, it would be fine. With this info please see @Nemesi solution instead. – Whir Nov 22 '19 at 15:01