Re: Error while trying run clmDayTLL

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 28 2012 - 06:43:15 MDT

The smthClmDayTLL and band_pass_latlon_time work on the time dimension.
These functions use an FFT which does not allow for missing values.

However ...

I speculate that the the grid has land and ocean grid points and that
grid points over the land or ocean are missing. The functions are
returning warning messages for those grid points. All poonts
that had a valid time series were processed.

If this is not the case then you will have to interpolate
in time with (say) linint1_N_Wrap

On 8/28/12 12:48 AM, abheera hazra wrote:
> Thank you very much for the reply. It seems functions such as
> smthClmDayTLL and band_pass_latlon_time don't accept missing values. May
> I know what might be the best way to deal with it?
>
> Best,
> Abheera
>
> On Sat, Aug 25, 2012 at 8:36 AM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> The issue is that you did not name the dimensions.
> From the clmDayTLL documentation:
>
> x
>
> A three-dimensional array (time, lat, lon).
> The dimensions must be named. <====
> The Description section shows how to do this.
>
> Normally, variables from netCDF of HDF are named.
> Since, the data are from a binary file, the user
> must provide this information.
>
> A few comments:
>
> -------
> Rather than multiple do loops to create yyyyddd:
>
> remove:
> yyyyddd = new(1096,integer)
> and the 3 do loops. Use
>
> load "$NCARG_ROOT/lib/ncarg/__nclscripts/csm/contributed.__ncl"
>
> date = yyyymmdd_time(2007,2009, "integer") ; yyyymmdd
> yyyyddd = yyyymmdd_to_yyyyddd( date )
> print("date="+date+" yyyyddd="+yyyyddd)
>
> http://www.ncl.ucar.edu/__Document/Functions/__Contributed/yyyymmdd_time.__shtml
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymmdd_time.shtml>
>
> http://www.ncl.ucar.edu/__Document/Functions/__Contributed/yyyymmdd_to___yyyyddd.shtml
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymmdd_to_yyyyddd.shtml>
> -------
>
> ntim = dimsizes(yyyyddd)
>
> and replace
>
>
> xin = new((/1096,27,121,240/),"__float")
>
> with
> xin = new((/ntim,27,121,240/),"__float")
>
> actually, I'd suggest not hard-wiring any constants
>
> klev = 27
> nlat = 121
> mlon = 240
> xin = new((/ntim,klev,nlat,mlon/),"__float")
>
> This will facilitate future reuse with different array sizes.
>
> ***********
> Further, name the dimensions. *Any* unique identifier can be used
> for the dimension names. Common, names are
>
> xin!0 = "time" ; "T", "temporal_dimension",......
> xin!1 = "lev"
> xin!2 = "lat"
> xin!3 = "lon"
>
> ***********
> The
>
> set_default_fillvalue("float", 9.999e20)
>
> should be placed before you read from the binary files
>
> =========
> Also, replace the levelel loop with
>
> nDAY = 366
> xclim = new((/nDAY,klev,nlat,mlon/),"__float")
>
> do i=0,klev-1
> print("i="+i) ; debug
> xout = clmDayTLL(xin(:,i,:,:),__yyyyddd)
> printVarSummary(xout) ; debug
>
> xclim(:,i,:,:) = smthClmDayTLL(xout, 3)
> end do
>
> ++++++++++++++++++++++++++++++__+++++++
> You can always look at the script being used
>
> %> less $NCARG_ROOT/lib/ncarg/__nclscripts/csm/contributed.ncl
>
> search for 'function clmDayTLL' or 'smthClmDayTLL'
>
> Any number of harmonics (up to 365/2)
>
>
>
>
>
>
> On 8/24/12 6:26 PM, abheera hazra wrote:
>
> Hi,
>
> I am trying to use the function clmDayTLL, I am using binary
> data for
> input, so I create the yyyyddd variable, since the function says
> it is
> an integer array, that is how i declare it initially, here is my
> code;
>
> ****************
>
> load "$NCARG_ROOT/lib/ncarg/__nclscripts/csm/contributed.__ncl"
>
> pathi = new(10,string)
> patho = new(10,string)
>
> yyyyddd = new(1096,integer)
> xin = new((/1096,27,121,240/),"__float")
> xcl = new((/1096,121,240/),"float")
> xclim = new((/366,27,121,240/),"float"__)
> ;xout = new((/366,121,240/),"float")
> ;xout!0="year_day"
> ;yyyyddd!0="year_day";xcl!0="__year_day"
>
> pathi(1)= "/project/dheat.mean.2007"
> pathi(2)= "/project/dheat.mean.2008"
> pathi(3)= "/project/monisi/dheat.mean.__2009"
>
> patho(1)= "/project/dheat.clim.leap"
> patho(2)= "/project/dheat.clim"
>
> patho(3)= "/project/dheat.anom.2007/"
> patho(4)= "/project/dheat.anom.2008/"
> patho(5)= "/project/dheat.anom.2009/"
>
>
> k=-1
> do j=1,365
> k=k+1
> yyyyddd(k)= 2007*1000+j
> ; print (k)
> end do
>
> k=364
> do j=1,366
> k=k+1
> yyyyddd(k)= 2008*1000+j
> ; print (k)
> end do
>
> k=730
> do j=1,365
> k=k+1
> yyyyddd(k)= 2009*1000+j
> ; print (k)
> end do
>
> print ("yyyyddd")
>
> nrec = 0
> dims = (/365,27,121,240/)
> x1 = fbindirread(pathi(1), nrec, dims, "float")
>
> dims = (/366,27,121,240/)
> x2 = fbindirread(pathi(2), nrec, dims, "float")
>
> dims = (/365,27,121,240/)
> x3 = fbindirread(pathi(3), nrec, dims, "float")
> set_default_fillvalue("float", 9.999e20)
>
> print ("dheat mean files read")
>
> xin(0:364,:,:,:) = x1(0:364,:,:,:)
> xin(365:730,:,:,:) = x2(0:365,:,:,:)
> xin(731:1095,:,:,:) = x3(0:364,:,:,:)
>
> print ("dbh rewritten")
> set_default_fillvalue("__integer", 10000000000)
>
> ;
>
> do i=0,26
> xcl(0:1095,0:120,0:239) = xin(0:1095,i,0:120,0:239)
> print ("xcl <- xin")
> xout = clmDayTLL(xcl,yyyyddd)
> print("clm")
> xoutsm = smthClmDayTLL(xout, 3)
> print("smoothed")
> xclim(:,i,:,:) = xoutsm(:,:,:)
> end do
>
> print ("smoothed climatology")
>
> ****************
>
>
> But I keep getting the following error
>
>
> *****************
>
> Copyright (C) 1995-2011 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> (0) yyyyddd
> (0) dheat mean files read
> (0) dbh rewritten
> (0) xcl <- xin
> warning:Attempt to reference attribute (year_day) which is undefined
> (0) clm
> fatal:(missing) is not a dimension name in variable (clmDay),
> could not
> determine dimension number
> fatal:Execute: Error occurred at or near line 3969 in file
> $NCARG_ROOT/lib/ncarg/__nclscripts/csm/contributed.ncl
>
> fatal:Execute: Error occurred at or near line 84 in file clim.ncl
>
> *****************
>
> Would like to know where I'm going wrong,
>
> Also, for the function smthClmDayTLL, how many harmonics can one
> include? The NCL site mentions generally 2 or 3, but is it
> possible to
> have more harmonics included?
>
> Thanks,
> Abheera
>
>
> _________________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/__mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 28 06:43:34 2012

This archive was generated by hypermail 2.1.8 : Tue Aug 28 2012 - 08:53:45 MDT