<html><head><style>body{font-family:Calibri,Arial;font-size:13px}</style></head><body style="word-wrap:break-word;line-break:after-white-space"><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Thanks Dennis for pointing this out. Much grateful.</div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">I have been able to resolve this and getting the right time variable.</div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">What I did was to reset the time axis with cdo and then proceed to use the ‘calendar_convert_360_to_365_date’ function.</div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Best regards</div><div id="bloop_customfont" style="font-family:Calibri,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Kwesi</div> <br><p class="airmail_on">On 25 September 2019 at 03:37:35, Dennis Shea (<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>


<title></title>


<div dir="ltr">
<div dir="ltr">The issue is <b>NOT</b> with the
'calendar_convert_360_to_365_date' function.<br>
Rather, the source file's 'time' variable is NOT properly formed.
For a 360_day<br>
calendar all months have 30-days [ 12*30=360  :-) ]. This
includes February.<br>
The following look correct/similar:<br>
<br>
A: Correct 360_day<br>
zg700_day_HadGEM2-ES_rcp85_r1i1p1_19810101-20141231_360day.nc
   <====  Correct 360_day<br>
<br>
        double time(time) ;<br>
               
[snip]<br>
                time:units
= "days since 1859-12-01" ;<br>
               
time:calendar = "360_day" ;<br>
<br>
B: Incorrect 360_day   ... generically looks the same but
the time is wrong<br>
zg700_day_HadGEM2-ES_historical_rcp85_r1i1p1_SMHI-RCA4_19800101-20131231_norm.nc
<=== Incorrect 360_day<br>
<br>
        double time(time) ;<br>
               
[snip]<br>
                time:units
= "days since 1949-12-1 00:00:00" ;<br>
               
time:calendar = "360_day" ;</div>
<div dir="ltr"><br></div>
<div dir="ltr">====================<br>
<br>
<br>
  diri = "./"<br>
  fila =
"zg700_day_HadGEM2-ES_rcp85_r1i1p1_19810101-20141231_360day.nc"<br>

  ptha = diri+fila<br>
  fa   = addfile(ptha,"r")<br>
<br>
  filb =
"zg700_day_HadGEM2-ES_historical_rcp85_r1i1p1_SMHI-RCA4_19800101-20131231_norm.nc"<br>

  pthb = diri+filb<br>
  fb   = addfile(pthb,"r")<br>
<br>
  time360a = fa->time<br>
  YMDH360a = cd_calendar(time360a,-3)<br>
