<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span class="smartReply" style="font-size: 11pt; font-family: Calibri, Helvetica, sans-serif; color: rgb(51, 51, 51);">Yes, exactly. </span></div>
<span style="color: rgb(51, 51, 51); font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; background-color: rgb(255, 255, 255); display: inline !important;">When multiple obs at the same grid point, the obs are summed, and the time of day can be averaged.</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><span style="background-color: rgb(255, 255, 255); display: inline !important; font-size: 11pt; font-family: Calibri, Helvetica, sans-serif; color: rgb(51, 51, 51);">A
 single grid with all obs combined for the whole day, and a second grid with time of day
</span><span style="background-color: rgb(255, 255, 255); display: inline !important; font-size: 11pt; font-family: Calibri, Helvetica, sans-serif; color: rgb(51, 51, 51);">corresponding to each cell of lat and lon.</span><span style="background-color:rgb(255, 255, 255);display:inline !important"><span style="color:rgb(0, 0, 0);font-family:Roboto, RobotoDraft, Helvetica, Arial, sans-serif;font-size:24px;background-color:rgb(210, 227, 252);display:inline !important"></span></span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><span style="background-color:rgb(255, 255, 255);display:inline !important"><span class="VIiyi" lang="en" style="display:inline;color:rgb(0, 0, 0);font-family:Roboto, RobotoDraft, Helvetica, Arial, sans-serif;font-size:24px;background-color:rgb(245, 245, 245)"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="pt" data-phrase-index="0" style="cursor:pointer;background-color:rgb(210, 227, 252)"><span></span></span></span></span><span style="background-color: rgb(255, 255, 255); display: inline !important; font-size: 11pt; font-family: Calibri, Helvetica, sans-serif; color: rgb(51, 51, 51);">This
 is what I'm trying to get</span><span style="background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><span style="background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><span style="background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Dave Allured - NOAA Affiliate <dave.allured@noaa.gov><br>
<b>Enviado:</b> quarta-feira, 13 de janeiro de 2021 15:42<br>
<b>Para:</b> Vanúcia Schumacher <vanucia-schumacher@hotmail.com><br>
<b>Cc:</b> ncl-talk@ucar.edu <ncl-talk@ucar.edu><br>
<b>Assunto:</b> Re: [ncl-talk] Adding time coordinate</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>So you want two grids total?   A single grid with all obs combined for the whole day, and a second grid with time of day?</div>
<div><br>
</div>
<div>When there are multiple obs at the same grid point, the obs are summed, and the time of day is averaged?</div>
<div><br>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Wed, Jan 13, 2021 at 10:23 AM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com">vanucia-schumacher@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt; font-family:Calibri,Helvetica,sans-serif">About the data, is correct:</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<div style="margin:0px; font-size:15px; color:rgb(32,31,30); background-color:rgb(255,255,255)">
<span style="font-size:11pt; font-family:Calibri,Helvetica,sans-serif">yyyy-mm-dd </span><span style="color:rgb(32,31,30); font-family:Calibri,Helvetica,sans-serif; font-size:11pt"> hh:mn:sc  (</span><span style="color:rgb(32,31,30); font-family:Calibri,Helvetica,sans-serif; font-size:11pt">fractional
 part of the second)</span><span style="color:rgb(32,31,30); font-family:Calibri,Helvetica,sans-serif; font-size:11pt">    lat               lon                  value</span></div>
<div style="margin:0px; font-size:15px; color:rgb(32,31,30); background-color:rgb(255,255,255)">
<span style="color:rgb(32,31,30); font-size:15px"><span style="background-color:rgb(255,255,255); font-size:11pt; font-family:Calibri,Helvetica,sans-serif; display:inline">2015-01-25   00:04:34      ;239963527;                        -18.3521115;  -59.866315; 
     18</span><br style="background-color:rgb(255,255,255)">
