Project

General

Profile

How can we make 360 days data to 365 days using cdo ?

Added by jyoti lodha almost 6 years ago

Hi
I have a issues that my data is containing 360days and I want my data to be get converted using 365 days, not by using calendar command as it only shows the calendar changed not the increased values in data to 360 days. Can it be possible using cdo as I am having 50years of data. Please let me know how I can do this.

Thanking you

Waiting for a positive response.


Replies (7)

RE: How can we make 360 days data to 365 days using cdo ? - Added by Karin Meier-Fleischer almost 6 years ago

Your file contains 12 timesteps of monthly data using the standard calendar. Please upload a 360_days test file.

ncdump -h tasmax_AUS_GFDL-ESM2M_rcp85_r1i1p1_BOM-SDMa-NRM_v201312_mon_200601-200612.nc

netcdf tasmax_AUS_GFDL-ESM2M_rcp85_r1i1p1_BOM-SDMa-NRM_v201312_mon_200601-200612 {
dimensions:
    time = 12 ;
    lon = 886 ;
    lat = 691 ;
variables:
    int time(time) ;
        time:units = "days since 1899-12-31" ;
        time:calendar = "standard" ;
        time:axis = "T" ;
        time:long_name = "time" ;
        time:standard_name = "time" ;
    float lon(lon) ;
        lon:units = "degrees_east" ;
        lon:axis = "X" ;
        lon:long_name = "longitude" ;
        lon:standard_name = "longitude" ;
    float lat(lat) ;
        lat:units = "degrees_north" ;
        lat:axis = "Y" ;
        lat:long_name = "latitude" ;
        lat:standard_name = "latitude" ;
    float tasmax(time, lat, lon) ;
        tasmax:units = "K" ;
        tasmax:long_name = "Daily Maximum Near-Surface Air Temperature" ;
        tasmax:standard_name = "air_temperature" ;
        tasmax:comment = "monthly mean of the daily-maximum near-surface air temperature" ;
        tasmax:missing_value = 1.e+20f ;
        tasmax:_FillValue = 1.e+20f ;

// global attributes:
        :title = "Statistical Downscaling Data for GFDL-ESM2M" ;
        :source = "BoM-SDM" ;
        :inflation = "match ssnly variance" ;
        :notes = "monthly data calculated from daily downscaling data" ;
}

cdo sinfo tasmax_AUS_GFDL-ESM2M_rcp85_r1i1p1_BOM-SDMa-NRM_v201312_mon_200601-200612.nc

   File format : NetCDF
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : unknown  BoM-SDM  v instant       1   1    612226   1  F32  : -1            
   Grid coordinates :
     1 : lonlat                   : points=612226 (886x691)
                              lon : 112 to 156.25 by 0.05 degrees_east
                              lat : -44.5 to -10 by 0.05 degrees_north
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :  12 steps
     RefTime =  1899-12-31 00:00:00  Units = days  Calendar = standard
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2006-01-16 00:00:00  2006-02-16 00:00:00  2006-03-16 00:00:00  2006-04-16 00:00:00
  2006-05-16 00:00:00  2006-06-16 00:00:00  2006-07-16 00:00:00  2006-08-16 00:00:00
  2006-09-16 00:00:00  2006-10-16 00:00:00  2006-11-16 00:00:00  2006-12-16 00:00:00
cdo sinfo: Processed 1 variable over 12 timesteps ( 0.00s 20MB )

-Karin

RE: How can we make 360 days data to 365 days using cdo ? - Added by jyoti lodha almost 6 years ago

Hi
Sorry it was my mistake , I uploaded wrong data, Now it is correct. When I see into the data it contain the February month with 30 days , so all months are containing 30 days= 360 days in a year. But I want this data to contain 360days . How to interpolate the 6 days. How it can be done.

RE: How can we make 360 days data to 365 days using cdo ? - Added by Karin Meier-Fleischer almost 6 years ago

Ok, I can't see a solution with CDO but maybe I'm wrong and Uwe and Ralf can weigh in.

A workaround can be the following NCL script which reads the data and interpolate the 1800 time steps to 1825 time steps (365_day calendar).