<br>
  time360b = fb->time<br>
  YMDH360b = cd_calendar(time360b,-3)<br>
  print("A: "+time360a+"  "+YMDH360a+"  ; B:
"+time360b+"  "+YMDH360b)<br>
======================<br>
<br>
The 'time360a' and 'time360b' are numerically different due to
different<br>
reference dates. However, successive time steps should be separated
by one-day [ 1.0 ]</div>
<div>for the original 'time' variable.</div>
<div><br></div>
<div>The "B" file is separated by 2.0 in leap years and 3.0 in
non-leap years.</div>
<div><br></div>
<div dir="ltr"><br></div>
<div dir="ltr"><br>
[SNIP]<br>
(56)    A: 43646.5  1981022712  ; B: 10886.5
 1980022712<br>
(57)    A: 43647.5  1981022812  ; B: 10887.5
 1980022812<br>
(58)    A: 43648.5  1981022912  ; B: 10888.5
 1980022912    should be followed by<br>
                 
                 
                 
   
                                     
1981023012<br>
(59)    A: 43649.5  1981023012  ; B: 10890.5
 1980030112    1980030112 repeated twice<br>
(60)    A: 43650.5  1981030112  ; B: 10890.5
 1980030112<br>
(61)    A: 43651.5  1981030212  ; B: 10891.5
 1980030212<br>
(62)    A: 43652.5  1981030312  ; B: 10892.5
 1980030312<br>
[SNIP]<br>
(413)   A: 44003.5  1982022412  ; B: 11243.5
 1981022412<br>
(414)   A: 44004.5  1982022512  ; B: 11244.5
 1981022512<br>
(415)   A: 44005.5  1982022612  ; B: 11245.5
 1981022612<br>
(416)   A: 44006.5  1982022712  ; B: 11246.5
 1981022712<br>
(417)   A: 44007.5  1982022812  ; B: 11247.5
 1981022812    should be followed<br>
                 
                 
                 
      1981022912<br>
                 
                 
                 
      1981023012<br>
                 
                 
                 
      The following two-day sequence<br>
(418)   A: 44008.5  1982022912  ; B: 11250.5
 1981030112    <=== twice repeated<br>
(419)   A: 44009.5  1982023012  ; B: 11251.5
 1981030212    <===<br>
(420)   A: 44010.5  1982030112  ; B: 11250.5
 1981030112    <===<br>
(421)   A: 44011.5  1982030212  ; B: 11251.5
 1981030212    <===</div>
<div>[SNIP]</div>
<div><br></div>
<div>=====</div>
<div><b>%> ncl</b> hadgem.calendar_compare.ncl</div>
<div dir="ltr"><br></div>
<div>Good luck</div>
<div><br></div>
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Sep 23, 2019 at 9:40 PM
Kwesi A. Quagraine via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>>
wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;">
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">Dear NCLers, </div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">Apologies for revisiting this again. </div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">I am using
the calendar_convert_360_to_365_date.ncl script provided
earlier by Denis, to convert a 360 day calendar to 365 day standard
calendar. However I get this error below;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:Subscript out of range, error in subscript
#0</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:An error occurred reading it360</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:["Execute.c":8637]:Execute: Error occurred at or
near line 161 in file ./calendar_convert_360_to_365_date.ncl</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:["Execute.c":8637]:Execute: Error occurred at or
near line 27 in file hadgem_360_365.ncl</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:Variable (zg365) is undefined</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:["Execute.c":8637]:Execute: Error occurred at or
near line 29 in file hadgem_360_365.ncl</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:Variable (zg365) is undefined</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:["Execute.c":8637]:Execute: Error occurred at or
near line 30 in file hadgem_360_365.ncl</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:["Execute.c":8637]:Execute: Error occurred at or
near line 31 in file hadgem_360_365.ncl</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">(0) ==================</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:Variable (zg365) is undefined</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">fatal:["Execute.c":8637]:Execute: Error occurred at or
near line 65 in file hadgem_360_365.ncl</div>
</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">I am not sure what is happening there since the loop
that is being iterated through uses the correct loop structure in
NCL;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">======</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">do nt=0,nitime-1</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">       
 x365(it360(nt),:,:,:) = x360(it365(nt),:,:,:)</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">      end do</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">  end if</div>
</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">======</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">I will be grateful for any help on this. I have
attached my file and the calendar convert file I am using.</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">Warm regards</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">Kwesi</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">(ncl_notebook) kwesi@maggie:~/terra/cordex$ ncl
-V</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">6.6.2</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">(ncl_notebook) kwesi@maggie:~/terra/cordex$ conda
--version</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">conda 4.3.30</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">(ncl_notebook) kwesi@maggie:~/terra/cordex$ env | grep
NCARG</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">OLD_NCARG_ROOT=/share/apps/ncl-6.2.1</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">
NCARG_ROOT=/home/kwesi/miniconda3/envs/ncl_notebook</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">ncdump file gives;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px"><br></div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">netcdf
zg700_day_HadGEM2-ES_historical_rcp85_r1i1p1_SMHI-RCA4_19800101-20131231_norm
{</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">dimensions:</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        lon = 91 ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        lat = 103 ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        plev = 1 ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        time = UNLIMITED ; //
(12240 currently)</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        bnds = 2 ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">variables:</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        double lon(lon) ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lon:standard_name = "longitude" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lon:long_name = "longitude" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lon:units = "degrees_east" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lon:axis = "X" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        double lat(lat) ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lat:standard_name = "latitude" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lat:long_name = "latitude" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lat:units = "degrees_north" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  lat:axis = "Y" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        double plev(plev) ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  plev:standard_name = "air_pressure" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  plev:long_name = "pressure" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  plev:units = "Pa" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  plev:positive = "down" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  plev:axis = "Z" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        double time(time) ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  time:standard_name = "time" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  time:long_name = "time" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  time:bounds = "time_bnds" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  time:units = "days since <a href="http://airmail.calendar/1949-12-01%2000:00:00%20GMT+2" target="_blank">1949-12-1 00:00:00</a>" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  time:calendar = "360_day" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  time:axis = "T" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        double time_bnds(time,
bnds) ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">        float zg(time, plev, lat,
lon) ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  zg:standard_name = "geopotential_height" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  zg:long_name = "Geopotential Height" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  zg:units = "m" ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  zg:_FillValue = 1.e+20f ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  zg:missing_value = 1.e+20f ;</div>
<div id="gmail-m_-4996730799396410041bloop_customfont" style="margin:0px">             
  zg:cell_methods = "time: mean" ;</div>