<div style="margin:0px; background-color:rgb(255,255,255)">2015-01-25   00:04:34      ;568370796;                       -15.2493556   -58.7402566;   -18</div>
<br>
</span></div>
<div style="margin:0px; font-size:15px; color:rgb(32,31,30); background-color:rgb(255,255,255)">
<span style="color:rgb(32,31,30); font-family:Calibri,Helvetica,sans-serif; font-size:11pt">There are several cases in which the hour and minute will be the same, but the lat and lon information changes, although often close.</span><span style="color:rgb(32,31,30); font-size:15px"><br>
</span></div>
<div style="margin:0px; font-size:15px; color:rgb(32,31,30); background-color:rgb(255,255,255)">
<span style="color:rgb(32,31,30); font-family:Calibri,Helvetica,sans-serif; font-size:11pt"></span></div>
<span style="font-size:11pt">How could I attach as extra information of hh-mn, average value in the grid, with the same size of lat and lon without error</span>
<div style="margin:0px; font-size:15px; color:rgb(32,31,30); background-color:rgb(255,255,255)">
<br>
</div>
</div>
<div id="x_gmail-m_2227271103643195228appendonsend"></div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_2227271103643195228divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
<b>Enviado:</b> quarta-feira, 13 de janeiro de 2021 13:57<br>
<b>Para:</b> Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>><br>
<b>Cc:</b> Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>>; Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Assunto:</b> Re: [ncl-talk] Adding time coordinate</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>What to say .....</div>
<div><br>
</div>
<div>Here are two lines at  beginning of the file.<br>
</div>
<div><br>
</div>
<div>yyyy-mm-dd</div>
<div>                   hh:mn:sc</div>
<div>                                   ?????????      lat               lon           value<br>
</div>
<div>2015-01-25 00:04:34;239963527;-18.3521115;-59.866315;18<br>
2015-01-25 00:04:34;568370796;-15.2493556;-58.7402566;-18</div>
<div><br>
</div>
<div>As you can see the yyyy-mm-dd-hh-mb-sc    are identical. Hence, as noted in a previous email the calculated times are identical. Hence, 'time' in not monotonic.</div>
<div><br>
</div>
<div>I ***speculate*** that the ?????????  is actually a fractional part of the second.</div>
<div><br>
</div>
<div>%>  ncl vanucia.dup_time_example.ncl | less</div>
<div><br>
</div>
<div>Is that correct?</div>
<div><br>
</div>
<div>It is the user's responsibility to know about and explore the data.  <br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Wed, Jan 13, 2021 at 6:44 AM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">I detailed the attached script better with comments on each step.</span>
<div><span style="font-size:11pt">The script's job is to take the data from the ascii file and create a regular grid with 1 km of spatial resolution.</span></div>
<div><span style="font-size:11pt">The variable (new_data) varies with values above 1 at some grid points.</span></div>
<div><span style="font-size:11pt">However, what I need to include in this script and I am not succeeding, is to include the hh and mn information for each variable in the grid point, when there are no missing values. If I have a value above 1 at the grid point,
 I want to know the hour and minute of that information.</span></div>
<div><br>
</div>
<div><span style="font-size:11pt">I made the corrections that Dennis suggested (attachment)</span></div>
<div><br>
</div>
<span style="font-size:11pt">I appreciate the progress</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">Thanks</span></div>
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455appendonsend">
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
<b>Enviado:</b> quarta-feira, 13 de janeiro de 2021 02:14<br>
<b>Para:</b> Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>><br>
<b>Cc:</b> Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>>; Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Assunto:</b> Re: [ncl-talk] Adding time coordinate</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>I agree with DaveA.</div>
<div><br>
</div>
<div>I , also, do not understand your code. You must do a better job of explaining the objective.
<br>
</div>
<div><br>
</div>
<div>[1] Do you just want to convert the text file to a netCDF file?</div>
<div><br>
</div>
[2] Some sort of grid???<br>
     <br>
You define a grid style variable "new_data"<br>
       new_data           = new((/nlat,mlon,ntimes/),"float")<br>
<br>
        new_data!0         = "lat2"<br>
        new_data!1         = "lon2"<br>
        new_data!2         = "time"<br>
<br>
        new_data&lat2      =  lat2<br>
        new_data&lon2      =  lon2<br>