begin     
;-- 1800 time steps; 360_day calendar => 5 years
;-- from 1951-01-01 12:00:00 to 1955-12-30 12:00:00 --> 1825 time steps; 365_day calendar

  f = addfile("tasmax_WAS-44_MOHC-HadGEM2-ES_historical_r1i1p1_SMHI-RCA4_v2_day_19510101-19551230.nc","r")
  var          = f->tasmax
  time_360     = var&time
  rlat         = f->rlat
  rlon         = f->rlon
  rotated_pole = f->rotated_pole
  lat          = f->lat
  lon          = f->lon
  height       = f->height

  time_steps               =  5*365
  time_365                 =  fspan(1,time_steps,time_steps)
  time_365!0               = "time" 
  time_365&time            =  time_365
  time_365@standard_name   = "time" 
  time_365@units           = "days since 1951-01-01 12:00:00" 
  time_365@calendar        = "365_day" 
  time_365@long_name       = "time" 
  time_365@axis            = "T" 

  tasmax_new               =  linint1_n(time_360,var,False,time_365,0,0)
  tasmax_new!0             = "time" 
  tasmax_new&time          =  time_365
  tasmax_new!1             = "rlat" 
  tasmax_new&rlat          =  rlat
  tasmax_new!2             = "rlon" 
  tasmax_new&rlon          =  rlon
  tasmax_new@grid_mapping  = "rotated_pole" 
  tasmax_new@_FillValue    =  1.0e20
  tasmax_new@missing_value =  1.0e20
  tasmax_new@standard_name = "air_temperature" 
  tasmax_new@long_name     = "Daily Maximum Near-Surface Air Temperature" 
  tasmax_new@units         = "K" 
  tasmax_new@coordinates   = "lon lat height" 
  tasmax_new@cell_methods  = "time: maximum" 
  printVarSummary(tasmax_new)

  system("rm -rf outfile_365_days_NCL.nc")
  outf = addfile("outfile_365_days_NCL.nc","c")
  outf->rlat         =  rlat
  outf->rlon         =  rlon
  outf->rotated_pole =  rotated_pole
  outf->lat          =  lat
  outf->lon          =  lon
  outf->height       =  height
  outf->tasmax       =  tasmax_new

end

