Re: argument mismatch issue

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 17 2011 - 12:22:14 MDT

You are not looking at your data.

> dataShort = inFile->pr({filtStart:filtEnd},:,:)
> printVarSummary(pr)
> data = doubletofloat( dataShort )
> printVarSummary(data)

Why are you doing this?

You variable naming can be quite confusing:

   dataShort = inFile->pr({filtStart:filtEnd},:,:)

Is 'pr' type short?

Then you use

   data = doubletofloat( dataShort )

Why?

The whole purpose of printVarSummary(...)
is for *you* to look at your data.

We are not paid to answer ncltalk questions
and our time is valuable too!

Please make your questions and scripts cleaner.

===

If 'pr' is type short use the contributed.ncl function
'short2flt' to perform the proper conversion.

http://ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml

There are many type conversion function

http://ncl.ucar.edu/Document/Functions/

On 10/17/2011 11:41 AM, Coly SAR wrote:
> Mary,
>
> In fact, it is the kf script which requires the reodering to have time,
> lat and lon. The program works fine when i use olr
> short olr(time, lat, lon)
>
> when i use other variable as below
>
> double pr(time, lat, lon)
> I am having the error.
>
> Here are a few the lines of the code
>
>
> CS
>
>
> ; open the file
> fileName = "clm_pr_9600.nc <http://clm_pr_9600.nc>"
> inFile = addfile( fileName, "r" )
> obsPerDay = 1
>
> ; find our times
> time = inFile->time
> ; lon = inFile->lon
> ; lat =inFile->lat
> pr = inFile ->pr
> filtStart = ut_inv_calendar( 1996, 01, 01, 0, 0, 0, time@units, 0)
> filtEnd = max(time)
> ;startDate = filtStart + 192 * 24
> ;endDate = filtEnd - 192 * 24
> startDate = filtStart
> endDate = filtEnd
> ; read in the unfiltered data
> print( "Reading the data..." )
> dataShort = inFile->pr({filtStart:filtEnd},:,:)
> printVarSummary(pr)
> data = doubletofloat( dataShort )
> printVarSummary(data)
> es= data
>
> es(time|:,lat|y,lon|:) = (/ kf_filter( data(time|:,lat|y,lon|:), \\
> obsPerDay, 2, 10, -20, -6, 90, mis, "mrg" ) /)
>
> ******************************************************************************
>
> 2011/10/17 Mary Haley <haley@ucar.edu <mailto:haley@ucar.edu>>
>
> CS,
>
> The error is telling you what the problem is. You are trying to
> reorder "data" by using named dimensions "time", "lat", "lon",
> but as you can see from the printVarSummary command, "data" doesn't
> have any named dimensions.
>
> The printVarSummary of "data" makes it look like it is already
> ordered time x lat x lon (I'm assuming this because
> the first dimension is rather large, so that's likely a time
> dimension, and the second dimension is about half the
> size of the third dimension, so this looks like lat x lon).
>
> If "data" is already time x lat x lon, then don't use dimension
> reordering:
>
> es(time|:,lat|y,lon|:) = (/ kf_filter( data,obsPerDay, 2, 10,
> -20, -6, 90, mis, "mrg" ) /)
>
> I don't know why you have the reordering on the left side as well.
> Are you sure you need to do this?
>
> --Mary
>
> On Oct 16, 2011, at 10:18 AM, Coly SAR wrote:
>
>> I had a progress but having an error in variable data with no
>> specified time , lat ,lon
>> ............................
>> Variable: data
>> Type: float
>> Total Size: 75221244 bytes
>> 18805311 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [1827] x [73] x [141]
>> Coordinates:
>> Number Of Attributes: 1
>> _FillValue : -9.99e+08
>> (0) Filtering...dim oct 16 16:13:54 GMT 2011
>> fatal:(lat) is not a named dimension in variable (data).
>> fatal:Execute: Error occurred at or near line 83
>>
>> CS
>>
>> 2011/10/16 Dennis Shea <shea@ucar.edu <mailto:shea@ucar.edu>>
>>
>> This type of error can be diagnosed by doing a
>> printVarSummary(...)
>> of kf_filter and es. Or, print(typeof(kf_filter)) and
>> print(typeof(es))
>>
>> Perhaps, kf_filter is type double and es is type float? If so,
>>
>> es(time|:,lat|y,lon|:) = tofloat( \
>>
>> (/ kf_filter( data(time|:,lat|y,lon|:), \
>> obsPerDay, 2, 10, -20, -6, 90, mis, "mrg" ) /) )
>>
>>
>> On 10/16/11 9:08 AM, Coly SAR wrote:
>>
>> Dear all,
>>
>> I am having a mismatch argument error when running a
>> script with my data
>> as shown below:
>>
>> Number of Dimensions: 3
>> Dimensions and sizes: [time | 1827] x [lat | 73] x [lon
>> | 141]
>> Coordinates:
>> time: [ 0..2629440]
>> lat: [-0.5..35.5]
>> lon: [-22.5..47.5]
>> Number Of Attributes: 1
>> _FillValue : -999000000
>> (0) 0 72 dim oct 16 14:55:40 GMT 2011
>> fatal:Argument type mismatch on argument (0) of
>> (kf_filter) can not coerce
>> fatal:Execute: Error occurred at or near line 97
>>
>> Hoping to have a hint to solve this urgent problem.
>>
>> The line of the code is below:
>>
>> es(time|:,lat|y,lon|:) = (/ kf_filter(
>> data(time|:,lat|y,lon|:), \\
>> obsPerDay, 2, 10, -20, -6, 90, mis, "mrg" ) /)
>>
>> Thanks,
>>
>> CS
>>
>>
>>
>> _________________________________________________
>> 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
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 17 12:22:21 2011

This archive was generated by hypermail 2.1.8 : Tue Oct 18 2011 - 09:42:15 MDT