<div>        new_data&time      =  time</div>
<div><br>
</div>
<div>To me, it looks like you are trying to directly place the raw  values into the 'new_data'  array.</div>
<div><br>
</div>
<div>In fact, because each time is unique, there will be ntime=dimsizes(time)=<b>6024 </b> grids with one value per grid.</div>
<div><br>
</div>
<div>;;;;new_data({lat(i)},{lon(i)},{time(i)}) = new_data({LAT(i)},{LON(i)},{time(i)})+(/var(i)/)</div>
<div><br>
</div>
<div>---</div>
<div>Also, the way you are accessing the various fields is wrong.</div>
<div><br>
</div>
<div>NCL is confusing the - delimeter embedded with thh yyyy-mm-dd with a numeric minus sign.</div>
<div><br>
</div>
<div>2015-02-19 00:01:27;733939380;-18.4340369;-56.829563;-28</div>
<div>        ^    ^</div>
<div>===================================================</div>
<div><br>
</div>
<div>        datas := asciiread(pthasc(j),-1,"string")<br>
        nline  = dimsizes(datas)<br>
print("nline="+nline)<br>
<br>
; NCL code is confusing the - delimeter with a minus sign<br>
; Change delimeter embedded with yyyy-mm-dd to yyyy mm dd<br>
; There may be better ways but (1) converting string to character<br>
;                              (2) converting - character to : character <br>
;                              (3) change : character to : string<br>
<br>
        datac := tochar(datas)      ; (nline,:)<br>
        datac(:,4) = tochar(":")<br>
        datac(:,7) = tochar(":")<br>
        datas  = tostring(datac)    ; overwrite original<br>
;;print(datas)<br>
        nfld   = str_fields_count(datas(0), delim)  ; look at 1st line only<br>
print("nfld="+nfld)<br>
<br>
        yyyy  := toint(str_get_field(datas,  1, delim) )<br>
          mm  := toint(str_get_field(datas,  2, delim) )<br>
          dd  := toint(str_get_field(datas,  3, delim) )<br>
          hh  := toint(str_get_field(datas,  4, delim) )<br>
          mn  := toint(str_get_field(datas,  5, delim) )<br>
          sc  := toint(str_get_field(datas,  6, delim) )<br>
<br>
        time  := cd_inv_calendar(yyyy,mm,dd,hh,mn,sc,tunits, 0)<br>
        time!0 = "time"<br>
        ntimes = dimsizes(time)<br>
 printVarSummary(time)<br>
        LAT   := todouble( str_get_field(datas, 8, delin) )    ; fields count starts at 1<br>
        LON   := todouble( str_get_field(datas, 9, delim) )<br>
        VAL   := todouble( str_get_field(datas,10, delim) )<br>
 print("time="+time+"  yyyy="+yyyy+"  mm="+mm+"  dd="+dd+"  hh="+hh \<br>
      +"  mn="+mn+"  sc="+sc+"  LAT="+LAT+"  LON="+LON+"  VAL="+VAL)<br>
</div>
<div><br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Tue, Jan 12, 2021 at 7:58 PM Dave Allured - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div dir="ltr">
<div>Sure, one netcdf file per day, 1 km grid.  But simple application of the cd_inv_calendar function only gets you a long 1-D array of exact times.  It is not sufficient to determine the structure of the desired result file.</div>
<div><br>
</div>
<div>This still leaves the question of how you want to carry the time-of-day information inside that one file.  The related questions are, do you want a 2-D or 3-D array in the file, and what are the times of day on the third dimension.  If the array is 3-D,
 then that means multiple grids within a single day.  There are many examples of multiple grids per day in other data sets, and they are almost always regularly spaced over time, such as one grid per hour.</div>
