Project

General

Profile

Using expr with variables in different files

Added by Gabe Bromley about 4 years ago

Hello,

I am working with Daymet files. Tmax and Tmin are given in different files. I tried to merge them and 24g of (what I assume was compressed netcdf files) turned to over 600G. Not really feasible to merge them I think if the output file is that big. I want to create a Tmean i.e. (Tmax+Tmin)/2, can I do this using expr and having the variables in different files?

Thanks,

Gabe


Replies (2)

RE: Using expr with variables in different files - Added by Brendan DeTracey about 4 years ago

If the merged file was that big it just means you did not have compression turned on for the output(https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-70001.2.1). Try adding -z zip_7 to the cdo options on your command line i.e. it goes before your commands. If you could upload a sample of the first time step of each file (cdo -z zip_7 timestep,0 infile outfile) it would be helpful. Also, you do not need to merge the files to get the average. You can chain operators renaming the input variables before averaging. Provide single time step samples and I will take a stab.

RE: Using expr with variables in different files - Added by Karin Meier-Fleischer about 4 years ago

You don't need to merge the file to compute (Tmax+Tmin)/2.

cdo -divc,2 -add Tmax.nc Tmin.nc Tmean.nc
    (1-2/2)