</div>
</div>
</div>
<br style="font-family:"helvetica Neue",helvetica;font-size:14px">

<div id="gmail-m_-4996730799396410041bloop_sign_1569271952225879040" class="gmail-m_-4996730799396410041bloop_sign" style="font-family:"helvetica Neue",helvetica;font-size:14px">
<div style="font-family:helvetica,arial;font-size:13px">
----------- <br>
Try not to become a man of success but rather a man of value-
Albert Einstein</div>
<div><font face="Helvetica"><span style="font-size:12px"><br></span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Kwesi A.
Quagraine</span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Climate
System Analysis Group (CSAG)</span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Environmental and Geographical ScIence
(EGS)</span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">University
of Cape Town</span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Private
Bag, Rondebosch, 7701</span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">South
Africa</span></font></div>
<div><font face="Helvetica"><span style="font-size:12px"><br></span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Alt.
Email: <a href="mailto:starskykwesi@gmail.com" target="_blank">starskykwesi@gmail.com</a> </span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Web: <a href="http://www.csag.uct.ac.za/" target="_blank">http://www.csag.uct.ac.za</a> <br></span></font>
<div><font face="Helvetica"><span style="font-size:12px">Office: <a>+27 21 650
3164</a></span></font></div>
<div><font face="Helvetica"><span style="font-size:12px">Skype:
quagraine_cwasi</span></font></div>
</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</div>


</div></div></span></blockquote> <div id="bloop_sign_1569399535293543936" class="bloop_sign"><font face="helvetica, arial">------------ </font><br><div style="font-family:helvetica,arial;font-size:13px">Try not to become a man of success but rather a man of value- Albert Einstein</div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px"><br></span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Kwesi A. Quagraine</span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Department of Physics</span></font></div><div><font face="Helvetica"><span style="font-size:12px">School of Physical Sciences</span></font></div><div><font face="Helvetica"><span style="font-size:12px">College of Agriculture and Natural Sciences</span></font></div><div><font face="Helvetica"><span style="font-size:12px">University of Cape Coast</span></font></div><div><font face="Helvetica"><span style="font-size:12px">Cape Coast, Ghana</span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px"><br></span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Alt. Email: <a href="mailto:kwesi@csag.uct.ac.za">kwesi@csag.uct.ac.za</a> </span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Web: <a href="http://www.recycleupghana.org/">http://www.recycleupghana.org/</a> <br></span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Office: +27 21 650 3164</span></font></div><div><font face="Helvetica"><span style="font-size:12px">Skype: quagraine_cwasi</span></font></div></div></body></html>