0

I'm complete beginner with Cywing and CDO, which both have been installed in Windows 10. I'm working with 3 variables from ERA 5 Land hourly data: 2m temperature, total precipitation and runoff. Some facts about these vars:

  • three variables are in netCDF format.
  • 2m temperature: contains hourly values and its units are in Kelvin.
  • total precipitation and runoff: contains hourly values and their units are depth in metres.

I want to obtain daily anomalies of 2017 arising from 30-year period (1981-2010). This post gave me a general idea what to do but I'm not pretty sure how to replicate. Intuitively, I think this would be the setps:

  1. Convert units according to each var (e.g. K to C for 2m temperature, metres to mm for total precipitation)
  2. Convert data from hourly to daily values
  3. Obtain mean values for 2017 data and 1981-2010 data
  4. Substract: 30-year mean values minus 2017 mean value
  5. Download the file containing 2017 anomalies

Not sure about the order of procedures.

What the coding would be like in Cygwin terminal?

Brian
  • 89
  • 1
  • 10

1 Answers1

3

before you start I would recommend strongly to abandon cygwin and install the linux subsystem under windows (i.e. not parallel boot), if you do a quick search you will see that it is very easy to install ubuntu directly within windows itself, that way you can open a linux terminal and easily install anything you want with sudo apt install , e.g.

sudo apt install cdo 

Once you have done that to answer some of your questions:

  1. Convert units according to each var (e.g. K to C for 2m temperature, metres to mm for total precipitation)

e.g. to convert temperature:

cdo subc,273.15 in.nc out.nc   

similar for rain using mulc [recall that this doesn't change the metadata "units", you need to use nco for that]

  1. Convert data from hourly to daily values

for instantaneous fields like temperature

cdo daysum in.nc daymean.nc 

for flux field (like rain)

cdo daymean -shifttime,-1hour in.nc raindaymean.nc 
  1. Obtain mean values for 2017 data and 1981-2010 data.

    cdo selyear,2017 -yearmean in.nc year2017_anom.nc

  2. Substract: 30-year mean values minus 2017 mean value

Erm, usually you want to do this the other way round no? 2017-long term mean, so you can see if it is warmer or cooler?

cdo sub year2017_anom.nc -timmean alldata_daymean.nc
  1. Download the file containing 2017 anomalies

    I don't understand this question, haven't you already downloaded the hourly data from the CDS platform ? This question only makes sense if you are using the CDS toolbox, which doesn't seem to be the case - anyway, for the downloading step, if this is not clear then you can take a look at my video on this topic on my youtube channel here: https://www.youtube.com/watch?v=AXG97K6NYD8&t=469s

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
  • Thank you for the extended answer. I'll try what you suggested. I have a doubt about what do you mean with "not parallel boot". Are there many ways to install Ubuntu? – Brian May 28 '21 at 19:53
  • 1
    in the past one would partition the disk, and then set up linux and windows separately. When you booted the machine you are given a choice which operating system to boot, essentially two separate systems on one machine - those days are past thank goodness, now you can set up linux directly within win10 - there are loads of guides how to do this, here is one https://www.windowscentral.com/install-windows-subsystem-linux-windows-10 - much better than cygwin as the software is right up to date of course and everything is available, not just a subset of software supported in cygwin. – ClimateUnboxed May 29 '21 at 20:22
  • I downloaded WSL and I'm amazed about the fast timing to simply read a netcdf file in Ubuntu than in Jupyter-Python. I replicated the codes but I have some doubts. First, if I want to convert metres to milimetres, the codes would be like "cdo mulc,1000 inp.nc out.nc"? Second, from the data description of ERA5 land hourly, I understood that "total precipitation" is an accumulated measure per hour. Your code "cdo daymean -shifttime,-1hour in.nc raindaymean.nc" is trying to obtain an average instead of a cumulative sum, isn't it? I want to obtain daily cumulative values for total precipitation. – Brian Jun 01 '21 at 03:28
  • hi there, yes for the mulc to convert to mm - and yes also that you should use daysum and not daymean, I always make that mistake! I corrected my answer. Glad you found it useful... :-) – ClimateUnboxed Jun 01 '21 at 06:41
  • More questions. So to make it clear, the code for converting hourly to daily values for temperature is "cdo daymean -shifttime,-1hour in.nc tempdaymean.nc " and for precipitation is "cdo daysum in.nc raindaysum.nc ", are these correct? (or I misunderstood something) – Brian Jun 01 '21 at 16:19
  • Suppose I changed temperature hourly data for a 30-year (1981-2010) period: convert Kelvin to Celsius, and then hourly to daily values. With this new dataset, I want to obtain daily anomalies. With "cdo selyear,2017 -yearmean in.nc year2017_anom.nc" I figure out that you're working with the 30-year data (t2m30year.nc) as an input (you called as in.nc) and you select specifically 2017 using selyear,2017 but with -yearmean you want to obtain a single value which is annual. If I want daily anomalies, the code would be like "cdo selyear,2017 -daymean t2m30year.nc 2017_day_anom.nc"? – Brian Jun 01 '21 at 16:43
  • no for yearly anomalies you need to subtract the year averages from the long term mean (timmean) - so you would need cdo sub -yearmean temp_daily.nc -timmean temp_daily.nc temp_year_anom.nc - this would give you all the years' anomaly, you can select the specific year you want from that with selyear,XXXX - I am adding new videos on this on my youtube channel climate unboxed. The one on the temporal stats will be posted this week, hopefully by Friday, check it out and subscribe, I'm adding videos on all these issues you are asking and hopefully it will be clearer. – ClimateUnboxed Jun 01 '21 at 20:19
  • 1
    If you still have doubts, you can go to watch a recent [video] (https://www.youtube.com/watch?v=pD1r12pklEo) from Adrian Tompkins that gives more information to clarify this topic and coding using ERA5 data. Thanks Adrian! – Brian Jun 14 '21 at 04:42
  • I'm glad you find them useful, trying to upload more material whenever I find the time... – ClimateUnboxed Jun 14 '21 at 16:01