<html><head></head><body><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div></div>
        <div>Dears,</div><div>I did some editions on previous script, and it seems works better.</div><div>However the problem about time dimensions. I'll be thankful if discard previous script and for any help about new attached file.</div><div><br></div><div>Sincerely</div><div>Ehsan</div><div><br></div>
        
        </div><div id="yahoo_quoted_8643197209" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Friday, June 8, 2018, 5:54:04 PM GMT+4:30, Ehsan Taghizadeh <ehsantaghizadeh@yahoo.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div></div>
        <div>Dear Dennis,<br>Thank you so much for your script.</div><div>In your script, "<span>tp3_ncl</span>" is exactly what I need, as its values are the same as "<span>tp_cdo</span>" values.</div><div>However could I have any help to write this variable (tp3_ncl) in nc file, just like (tp) in (<span>2_ERAI_Prec_2015_Jan_00_12_12.nc</span>)?</div><div>I've added between 185-218, I've attached the script. However it is absolutely wrong.<br></div><div><br></div><div>I'll be thankful for any help.</div><div><br></div><div>Sincerely</div><div>Ehsan</div><div><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_9377141164" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Tuesday, June 5, 2018, 4:26:15 AM GMT+4:30, Dennis Shea <shea@ucar.edu> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="yiv7090685966"><div><div dir="ltr"><div><div><div>I am going to add a few more items to a previous response:<br clear="none"><br clear="none"></div>The <b>Golden Rules of data processing are:<br clear="none"><br clear="none">(a) Look at your data!<br clear="none"></b></div><b>(b) Know your data!<br clear="none"></b></div><b>(c) Make sure *you* know what a function or tool is doing to your data<br clear="none"></b><div><div><div><b>---<br clear="none"><br clear="none"></b></div><div>The source netcDF '2_2_ERAI_Prec_2015_Jan_00_12_<a rel="nofollow" shape="rect" target="_blank" href="http://12.nc"> 12.nc</a>' was created from a GRIB file:<br clear="none"><br clear="none">history attribute:<br clear="none">2018-05-16 09:15:25 GMT by grib_to_netcdf-2.7.3: grib_to_netcdf /data/data05/scratch/3c/71/_ma rs-atls00-a562cefde8a29a7288fa 0b8b7f9413f7-b4mPzK.grib -o /data/data04/scratch/41/14/_gr ib2netcdf-atls17-a562cefde8a29 a7288fa0b8b7f9413f7-PZaKeY.nc -utime" ;<br clear="none"><br clear="none">---<br clear="none"></div><div>There are <b>62 time steps</b> on the source ERAI file:<br clear="none"><br clear="none"></div><div>                  yyyymmddhh     tp value<br clear="none"></div><div>(0)    ERAI: 2015010112   0.000330344    <b><=== only one value for this calendar day<br clear="none"><br clear="none"></b>(1)    ERAI: 2015010200   0.0051588        ......<b> two time steps per calendar day</b> ...<br clear="none">(2)    ERAI: 2015010212   0.00401913<br clear="none">(3)    ERAI: 2015010300   0<br clear="none">(4)    ERAI: 2015010312   0<br clear="none">(5)    ERAI: 2015010400   0<br clear="none">(6)    ERAI: 2015010412   0.000478998<br clear="none">(7)    ERAI: 2015010500   0.00344653<br clear="none"></div><div>[SNIP]<br clear="none">(55)    ERAI: 2015012900   0<br clear="none">(56)    ERAI: 2015012912   0<br clear="none">(57)    ERAI: 2015013000   9.35942e-05<br clear="none">(58)    ERAI: 2015013012   7.15703e-05<br clear="none">(59)    ERAI: 2015013100   0.00390901<br clear="none">(60)    ERAI: 2015013112   0<br clear="none"><br clear="none">(61)    ERAI: 2015020100   0.00183889<b>      <=== only one value for this calendar day</b></div><div>---<br clear="none"></div><div>To what 'time' does the source ERAI 'time stamp apply"? <br clear="none">That is <b>***USER RESPONSIBILITY*** </b>to know or find the answer.<br clear="none"><br clear="none"></div><div>Three possibilities:<br clear="none"></div><div><br clear="none"></div><div>[1] beginning<br clear="none"></div><div>[2] end<br clear="none"></div><div>[3] 'center-of-mass'  ... mid temporal time?<br clear="none"><br clear="none">---<br clear="none"></div><div>NCL's '<b>calculate_daily_values</b>' with <b>'ncrit=2</b>' requires two values on the <b>same calendar day</b><br clear="none">           <a rel="nofollow" shape="rect" target="_blank" href="https://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml">https://www.ncl.ucar.edu/ Document/Functions/ Contributed/calculate_daily_ values.shtml</a><br clear="none"><br clear="none"></div><div>With <b>ncrit=2</b> the function returns 30 values ... not 31 or 32. Why?<br clear="none"></div><div>Because it requires 2 values per calendar date. It ignores the 1st and last times because there is only one time step per calendar day<br clear="none"><br clear="none">tp2_ncl<br clear="none">  NCL_tag :     calculate_daily_values: arith=sum<br clear="none"><br clear="none">     ----<br clear="none">The function 'tags' it with the <b>1st time step of each *complete*  calendar day</b><br clear="none"><br clear="none">(0)     NCL: 2015010200   0.00917792<br clear="none">(1)     NCL: 2015010300   0<br clear="none">(2)     NCL: 2015010400   0.000478998<br clear="none">(3)     NCL: 2015010500   0.00879252<br clear="none"></div><div>[SNIP]<br clear="none">(28)    NCL: 2015013000   0.000165164<br clear="none">(29)    NCL: 2015013100   0.00390901<br clear="none"></div><div><br clear="none"></div><div>---<br clear="none"></div><div>The CDO takes the first two values [0,1], then the next two [2,3], etc. <br clear="none">It 'tags' the time as the 2nd time step<br clear="none"><br clear="none">(0)     CDO: 2015010200   0.00548913<br clear="none">(1)     CDO: 2015010300   0.00401912<br clear="none">(2)     CDO: 2015010400   -1.08611e-10<br clear="none"></div><div>[SNIP]<br clear="none">(29)    CDO: 2015013100   0.00398058<br clear="none">(30)    CDO: 2015020100   0.00183889<br clear="none"><br clear="none"></div><div>Even though the time 'tags' are the same, they refer to different sums.<br clear="none"></div><div>---<br clear="none"></div><div> <br clear="none"></div><div>NCL can be made to handle the time and data any way the user wants.<b><br clear="none"><br clear="none"></b></div><div>I'll let you look at the attached script and output<b><br clear="none"></b></div><div><b><br clear="none"></b></div></div></div></div><div class="yiv7090685966gmail_extra"><br clear="none"><div class="yiv7090685966gmail_quote">On Fri, Jun 1, 2018 at 4:03 PM, Ehsan Taghizadeh <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:ehsantaghizadeh@yahoo.com" target="_blank" href="mailto:ehsantaghizadeh@yahoo.com">ehsantaghizadeh@yahoo.com</a>></span> wrote:<br clear="none"><blockquote class="yiv7090685966gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="yiv7090685966yqt6078731353" id="yiv7090685966yqt39650"><div><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div></div>
            <div>Dears,</div><div>About summation of 12 hours precipitation to obtain daily precipitation, as suggested me I used "cdo" and it seems work correctly:</div><div>"<span>cdo -b F32 -f nc4c -z zip timselsum,2 2_2_ERAI_Prec_2015_Jan_00_12_<a rel="nofollow" shape="rect" target="_blank" href="http://12.nc">12.nc</a> 2_2_ERAI_Prec_2015_Jan_24_cdo. nc4</span>"</div><div>However I like to know how writing nc files with "Geo2D".</div><div><br clear="none"></div><div>Sincerely</div><span class="yiv7090685966HOEnZb"><font color="#888888"></font></span><div>Ehsan<br clear="none"></div><div><div class="yiv7090685966h5"><div><br clear="none"></div>
            
            <div class="yiv7090685966m_-6783576671254890485yahoo_quoted" id="yiv7090685966m_-6783576671254890485yahoo_quoted_8329699892">
                <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                    
                    <div>
                        On Thursday, May 31, 2018, 7:12:17 PM GMT+4:30, Ehsan Taghizadeh <<a rel="nofollow" shape="rect" ymailto="mailto:ehsantaghizadeh@yahoo.com" target="_blank" href="mailto:ehsantaghizadeh@yahoo.com">ehsantaghizadeh@yahoo.com</a>> wrote:
                    </div>
                    <div><br clear="none"></div>
                    <div><br clear="none"></div>
                    <div><div id="yiv7090685966m_-6783576671254890485yiv7438465636"><div><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div></div>
            <div>Thank you so much for your nice replies.</div><div>With you comment, it seems work correctly. However I've added some changes to the script to have an output file same as input file, I mean about dimensions, attributes, and so on.</div><div>However I have some difficulties about it and I'll be thankful if I could have your help, again.</div><div>For example about</div><div><span></span><div>fout->tp24_1!1 = tp!1</div><div>fout->tp24_1!2 = tp!2</div><div>I encountered error. It seems they have conflict with following lines:</div><div><span></span><div>fout->latitude = fin->latitude</div><div>fout->longitude = fin->longitude</div><br clear="none"></div><div>Beside that I want to have "<span>tp24_1</span>" with dimension "Geo2D" to plot.</div><div>I attached new version of script, and I'll be thankful if I hear from you.</div><div><br clear="none"></div><div>Sincerley</div><div>Ehsan</div></div>
            
            <div class="yiv7090685966m_-6783576671254890485yiv7438465636yahoo_quoted" id="yiv7090685966m_-6783576671254890485yiv7438465636yahoo_quoted_8737910354">
                <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                    
                    <div class="yiv7090685966m_-6783576671254890485yiv7438465636yqt5050463565" id="yiv7090685966m_-6783576671254890485yiv7438465636yqtfd01829"><div>
                        On Thursday, May 31, 2018, 6:44:48 PM GMT+4:30, Dennis Shea <<a rel="nofollow" shape="rect" ymailto="mailto:shea@ucar.edu" target="_blank" href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:
                    </div>
                    <div><br clear="none"></div>
                    <div><br clear="none"></div>
                    <div><div id="yiv7090685966m_-6783576671254890485yiv7438465636"><div><div dir="ltr"><div><div><div><div><div><div>The <b>golden rule</b> of  data processing is <b>look at your data</b><br clear="none"><br clear="none"></div>You have:<br clear="none"><br clear="none">tp=f->tp     ; <=== type 'short' [ packed data]<br clear="none"><br clear="none"></div>However, your file has:<br clear="none"><br clear="none">      <b>short</b> tp ( time, latitude, longitude )<br clear="none">        <b> scale_factor </b>: 5.505649013956001e-06<br clear="none">         <b>add_offset </b>:   0.1803980955369768<br clear="none">         _FillValue :   -32767<br clear="none">         missing_value :        -32767<br clear="none">         units :        m<br clear="none">         long_name :    Total precipitation<br clear="none"><br clear="none"></div>You <b>*MUST* </b>unpack the variable before computing the sums.<br clear="none"><br clear="none"></div>tp = <b>short2flt</b>(f->tp)<br clear="none"><br clear="none"></div>printVarSummary(tp)<br clear="none"></div>printMinMax(tp,0)<br clear="none"><br clear="none">===<br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml">https://www.ncl.ucar.edu/ Document/Functions/ Contributed/short2flt.shtml</a><br clear="none"><br clear="none"> <br clear="none"><div><div><div><div><br clear="none"><div><br clear="none"><br clear="none"></div></div></div></div></div></div><div class="yiv7090685966m_-6783576671254890485yiv7438465636gmail_extra"><br clear="none"><div class="yiv7090685966m_-6783576671254890485yiv7438465636gmail_quote">On Thu, May 31, 2018 at 7:19 AM, Ehsan Taghizadeh <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:ehsantaghizadeh@yahoo.com" target="_blank" href="mailto:ehsantaghizadeh@yahoo.com">ehsantaghizadeh@yahoo.com</a>></span> wrote:<br clear="none"><blockquote class="yiv7090685966m_-6783576671254890485yiv7438465636gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="yiv7090685966m_-6783576671254890485yiv7438465636yqt4170128844" id="yiv7090685966m_-6783576671254890485yiv7438465636yqt57530"><div><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div></div>
            <div>Dears,<br clear="none">I've tried sum 12 hour precipitation to obtain 24 hour precipitation using attached script.</div><div>However it seems doesn't work correctly!</div><div>I had to sum tp(0,:,:)+tp(1,:,:), also tp(2,:,;)+tp(3,;,:), and so on.</div><div>I uploaded "<span>2_2_ERAI_Prec_2015_Jan_00_12_<a rel="nofollow" shape="rect" target="_blank" href="http://12.nc"> 12.nc</a></span>" in <span><a rel="nofollow" shape="rect" target="_blank" href="http://ftp.cgd.ucar.edu">ftp.cgd.ucar.edu</a>.</span></div><div><span>I'll be thankful if I hear from you.</span></div><div><span><br clear="none"></span></div><div><span>Sincerely</span></div><div><span>Ehsan</span></div><div><br clear="none"></div>
            
            <div class="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yahoo_quoted" id="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yahoo_quoted_8511434241">
                <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                    
                    <div>
                        On Wednesday, May 16, 2018, 8:23:32 AM GMT+4:30, Dennis Shea <<a rel="nofollow" shape="rect" ymailto="mailto:shea@ucar.edu" target="_blank" href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:
                    </div>
                    <div><br clear="none"></div>
                    <div><br clear="none"></div>
                    <div><div id="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380"><div><div dir="ltr"><div><div><div><div><div><div><div><div>This is book keeping. Something like:<br clear="none"><br clear="none"></div>loop  each year<br clear="none"></div>   loop each month<br clear="none"></div>      loop each day<br clear="none">   <br clear="none"></div>        sum all values occurring between 00:00 and 11:59 inclusive ==>PRC(time,lat,lon,0)<br clear="none"></div>        sum all values occurring between 12:00 and 23:59 inclusive ==>PRC(time,lat,lon,1)<br clear="none"><br clear="none"></div>     end day<br clear="none"></div>   end month<br clear="none"></div> end year<br clear="none"><div><div><div><div><div><div><br clear="none"></div></div></div></div></div></div></div><div class="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380gmail_extra"><br clear="none"><div class="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380gmail_quote">On Sun, May 13, 2018 at 9:07 AM, Ehsan Taghizadeh <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:ehsantaghizadeh@yahoo.com" target="_blank" href="mailto:ehsantaghizadeh@yahoo.com">ehsantaghizadeh@yahoo.com</a>></span> wrote:<br clear="none"><blockquote class="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380yqt3390863335" id="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380yqt57552"><div><div style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div>Hi every body;</div><div>Could I have any help to get daily precipitation from Era-Interim, please?</div><div>I mean, a way to sum "<span><span>accumulated precipitation from 00:00 to 12:00</span></span>" with "<span><span>accumulated precipitation from 12:00 to 24:00</span></span>"?</div><div><br clear="none"></div><div>Sincerely</div><span class="yiv7090685966m_-6783576671254890485yiv7438465636m_7922525286226352253yiv0436690380HOEnZb"><font color="#888888"></font></span><div>Ehsan</div></div></div></div><br clear="none">______________________________ _________________<br clear="none">
ncl-talk mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:ncl-talk@ucar.edu" target="_blank" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br clear="none">
List instructions, subscriber options, unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/ mailman/listinfo/ncl-talk</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div></div>
                </div>
            </div></div></div></div><br clear="none">______________________________ _________________<br clear="none">
ncl-talk mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:ncl-talk@ucar.edu" target="_blank" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br clear="none">
List instructions, subscriber options, unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/ mailman/listinfo/ncl-talk</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div></div>
                </div></div><div class="yiv7090685966m_-6783576671254890485yiv7438465636yqt5050463565" id="yiv7090685966m_-6783576671254890485yiv7438465636yqtfd15583">
            </div></div></div></div></div></div>
                </div>
            </div></div></div></div></div></div><br clear="none">______________________________ _________________<br clear="none">
ncl-talk mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:ncl-talk@ucar.edu" target="_blank" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br clear="none">
List instructions, subscriber options, unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/ mailman/listinfo/ncl-talk</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div></div>
            </div>
        </div></div>
            </div>
        </div></div></body></html>