<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
I would do something like this (rough outline, not intended to be used as-is, if you’re not familiar with basic NCL programming and data structures then you’ll need to start by learning that:
<a href="https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/basics.shtml" class="">
https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/basics.shtml</a> ).
<div class=""><br class="">
</div>
<div class="">;Define maximum number of time points:</div>
<div class="">itmax = ;whatever</div>
<div class=""><br class="">
</div>
<div class="">;Define number of rainfall data points - maybe multi-dimensional, you’ll need to define each:</div>
<div class="">raindataMax = ;whatever</div>
<div class=""><br class="">
</div>
<div class="">;Create structure to hold your data at each day:</div>
<div class="">data = new((/itmax,raindataMax/),float)</div>
<div class="">;Then define things like fill value, units, etc.</div>
<div class=""><br class="">
</div>
<div class="">;Loop over the files, read in the data, and put into your data structure:</div>
<div class="">do it=1,itmax</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>in_file = “Day_”+it+”.csv"</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>;Do the read in…</div>
<div class=""><br class="">
</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>data(it,:) = data_read_in</div>
<div class=""><br class="">
</div>
<div class="">end do</div>
<div class=""><br class="">
</div>
<div class="">Then you can write some code to select the ranges you want and do whatever you need with that data.  You could make a loop and select a data range using subscripting.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On May 4, 2021, at 1:15 PM, Soma Roy <<a href="mailto:somaroy892@gmail.com" class="">somaroy892@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
<div class=""><br class="">
</div>
<div class="">
<div dir="auto" class="">I am following the second example you send to me.
<div dir="auto" class=""><br class="">
</div>
<div dir="auto" class="">But can't understand how to set the loop for last 7 days files calling from list of files for weekly rainfall estimation on 7th, 8th, 9th and so and so on days..</div>
<div dir="auto" class=""><br class="">
</div>
<div dir="auto" class="">Thanks,</div>
<div dir="auto" class="">Soma</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, May 4, 2021, 23:37 Brian Thomas <<a href="mailto:brian.thomas@washburn.edu" class="">brian.thomas@washburn.edu</a>> wrote:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space" class="">First you’ll need to be familiar with how to read CSV format.  There’s helpful info here:
<div class=""><a href="https://www.ncl.ucar.edu/Applications/read_csv.shtml" target="_blank" rel="noreferrer" class="">https://www.ncl.ucar.edu/Applications/read_csv.shtml</a></div>
<div class=""><br class="">
</div>
<div class="">Then you should be able to just create a loop that cycles through the files and stores data in a single data structure (array), which you can then select from as you wish.<br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On May 4, 2021, at 1:00 PM, <a href="mailto:ncl-talk-request@mailman.ucar.edu" target="_blank" rel="noreferrer" class="">
ncl-talk-request@mailman.ucar.edu</a> wrote:</div>
<div class="">
<div class=""><br class="">
<br class="">
----------------------------------------------------------------------<br class="">
<br class="">
Message: 1<br class="">
Date: Tue, 4 May 2021 19:10:18 +0530<br class="">
From: Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank" rel="noreferrer" class="">somaroy892@gmail.com</a>><br class="">
To: ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank" rel="noreferrer" class="">ncl-talk@ucar.edu</a>><br class="">
Subject: [ncl-talk] Weekly files_selection<br class="">
Message-ID:<br class="">
       <<a href="mailto:CAAJRSQdcLpuVv8RCCNPTsSNbzpkhhc8VYCaUu-U4FwHKBeKXbw@mail.gmail.com" target="_blank" rel="noreferrer" class="">CAAJRSQdcLpuVv8RCCNPTsSNbzpkhhc8VYCaUu-U4FwHKBeKXbw@mail.gmail.com</a>><br class="">
Content-Type: text/plain; charset="utf-8"<br class="">
<br class="">
Hello NCL users,<br class="">
<br class="">
I am working for weekly rainfall.<br class="">
<blockquote type="cite" class="">From model simulation, I am getting daily rainfall files in the directory.<br class="">
</blockquote>
<br class="">
Now, I want to select last 7 days rainfall files from directory for present<br class="">
date/days.<br class="">
<br class="">
Files are storing in the dir like:<br class="">
Day_1.csv<br class="">
Day_2.csv<br class="">
Day_3.csv<br class="">
.<br class="">
.<br class="">
Day_7.csv<br class="">
Day_8.csv<br class="">
And<br class="">
So on..<br class="">
<br class="">
On day 7th, I want to select 1st weekly rainfall (i.e. 1st 7 files avg.)<br class="">
And day 8th, it will take from Day_2 to Day_8 files and so on.<br class="">
<br class="">
Please kindly inform me how to do the above in NCL.<br class="">
<br class="">
Thanks in advance.<br class="">
<br class="">
Regards,<br class="">
Soma<br class="">
********************************<br class="">
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">
<div class="">
<div style="font-size: 12px;" class="">@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#<wbr class="">@#@#@#@#@#@</div>
<div style="font-size: 12px;" class="">Brian C. Thomas, PhD</div>
<div style="font-size: 12px;" class="">Professor, Physics and Astronomy, Washburn University</div>
<div style="font-size: 12px;" class=""><br class="m_5392318813447303527khtml-block-placeholder">
</div>
<div style="font-size: 12px;" class=""><a href="tel:(785)%20670-2144" value="+17856702144" target="_blank" class="">785-670-2144</a></div>
<div style="font-size: 12px;" class=""><a href="mailto:brian.thomas@washburn.edu" target="_blank" class="">brian.thomas@washburn.edu</a></div>
<div style="font-size: 12px;" class=""><br class="">
</div>
<div style="font-size: 12px;" class="">Web: <a href="http://www.washburn.edu/faculty/bthomas/" target="_blank" class="">http://www.washburn.edu/<wbr class="">faculty/bthomas/</a></div>
<div style="font-size: 12px;" class="">
<div style="font-size: 14px;" class=""><span style="font-size: 12px;" class="">ORCID profile: <span style="text-align: -webkit-auto;" class=""><a href="http://orcid.org/0000-0001-9091-0830" target="_blank" class="">http://orcid.org/<wbr class="">0000-0001-9091-0830</a></span></span></div>
<div class="">ResearchGate profile: <a href="https://www.researchgate.net/profile/Brian_Thomas" target="_blank" class="">https://www.<wbr class="">researchgate.net/profile/<wbr class="">Brian_Thomas</a></div>
</div>
<div style="font-size: 12px;" class=""><br class="">
</div>
<div style="font-size: 12px;" class="">Department of Physics and Astronomy</div>
<div style="font-size: 12px;" class="">Washburn University</div>
<div style="font-size: 12px;" class=""><a href="https://maps.google.com/?q=1700+SW+College+Ave.%0D+Topeka,+KS+66621&entry=gmail&source=g" class="">1700 SW College Ave.</a></div>
<div style="font-size: 12px;" class=""><a href="https://maps.google.com/?q=1700+SW+College+Ave.%0D+Topeka,+KS+66621&entry=gmail&source=g" class="">Topeka, KS 66621</a></div>
<div style="font-size: 12px;" class=""><br class="m_5392318813447303527khtml-block-placeholder">
</div>
<div style="font-size: 12px;" class="">@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#<wbr class="">@#@#@#@#@#@</div>
</div>
</div>
<br class="">
</div>
</body>
</html>