<div><br>
</div>
<div>It is even possible to have a single data grid, and a companion grid that has exact time of day at each grid point.  This would be unusual, but not difficult.  Also, for this you would need to decide what to do about multiple obs at the same grid point.</div>
<div><br>
</div>
<div>So forget the details of NCL for a minute.  Please describe specifically the grid or grids that you would like, and their spacing across time of day.  This will work any way you like, as long as you can fully describe the shape of the desired end product.</div>
<div><br>
</div>
<br>
<div>
<div dir="ltr">On Tue, Jan 12, 2021 at 4:17 PM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">So, in fact what I need is just the hour and minute information, but the easiest way I found was to use the cd_inv_calendar function.</span>
<div><span style="font-size:11pt">How do you suggest that I can attach this information to the new_data variable?</span></div>
<div><span style="font-size:11pt"><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size:11pt; background-color:rgb(245,245,245); display:inline"></span></span></div>
<span style="font-size:11pt">The purpose of the script is to spatialize the input data to a regular 1km grid.</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">The input data is just one example of several data in which I use to generate a netcdf file per day with this script.</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="background-color:rgb(245,245,245)"><br>
</span></div>
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455x_gmail-m_9085695215725766150gmail-m_-6880538100877393232gmail-m_-4907720709292235231appendonsend">
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block; width:98%">
<b style="font-size:11pt; color:rgb(0,0,0); font-family:Calibri,sans-serif">De:</b><span style="font-size:11pt; color:rgb(0,0,0); font-family:Calibri,sans-serif"> Dave Allured - NOAA Affiliate <</span><a href="mailto:dave.allured@noaa.gov" target="_blank" style="font-size:11pt; font-family:Calibri,sans-serif">dave.allured@noaa.gov</a><span style="font-size:11pt; color:rgb(0,0,0); font-family:Calibri,sans-serif">></span>
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455x_gmail-m_9085695215725766150gmail-m_-6880538100877393232gmail-m_-4907720709292235231divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Enviado:</b> terça-feira, 12 de janeiro de 2021 16:39<br>
<b>Para:</b> Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Assunto:</b> Re: [ncl-talk] Adding time coordinate</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>Okay.  It looks like your original dates and times are not regularly spaced, and you are trying to make a new set of time coordinates by setting seconds = 0.  This results in more irregular time values with some duplicate values, which are not legal for
 coordinate subscripting.  This is the error "Non-monotonic coordinate value".<br>
