<div dir="ltr"><div>As noted by DaveA, the question is ambiguous. <br></div><div>The following will set the times times by the user. to _FillValue<br></div><div>Sine _FillValue are not used in any computation, this is similar to 'removing' the times from the variable.<br></div><div><br></div><div> ymd_exclude = (/19830131, 19850202, 19890610/) ; times to remove<br></div><div><pre> <span style="font-family:arial,sans-serif">diri = "./" ; input directory
fili = "<a href="http://model.nc">model.nc</a>"
f = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml"><strong>addfile</strong></a>(diri+fili, "r")<br></span></pre><pre><span style="font-family:arial,sans-serif"> x = f->X<br> printVarSummary(x)<br><br> ymd = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml"><strong>cd_calendar</strong></a>(x&time, -2) ; yyyymmdd ... all ymd in file
nt_exclude = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/get1Dindex_Exclude.shtml"><strong>get1Dindex_Exclude</strong></a>(ymd, ymd_exclude)
x(nt_exclude,...) = x@_FillValue ; set all remove time to _FillValue<br></span></pre><pre><span style="font-family:arial,sans-serif"> ; size of 'x' unchanged<br></span></pre><pre><span style="font-family:arial,sans-serif">======<br></span></pre><pre><span style="font-family:arial,sans-serif">Alternatively, actually remove the 'ymd_exclude' times from the variable.<br></span></pre><pre><span style="font-family:arial,sans-serif">The size of the array wil change.<br></span></pre><pre><span style="font-family:arial,sans-serif"><br> nt_collapse = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/get1Dindex_Collapse.shtml"><strong>get1Dindex_Collapse</strong></a>(ymd, ymd_exclude)
x <span style="color:rgb(0,0,255)"><b>:=</b></span> x(nt_collapse,...) ; note use of 'reassignment' operator [ <b><span style="color:rgb(0,0,255)">:=</span></b> ] <br> printVarSummary(x) ; note change of size <br>======= <br></span></pre><pre><span style="font-family:arial,sans-serif">Other useful index utility functions<br></span></pre><pre><span style="font-family:arial,sans-serif"><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/get1Dindex.shtml"><b>get1Dindex</b></a>, <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml"><b>ind</b></a><br></span></pre><span style="font-family:arial,sans-serif"></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2020 at 4:02 AM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">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 dir="ltr">Dear Dave,<div>I have only my NCL script to plot some variables from model results. As I mentioned before in those model results there are some specific dates that I need to remove. So I am seeking a way t do so, and I did not write any application program in NCL to remove them.</div><div>Best wishes,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2020 at 2:31 AM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</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 dir="ltr"><div dir="ltr">Please keep replies on the mailing list. I assumed that you were writing your own application program in NCL. Is this correct, or do you just want to make reduced files?</div><div dir="ltr"><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 16, 2020 at 5:38 AM Setareh Rahimi <<a href="mailto:setareh.rahimi@gmail.com" target="_blank">setareh.rahimi@gmail.com</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 dir="ltr">Dear Dave,<div>Many thanks for your email, and apologize for the slow reply. Well, I think method 2 should be fine. However, which application program do you suggest?</div><div>Best wishes, </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 7, 2020 at 10:58 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</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 dir="ltr"><div dir="ltr">I can think of at least three ways to do this.<br><br>1. Write a program to copy grids from a model file into a new file, but skip selected dates.<br>2. In your application program, remove the selected dates from a copy of the model data in program memory.<br>3. In your application program, read in only the dates wanted, and skip the dates to be removed.<br><br>I recommend methods 2 or 3 because they are fast and efficient, and need less programming than the first method. 2 and 3 require the ability to make changes to your application program. Which method fits your needs?</div><div dir="ltr"><br></div><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 7, 2020 at 1:23 AM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">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 dir="ltr"><br clear="all"><div>Dear all,</div><div><br></div><div>I have some model outputs in the NetCDF format. I need to remove the results from the files for some specific dates (like 2008/02/04). So would you please kindly advise me how can I do so?</div><div>Many thanks in advance,</div><div>Best wishes,</div>-- <br><div dir="ltr">S.Rahimi</div></div></blockquote></div></div></div></blockquote></div>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">S.Rahimi<br><br></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>