[ncl-talk] do loop and average

Mary Haley haley at ucar.edu
Wed Nov 9 09:45:38 MST 2016


Debasish,

Sorry for the delayed response.  I'm not sure I understand your question
fully, because you said "9z data will be average of 8z and 10z", but I
assume you meant "between 8z and 10z".  Also, if you are talking 3-hourly
data, are you sure 8z to 10z is the correct range?

Anyway, just to show how you can pick off the desired hours and calculate
the average of that range, I've written a simple NCL script that reads your
CSV data, pulls off the "hour" values separately, and shows how to get all
the indexes of a particular hour range (8-10) to get an average of the
rainfall data for those indexes.

I wasn't really satisfied with this, so I wrote a more complicated script
that loops through the hours in steps of 3 to collect the averages for each
3-hour period.

Hopefully this will help you get started. I've attached both scripts.


--Mary




On Sun, Nov 6, 2016 at 10:18 AM, Debasish Hazra <debasish.hazra5 at gmail.com>
wrote:

> Hi,
>
> I have point observation data of for a month which are at irreular
> intervals in .csv format. I am readin it in year,month, day, hh format. But
> I would like to do averages at certain intervals to compare against 3
> hourly forecast of model. So I need to do average of the point data for all
> days ina month, such that for 9z data will be average of 8z and 10z, for
> 12z it is 11 and 13z, for 15z between 14z and 16z and for 18z it will be
> between 17z and 19z of the input. Any help on how to do that. Attached is
> input data and .txt ncl code.
>
> Thanks.
> Debasish.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161109/1e309605/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_csv.ncl
Type: application/octet-stream
Size: 1202 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161109/1e309605/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_csv_3hr.ncl
Type: application/octet-stream
Size: 1835 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161109/1e309605/attachment-0001.obj 


More information about the ncl-talk mailing list