cdo sinfo outfile_365_days_NCL.nc

   File format : NetCDF
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : unknown  unknown  v instant       1   1     25090   1  F32  : -1            
   Grid coordinates :
     1 : curvilinear              : points=25090 (193x130)
                              lon : 19.86421 to 115.5312 by 0.4179501 degrees_east
                              lat : -15.23163 to 45.25 by 0.4377272 degrees_north
                          mapping : rotated_latitude_longitude
                             rlon : -32.12 to 52.36 by 0.44 degrees
                             rlat : -21.56 to 35.2 by 0.44 degrees
   Vertical coordinates :
     1 : height                   : levels=1  scalar
                           height : 2 m
   Time coordinate :  1825 steps
     RefTime =  1951-01-01 12:00:00  Units = days  Calendar = 365_day
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  1951-01-02 12:00:00  1951-01-03 12:00:00  1951-01-04 12:00:00  1951-01-05 12:00:00
  1951-01-06 12:00:00  1951-01-07 12:00:00  1951-01-08 12:00:00  1951-01-09 12:00:00
  1951-01-10 12:00:00  1951-01-11 12:00:00  1951-01-12 12:00:00  1951-01-13 12:00:00
  1951-01-14 12:00:00  1951-01-15 12:00:00  1951-01-16 12:00:00  1951-01-17 12:00:00
  1951-01-18 12:00:00  1951-01-19 12:00:00  1951-01-20 12:00:00  1951-01-21 12:00:00
  1951-01-22 12:00:00  1951-01-23 12:00:00  1951-01-24 12:00:00  1951-01-25 12:00:00
  1951-01-26 12:00:00  1951-01-27 12:00:00  1951-01-28 12:00:00  1951-01-29 12:00:00
  1951-01-30 12:00:00  1951-01-31 12:00:00  1951-02-01 12:00:00  1951-02-02 12:00:00
  1951-02-03 12:00:00  1951-02-04 12:00:00  1951-02-05 12:00:00  1951-02-06 12:00:00
  1951-02-07 12:00:00  1951-02-08 12:00:00  1951-02-09 12:00:00  1951-02-10 12:00:00
  1951-02-11 12:00:00  1951-02-12 12:00:00  1951-02-13 12:00:00  1951-02-14 12:00:00
  1951-02-15 12:00:00  1951-02-16 12:00:00  1951-02-17 12:00:00  1951-02-18 12:00:00
  1951-02-19 12:00:00  1951-02-20 12:00:00  1951-02-21 12:00:00  1951-02-22 12:00:00
  1951-02-23 12:00:00  1951-02-24 12:00:00  1951-02-25 12:00:00  1951-02-26 12:00:00
  1951-02-27 12:00:00  1951-02-28 12:00:00  1951-03-01 12:00:00  1951-03-02 12:00:00
   ................................................................................
   ................................................................................
   .........
  1955-11-06 12:00:00  1955-11-07 12:00:00  1955-11-08 12:00:00  1955-11-09 12:00:00
  1955-11-10 12:00:00  1955-11-11 12:00:00  1955-11-12 12:00:00  1955-11-13 12:00:00
  1955-11-14 12:00:00  1955-11-15 12:00:00  1955-11-16 12:00:00  1955-11-17 12:00:00
  1955-11-18 12:00:00  1955-11-19 12:00:00  1955-11-20 12:00:00  1955-11-21 12:00:00
  1955-11-22 12:00:00  1955-11-23 12:00:00  1955-11-24 12:00:00  1955-11-25 12:00:00
  1955-11-26 12:00:00  1955-11-27 12:00:00  1955-11-28 12:00:00  1955-11-29 12:00:00
  1955-11-30 12:00:00  1955-12-01 12:00:00  1955-12-02 12:00:00  1955-12-03 12:00:00
  1955-12-04 12:00:00  1955-12-05 12:00:00  1955-12-06 12:00:00  1955-12-07 12:00:00
  1955-12-08 12:00:00  1955-12-09 12:00:00  1955-12-10 12:00:00  1955-12-11 12:00:00
  1955-12-12 12:00:00  1955-12-13 12:00:00  1955-12-14 12:00:00  1955-12-15 12:00:00
  1955-12-16 12:00:00  1955-12-17 12:00:00  1955-12-18 12:00:00  1955-12-19 12:00:00
  1955-12-20 12:00:00  1955-12-21 12:00:00  1955-12-22 12:00:00  1955-12-23 12:00:00
  1955-12-24 12:00:00  1955-12-25 12:00:00  1955-12-26 12:00:00  1955-12-27 12:00:00
  1955-12-28 12:00:00  1955-12-29 12:00:00  1955-12-30 12:00:00  1955-12-31 12:00:00
  1956-01-01 12:00:00
cdo sinfo: Processed 1 variable over 1825 timesteps ( 0.00s 21MB )

-Karin

RE: How can we make 360 days data to 365 days using cdo ? - Added by jyoti lodha almost 6 years ago

Hi
Thank a lot Karin.Thanks for your help I really admire it. A great work done by you. Thanks

RE: How can we make 360 days data to 365 days using cdo ? - Added by jyoti lodha almost 5 years ago

Hi
When I run this above code. I am getting my one year as NAN values and rest values were converting to 365 days. I cannot understand. As no error was generating in NCl . Please solve my issue and let me know where the correction is required. I have attached the screenshort

Waiting for positive reply

jyoti

RE: How can we make 360 days data to 365 days using cdo ? - Added by Bamidele OLORUNTOBA over 2 years ago

I was wondering if anyone has a solution to jyoti's concern about the NAN values? I know this is over two years ago and it's an NCL solution. Just in case you know what to do to make this work, please help. I used the same NCL solution for a 1-year case and it returned NAN values. Yes, a 365day calendar NetCDF was created but data was not copied into it.

    (1-7/7)