[ncl-talk] Difficulty Dealing with Data File Times

Dennis Shea shea at ucar.edu
Mon Jun 24 09:28:21 MDT 2019


Quite frankly, a rather intimidating request! A bit too much information.

NCL has a suite of functions: *calculate_daily_values
<http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml>*,

*calculate_monthly_values ,
<http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_monthly_values.shtml>calculate_segment_values
<http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_segment_values.shtml>*

A companion function which for some reason  was never distributed is:*
calculate_hourly_values*
Attached is a stripped down version. It may not be quite what you want but
it may be a start.
This allows the user to set some minimum number of values for a returned
value. The default is one.
opt = True
opt at nval_crit = 5           ; this would require 5 or more hourly values
for a mean to be returned

Using the 1st 1500 data lines ...

Variable: *slwHourAvgMax*
Type: float
Total Size: 112 bytes
            28 values
Number of Dimensions: 1
Dimensions and sizes: *[ob_time | 28]      <=== 28 hourly means*
Coordinates:
            ob_time: [56.80763888889002..57.91666666666666]
Number Of Attributes: 2
  _FillValue : 9.96921e+36
  NCL_tag : calculate_hourly_values: arith=avg
(0) min=0.000818031   max=0.198065
(0) ------
    *yyyymmddhh*
(0) 2008122719  0.0306192
(1) 2008122720  0.0442881
(2) 2008122721  0.0436597
(3) 2008122722  0.0160423
(4) 2008122723  0.0122796
(5) 2008122800  0.0332206
(6) 2008122801  0.0570931
(7) 2008122802  0.0539767
(8) 2008122803  0.067338
(9) 2008122804  0.0339982
(10) 2008122805  0.0131879
(11) 2008122806  0.0279825
(12) 2008122807  0.0184872
(13) 2008122808  0.0301441
(14) 2008122809  0.0453946
(15) 2008122810  0.0330844
(16) 2008122811  0.0905933
(17) 2008122812  0.198065
(18) 2008122813  0.158521
(19) 2008122814  0.181076
(20) 2008122815  0.11006
(21) 2008122816  0.071633
(22) 2008122817  0.0585721
(23) 2008122818  0.0293247
(24) 2008122819  0.0349052
(25) 2008122820  0.0120921
(26) 2008122821  0.00302336
(27) 2008122822  0.000818031


*---*
Also: a non-starter for people who might look ... there are many:

*warning:tofloat*: A bad value was passed to (string) tofloat, input
strings must contain numeric digits, replacing with missing value
Why? One example ... note the '*e*' . Maybe Excel or some other tool
recognizes the but NCL does not. NCL return an _FillValue.

2008,12,28,22,38,52,270.5,0,0,1.27150982867121*e*,5,,,

Other lines also have some ?hidden? not recognized values.

*%>* ncl import.ncl

===


On Sat, Jun 22, 2019 at 5:27 PM Zach Rieck via ncl-talk <ncl-talk at ucar.edu>
wrote:

> To Whom it May Concern-
>
> I'm having a great deal of trouble sorting out how to deal with the times
> on this data file (attached). The times provided are by the minute and need
> to be converted into hourly averages for slw. The biggest issues are that
> both the 1st data value and last data value occur during the middle of the
> day in the middle of an hour. So  I'm needing to skip a number of lines so
> the data starts and ends on an even hour.
>
> Further complicating things is the fact that the WRF data I'm using is
> Oct-Mar (with Oct skipped), but April is included in this file. So if I
> include the WRF file for Apr-June, I will have to skip 2 additional months
> for every year.
>
>  Please advise on the easiest way to deal with these issues. I've attached
> my code as well, which works for a general import of the data, but none of
> the times match up yet.
>
> Thanks in advance, and please let me know if anything isn't clear or can
> be explained better.
>
> Respectfully,
>  Cedar_Creek_Radiometer.csv
> <https://drive.google.com/file/d/1f9Mv5gV4BCadRzAOtAr1YXUODcawlYPx/view?usp=drive_web>
>
> -Zach Rieck
> zrr817 at gmail.com
> (513)-502-5652
> _______________________________________________
> 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/20190624/494181e6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: calculate_hourly_values.ncl
Type: application/octet-stream
Size: 6651 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190624/494181e6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: import.ncl
Type: application/octet-stream
Size: 3425 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190624/494181e6/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: import.ncl_data_debug
Type: application/octet-stream
Size: 1056 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190624/494181e6/attachment-0002.obj>


More information about the ncl-talk mailing list