Re: find missing days, set to a nodata value

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 09 2013 - 12:12:41 MST

Hi Leif,
This might not be the most efficient way to do it, but I would try using
yyyyymmdd_time and coordinate subscripting like this:

; Untested!! Make sure to check that the resulting array is correct.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
a = addfile("in.nc","r")
tmean = a->tmean
tmean@_FillValue = 1.e20
date = cd_calendar(a->date,-2) ; convert date to YYYYMMDD format

yyyymmdd = *yyyymmdd_time*(1979, 2013, "integer")

finarr = new(dimsizes(yyyymmdd),typeof(tmean),1.e20)
finarr!0 = "time"
finarr&time = yyyymmdd

do gg = 0,dimsizes(tmean)-1
; print(date(gg)+" "+tmean(gg))

      finarr({date(gg)}) = (/ tmean(gg) /)

; print(finarr({date(gg)}))
end do
print(finarr&time+" "+finarr)

end

Please take a good look at the resulting finarr array to make sure the
above is working as intended..
Hope that helps!
Adam

On 12/09/2013 11:10 AM, Leif Truelsen wrote:
> Hello,
>
> I am dealing with daily AWS data that cover multiple years, but only
> on days in which observations occurred or where they met some sort of
> quality filter. For example,
>
> day tmean
> 1980-01-01 -3.3
> 1980-01-02 -2.1
> 1980-01-04 0.2
> 1980-01-05 0.4
> ...
>
> I want to parse through the data and set days where there are no
> observations (e.g., 1980-01-03 as above) to a FillValue. I don't want
> them to simply be skipped, but recorded as a missing observation. Can
> anyone help me understand how to do this? Below is the information
> for my netcdf file as I have it currently. Many thanks for your
> assistance.
>
> file global attributes:
> dimensions:
> date = 10348
> variables:
> float pdd ( date )
> units : deg C
> long_name : daily pdd sum from daily mean temperature
>
> float tmean ( date )
> units : deg C
> long_name : daily mean temperature
>
> double date ( date )
> _FillValue : 9.969209968386869e+36
> calendar : standard
> units : days since 1950-01-01 00:00:00
>
> integer year ( date )
>
> integer month ( date )
>
> integer day ( date )
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/staff/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 9 12:12:53 2013

This archive was generated by hypermail 2.1.8 : Fri Dec 13 2013 - 11:39:30 MST