<p>You can multiply all the values by -1</p>

<pre><code>cdo mulc,-1 infile.nc outfile.nc
</code></pre>

<p>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 <a href="https://code.mpimet.mpg.de/boards/1/topics/2484" rel="nofollow noreferrer">this</a></p>

<pre><code>cdo setrtoc,0,9999,0 ifile.nc ofile.nc
</code></pre>

<p>Hope this helps</p>

CC BY-SA 4.0
2019-11-22T13:05:28.170Z
2019-11-28T18:32:26.907Z
2019-11-28T18:32:26.907Z
Nemesi
<p>We are missing some information about the ERA5 data. Do you have it in grib2 or netcdf format? Nevertheless, take a look at the <a href="https://code.mpimet.mpg.de/projects/cdo/embedded/index.html" rel="nofollow noreferrer">documentation</a>. You can do it with cdo's <code>abs</code> command. It would be something like this:</p>

<pre><code>cdo expr,absPET="abs(PET)" -mergetime infile1 infile2 infile3 outputfile
</code></pre>

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

CC BY-SA 4.0
2019-11-22T12:52:25.543Z
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
CC BY-SA 4.0
2019-11-22T15:01:45.590Z
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
CC BY-SA 4.0
2019-11-22T09:34:18.647Z
2019-11-22T09:34:18.647Z
Whir
<p>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  </p>

CC BY-SA 4.0
2019-11-24T21:02:32.373Z
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
CC BY-SA 4.0
2019-11-28T18:34:52.303Z
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
<climate>
How can I convert the negative values of the ERA5 PET data into positive?
Mekonnen Adnew degefu
# How can I convert the negative values of the ERA5 PET data into positive?

(Asked by: username_0 on 2019-11-21)

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!
username_0

**Tags:** climate

> **Comments:**
> **username_0**: Thank you username_1, 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.                                                                                                            username_0  
> **username_1**: Hi username_0, If my reply helped you, please, accept it, so that remains as the "fix" for issues similar to yours for other operators. Thanks  

---

## 2 answers

### Answer by username_1 on 2019-11-22. Score: 2

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](https://code.mpimet.mpg.de/boards/1/topics/2484)

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

```

Hope this helps


---

### Answer by username_2 on 2019-11-22. Score: 0

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](https://code.mpimet.mpg.de/projects/cdo/embedded/index.html). 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()`.

> **Comments:**
> **username_1**: 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.  
> **username_2**: 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 @username_1 solution instead.  

---

