[ncl-talk] ncl-talk Digest, Vol 210, Issue 3

Brian Thomas brian.thomas at washburn.edu
Wed May 5 09:37:32 MDT 2021


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: https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/basics.shtml ).

;Define maximum number of time points:
itmax = ;whatever

;Define number of rainfall data points - maybe multi-dimensional, you’ll need to define each:
raindataMax = ;whatever

;Create structure to hold your data at each day:
data = new((/itmax,raindataMax/),float)
;Then define things like fill value, units, etc.

;Loop over the files, read in the data, and put into your data structure:
do it=1,itmax
in_file = “Day_”+it+”.csv"
;Do the read in…

data(it,:) = data_read_in

end do

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.


On May 4, 2021, at 1:15 PM, Soma Roy <somaroy892 at gmail.com<mailto:somaroy892 at gmail.com>> wrote:


I am following the second example you send to me.

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..

Thanks,
Soma

On Tue, May 4, 2021, 23:37 Brian Thomas <brian.thomas at washburn.edu<mailto:brian.thomas at washburn.edu>> wrote:
First you’ll need to be familiar with how to read CSV format.  There’s helpful info here:
https://www.ncl.ucar.edu/Applications/read_csv.shtml

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.

On May 4, 2021, at 1:00 PM, ncl-talk-request at mailman.ucar.edu<mailto:ncl-talk-request at mailman.ucar.edu> wrote:


----------------------------------------------------------------------

Message: 1
Date: Tue, 4 May 2021 19:10:18 +0530
From: Soma Roy <somaroy892 at gmail.com<mailto:somaroy892 at gmail.com>>
To: ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: [ncl-talk] Weekly files_selection
Message-ID:
       <CAAJRSQdcLpuVv8RCCNPTsSNbzpkhhc8VYCaUu-U4FwHKBeKXbw at mail.gmail.com<mailto:CAAJRSQdcLpuVv8RCCNPTsSNbzpkhhc8VYCaUu-U4FwHKBeKXbw at mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

Hello NCL users,

I am working for weekly rainfall.
From model simulation, I am getting daily rainfall files in the directory.

Now, I want to select last 7 days rainfall files from directory for present
date/days.

Files are storing in the dir like:
Day_1.csv
Day_2.csv
Day_3.csv
.
.
Day_7.csv
Day_8.csv
And
So on..

On day 7th, I want to select 1st weekly rainfall (i.e. 1st 7 files avg.)
And day 8th, it will take from Day_2 to Day_8 files and so on.

Please kindly inform me how to do the above in NCL.

Thanks in advance.

Regards,
Soma
********************************

@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@
Brian C. Thomas, PhD
Professor, Physics and Astronomy, Washburn University

785-670-2144<tel:(785)%20670-2144>
brian.thomas at washburn.edu<mailto:brian.thomas at washburn.edu>

Web: http://www.washburn.edu/faculty/bthomas/
ORCID profile: http://orcid.org/0000-0001-9091-0830
ResearchGate profile: https://www.researchgate.net/profile/Brian_Thomas

Department of Physics and Astronomy
Washburn University
1700 SW College Ave.<https://maps.google.com/?q=1700+SW+College+Ave.%0D+Topeka,+KS+66621&entry=gmail&source=g>
Topeka, KS 66621<https://maps.google.com/?q=1700+SW+College+Ave.%0D+Topeka,+KS+66621&entry=gmail&source=g>

@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210505/764a3f9e/attachment.html>


More information about the ncl-talk mailing list