Project

General

Profile

Changing units and values Precipitation and temperature

Added by Jeisson Javier Leal Rojas about 1 year ago

Hi.

I just want to check if the steps I will show are correct or not.

I want to convert temperature in Kelvin to Celsious, as well as changing the units from K to degC.
Same goes for precipitation. Precipitation is given in kg m-2 s-1 and I want it in mm/day, as well as changing units.

This is what I've done

1) For temperature:

cdo subc, 273.15 input.nc output.nc
cdo -setattribute,temp@units=degC output.nc final_output.nc

2) For Precipitation:

cdo mulc, 86400 input.nc output.nc
cdo -setattribute,pre@units=mm/day output.nc final_output.nc

I think what I am doing is ok. However, I would like to ask if there are other simpler or shorter way to do it, or if I am wrong somehow.

Regards,

Jeisson Leal.


Replies (3)

RE: Changing units and values Precipitation and temperature - Added by Karin Meier-Fleischer about 1 year ago

You can use the operator chaining:

1) e.g. for temperature variable 'temp'

cdo -setattribute,temp@units="degC" -subc,273.15 -selname,temp input.nc temp_output.nc

2) e.g. for precipitation variable 'pre'

cdo -setattribute,pre@units="mm/day" -mulc,86400 input.nc pre_output.nc

RE: Changing units and values Precipitation and temperature - Added by Jeisson Javier Leal Rojas about 1 year ago

Why is it different from each one? I mean for temperature `-selname` is used, but not for precipitation

RE: Changing units and values Precipitation and temperature - Added by Karin Meier-Fleischer about 1 year ago

Sorry, I forgot to explain. If a data file contains only one data variable you do not need to use -selname,variable but if there are multiple variables the computation like for -mulc,86400 or -subc,273.15 would be executed for each data variable in the file.

    (1-3/3)