[ncl-talk] error using kf_filter

Dennis Shea shea at ucar.edu
Tue Jul 7 13:25:03 MDT 2020


To be clear, the *kf_filter*
<https://www.ncl.ucar.edu/Document/Functions/User_contributed/kf_filter.shtml>
function is donated software. It has been successfully used by users.
However, NCL developers did not create the function or documentation.

The documentation shows:

	function kf_filter (
		x      [*][*] : *numeric*,
		obsPerDay [1] : *integer*,
		tMin      [1] : numeric,
		tMax      [1] : numeric,
		kMin      [1] : numeric,
		kMax      [1] : numeric,
		hMin      [1] : numeric,
		hMax      [1] : numeric,
		waveName  [1] : string  )

The actual functions has:

function kf_filter( inData[*][*]*:float*, obsPerDay:*numeric*, \\
                    tMin:numeric, tMax:numeric, kMin:numeric, kMax:numeric, \\
                    hMin:numeric, hMax:numeric, waveName:string )

Hence, there is an inconsistency with the 1st two argument types.

Argument 'counting' starts at 0. So the

"*warning:Argument 0 of the current function or procedure was coerced to
the appropriate type and thus will not change if the function or procedure
modifies its value*

refers to   'data(time|:,{lat|lat(y)},lon|:)'  ==> dummy argument -->
indata[*][*]:float

So, if 'data' is (say) type "double" or type "integer" the NCL will force a
temporary array of type "float"to be created. The function will operate on
the temporary array. Note, NCL's conversion will not  preserve meta data.

My suggestion is for the user to explicitly convert this to type "float"

     DATA = *dble2flt*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/dble2flt.shtml>
(data(time|:,{lat|lat(y)},lon|:))

 prior to use.

==========
  Then

%> cp $NCARG_ROOT/lib/ncarg/nclscripts/contrib/kf_filter.ncl
debashis.kf_filter.ncl

load debashis.kf_filter.ncl

and add print statement to the above file to determine where these errors
occur

*fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*
*fatal:["NclAtt.c":262]:Attribute assignment type mismatch*
*fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*
*fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*


*Good Luck*






On Tue, Jul 7, 2020 at 10:46 AM Debashis Paul via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> hello folks, I am trying to filter out mjo waves from u wind data by using
> the kf_filter, providing the specific wave period and number for mjo wave.
> While doing so am getting an error which is :
> "*warning:Argument 0 of the current function or procedure was coerced to
> the appropriate type and thus will not change if the function or procedure
> modifies its value*
> *fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*
>
> *fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*
>
> *fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*
>
> *fatal:["NclAtt.c":262]:Attribute assignment type mismatch.*
>
> *fatal:Assignment type mismatch, right hand side can't be coerced to type
> of left hand side*
> *fatal:["Execute.c":8637]:Execute: Error occurred at or near line 114 in
> file flt_wv_lan_20.nc <http://flt_wv_lan_20.nc>*l".
> I am not able to get where am doing wrong. I am providing the code as an
> attachment, if anyone can say me where am doing wrong it will be highly
> appreciated.The data I am using is from era-5 and no. of observations is 1
> per day.
>
> With regards,
> DP
> *************************************
> *Debashis Paul*
>
> *Research Scholar,NIT-RKL*
> *Ph:+916002713628*
> *E-mail: Debgeo668 at gmail.com <Debgeo668 at gmail.com>*
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200707/ca901fb0/attachment.html>


More information about the ncl-talk mailing list