<div dir="ltr"><div>Please read the setfileoption documentation and understand "Initial_time" anf "Forecast_time"</div><div><br></div><div>;;monName = (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep" \</div>;; ,"Oct","Nov","Dec"/)<br> dayName = (/"Sat","Mon","Tue","Wed","Thu","Fri","Sat"/)<br><br> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml"><b>setfileoption</b>(</a>"grb","SingleElementDimensions","Initial_time") ; force an initial time dimension<br> fgrb = <b>addfile</b>("<span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"><span>gfs.t00z.pgrb2.0p25.f024</span></font></span>","r")<br><div> time = fgrb->initial_time0_hours</div><div> printVarSummary(time)<br></div><br> TIME = <b>toint</b>( cd_calendar(time, 0) ) ; (:,6)<br> yyyy = TIME(0,0) ; 1st time<br> mm = TIME(0,1)<br> dd = TIME(0,2)<br> hh = TIME(0,3)<br> mn = TIME(0,4)<br> sc = TIME(0,5)<br> ;<br> nd = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/day_of_week.shtml"><b>day_of_week</b></a>(yyyy,mm,dd) ; 0 to 6<br> dateLabel = "Init: "+dayName(nd)+" "+yyyy +"-" \<br> +<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml"><b>sprinti</b>(</a>"%0.2i",mm) +"-" \<br> +<b>sprinti</b>("%0.2i",nd) +" " \<br> +<b>sprinti</b>("%0.2i",hh) +"z"<br> print(dateLabel)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 21, 2020 at 7:08 AM Ehsan Taghizadeh 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><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div dir="ltr">Dears,<br>First of all, happy Nowruz. I hope best wishes for all people and safe from COVID-19.</div><div dir="ltr"><br></div><div dir="ltr">I want to handle a header for plot GFS 0.25 data. I've used following lines:</div><div dir="ltr"><br></div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"> ; To read precipitation variable from file</font></span></div><div dir="ltr"><span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"> gfs_f = addfile("<span>gfs.t00z.pgrb2.0p25.f024</span>", "r")</font></span></div><div dir="ltr"><span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"> <span>gfs_prc = gfs_f->APCP_P8_L1_GLL0_acc24h</span></font></span></div><div dir="ltr"><span><span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"> print(<span>gfs_prcn@initial_time</span>)</font></span></span></div><div dir="ltr"><span><span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"> print(<span><span style="color:rgb(0,0,0)">gfs_prcn@forecast_time</span></span>)</font></span></span></div><div dir="ltr"><span><font style="background-color:inherit" size="2" face="courier new, courier, monaco, monospace, sans-serif"><div> ; initial_time : 03/21/2020 (00:00)</div><div dir="ltr"> ; forecast_time : 24<div><div> ; forecast_time_units : hours</div><div><br></div></div> ; For Initial time in header I've used following lines:</div><div> moni = str_get_cols(gfs_prcn@initial_time, 0, 1) ; 03<br></div></font></span></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> dayi = str_get_cols(<span>gfs_prcn@initial_time</span>, 3, 4) ; 21</font></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> yeari=str_get_cols(<span>gfs_prcn@initial_time</span>, 6, 9) ; 2020</font></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> houri=str_get_cols(<span>gfs_prcn@initial_time</span>, 12, 13); 00</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> dow = day_of_week(stringtointeger(yeari),stringtointeger(moni),stringtointeger(dayi))</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><br></font></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> ; Convert day_of_week output from integer to corresponding day.</font></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> if (dow .eq. 0) then</font><div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Sun"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> else if (dow .eq. 1) then</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Mon"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> else if (dow .eq. 2) then</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Tue"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> else if (dow .eq. 3) then</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Wed"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> else if (dow .eq. 4) then</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Thu"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> else if (dow .eq. 5) then</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Fri"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> else</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span style="white-space:pre-wrap"> </span>dowc = "Sat"</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> end if</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> end if</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> end if</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> end if</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> end if</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> end if</font></div><div> <font size="2" face="courier new, courier, monaco, monospace, sans-serif">res@gsnRightString<span style="white-space:pre-wrap"> </span>= "Init: "+<span style="background-color:rgb(211,106,83)">dowc</span>+" "+<span style="background-color:rgb(253,248,105)">yeari</span>+"-"+<span style="background-color:rgb(173,215,115)">moni</span>+"-"+<span style="background-color:rgb(125,190,241)">dayi</span>+" "+<span style="background-color:rgb(210,100,170)">houri</span>+"z"</font><br></div></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> ; output will be something like: Init: <span style="background-color:rgb(211,106,83)">Sat</span> <span style="background-color:rgb(253,248,105)">2020</span>-<span style="background-color:rgb(173,215,115)">03</span>-<span style="background-color:rgb(125,190,241)">21</span> <span style="background-color:rgb(210,100,170)">00</span>z</font></div><div dir="ltr"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><br></font></div><div dir="ltr">May I ask some help?<br></div></div></div></div></div><div dir="ltr">1- Is there any straightforward to get desired output for initial time header, same as above? I mean is there any function to use instead of "<span><span style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:small">str_get_cols</span></span>" and also instead of many "<span><span style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:small">if</span></span>" for above lines?</div><div dir="ltr">2- forecast_time gives me just an integer number, 24. How could I created a valid time header for plots, like: "Valid: Sun 2020-03-22 00z"?</div><div dir="ltr">I've seen following link:</div><div dir="ltr"><span><a href="https://www.ncl.ucar.edu/Support/talk_archives/2012/3759.html" rel="nofollow" target="_blank">https://www.ncl.ucar.edu/Support/talk_archives/2012/3759.html</a></span><br></div><div dir="ltr">It seems like my problem, however is it final way?</div><div dir="ltr">I hope hearing from you, as always.</div><div dir="ltr"><br></div><div dir="ltr"><i><font size="2">Sincerely</font></i></div><div dir="ltr"><i><font size="2">Ehsan</font></i></div><div dir="ltr"><br></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>