<br>
It looks like your input file spans all 24 hours in one day.  Can you please explain exactly what you want the new time coordinates to look like?  Are they regularly spaced or irregular?  Start and end times?<br>
</div>
<div dir="ltr"><br>
</div>
<br>
<div>
<div dir="ltr">On Tue, Jan 12, 2021 at 4:51 AM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt; color:rgb(0,0,0)">Using your sugestion: </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt; color:rgb(0,0,0)">ntimes = dimsizes(time)</span>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:11pt">new_data = new((/nlat,mlon,ntimes/),"float")</span></div>
<div><span style="color:rgb(0,0,0); font-size:11pt">I got this error:</span></div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<div><span style="font-size:11pt; color:rgb(0,0,0)">fatal:NclOneDValGetClosestIndex: Non-monotonic coordinate value being used, can't complete coordinate subscript</span></div>
<div><span style="font-size:11pt; color:rgb(0,0,0)">fatal:Could not obtain coordinate indexes, unable to perform subscript</span></div>
<div><span style="font-size:11pt; color:rgb(0,0,0)">fatal:["Execute.c":8640]:Execute: Error occurred at or near line 89 in file test.ncl</span></div>
<span style="font-size:11pt; color:rgb(0,0,0)">The line 89: </span><span style="font-size:11pt; color:rgb(0,0,0)">  new_data({lat(i)},{lon(i)},{time(i)}) = new_data({lat(i)},{lon(i)},{time(i)})+(/var(i)/)</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<div style="margin:0px; font-size:14pt"><span style="font-size:11pt; color:rgb(0,0,0)">Using this: </span></div>
<div style="margin:0px; font-size:14pt"><span style="font-size:11pt; background-color:rgb(255,255,255); color:rgb(0,0,0); display:inline">ntimes = dimsizes(time(1))</span>
<div style="margin:0px; font-size:18.6667px; background-color:rgb(255,255,255)"><span style="margin:0px; font-size:11pt; color:rgb(0,0,0)">new_data = new((/nlat,mlon,ntimes/),"float")</span></div>
</div>
<span style="font-size:11pt; color:rgb(0,0,0)">I got this error:</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt; color:rgb(0,0,0)">fatal:Coordinate variables must be the same dimension as their dimension</span>
<div><span style="font-size:11pt; color:rgb(0,0,0)">fatal:No coordinate variable exists for dimension (time) in variable (new_data)</span></div>
<div><span style="font-size:11pt; color:rgb(0,0,0)">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 86 in file test.ncl</span></div>
<span style="font-size:11pt; color:rgb(0,0,0)">The line 86: new_data&time     = time
</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
<span style="font-size:11pt; color:rgb(0,0,0)">Attached is the script and a test data.</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt; color:rgb(0,0,0)">Thanks</span></div>
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455x_gmail-m_9085695215725766150gmail-m_-6880538100877393232gmail-m_-4907720709292235231x_gmail-m_-5672433769152991637appendonsend">
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455x_gmail-m_9085695215725766150gmail-m_-6880538100877393232gmail-m_-4907720709292235231x_gmail-m_-5672433769152991637divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>><br>
<b>Enviado:</b> segunda-feira, 11 de janeiro de 2021 22:55<br>
<b>Para:</b> Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Assunto:</b> Re: [ncl-talk] Adding time coordinate</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">Please show the complete text for line 75, the complete error message, and printVarSummary for the array new_data, just before line 75 is executed.  Also please attach the current version of your script.  Thank you.</div>
<div><br>
</div>
<br>
<div>
<div dir="ltr">On Mon, Jan 11, 2021 at 5:39 PM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
Thanks for the help, but the error persists in the line 75</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
PrintVarSummary:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<div>Variable: nlat</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div>            1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes: [1]</div>
<div>Coordinates: </div>
<div><br>
</div>
<div>Variable: mlon</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div>            1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes: [1]</div>
<div>Coordinates: </div>
<div><br>
</div>
<div>Variable: ntimes</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div>            1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes: [1]</div>
<div>Coordinates: </div>
<div>(0) 6024</div>
<br>
</div>
<b style="font-size:11pt; color:rgb(0,0,0); font-family:Calibri,sans-serif">De:</b><span style="font-size:11pt; color:rgb(0,0,0); font-family:Calibri,sans-serif"> Dave Allured - NOAA Affiliate <</span><a href="mailto:dave.allured@noaa.gov" target="_blank" style="font-size:11pt; font-family:Calibri,sans-serif">dave.allured@noaa.gov</a><span style="font-size:11pt; color:rgb(0,0,0); font-family:Calibri,sans-serif">></span>
<div id="x_gmail-m_2227271103643195228x_gmail-m_2683583517594866455x_gmail-m_9085695215725766150gmail-m_-6880538100877393232gmail-m_-4907720709292235231x_gmail-m_-5672433769152991637x_gmail-m_6881665020533800332divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Enviado:</b> segunda-feira, 11 de janeiro de 2021 20:27<br>
<b>Para:</b> Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Assunto:</b> Re: [ncl-talk] Adding time coordinate</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Your script looks pretty good so far.  This does not look right:
<div>    new_data = new((/nlat,mlon,toint(time(1))/),"float")<br>
</div>
<div><br>
</div>
<div>Try this:</div>
<div>    ntimes = dimsizes (time)</div>
<div>    new_data = new((/nlat,mlon,ntimes/),"float")</div>
<div><br>
</div>
<div>Always use printVarSummary when you are having problems with arrays; and look at dimensions, coordinates, attributes, and such.</div>
<div><br>
</div>
<div>Also, in the future, please show the *first* error received, and be sure to show exactly which line it occurs on.  Usually the first error causes more problems later, and it is harder to sort out.  I am not sure what happened this time, but that does not
 matter now.  Good luck.</div>
<div><br>
</div>
</div>
</div>
<br>
<div>
<div dir="ltr">On Mon, Jan 11, 2021 at 2:51 PM Vanúcia Schumacher via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">Hi users,</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">I need to add the time information (</span><span style="font-size:11pt">preference in hh and mn)</span><span style="font-size:11pt"> extracted from an ascii file to a new variable (new_data from script), but I am not having success.</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">Attached is the script I am trying using the function cd_inv_calendar and the error obtained:</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">fatal:No coordinate variable exists for dimension (time) in variable (new_data)</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:11pt">I appreciate some help to attach this information to my new variable</span></div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>