[ncl-talk] fatal: Attribute assignment type mismatch
Mary Haley
haley at ucar.edu
Wed May 2 08:34:42 MDT 2018
Hi Anne,
If you ever get an NCL error you don't understand, you can visit the error
FAQ page:
http://www.ncl.ucar.edu/Document/Language/error_messages.shtml
There are a number of common error messages discussed here, along with the
type of code that causes the problem.
The "attribute assignment mismatch" is simply cause by assigning an
attribute to a variable, say:
res at cnMinLevelValF = -60
and then later trying to assign a new value to the same attribute, but with
a different type:
res at cnMinLevelValF = -30.
In the first case, cnMinLevelValF is being set to an integer, and in the
second a float is being used, which will cause the error because you are
trying to assign a float value to something that is already an integer. NCL
produces an error because it is a strongly-typed language, and this kind of
assignment could lead to possible loss of precision.
To fix the problem, you can use the reassignment operator:
res at cnMinLevelValF := -30.
In your case, I don't know where this error is occurring, since I am unable
to run your script. I don't think it has to do with the "levs" array,
because this is associated with coordinate arrays, and not attributes.
To find the source of the error message, you can temporarily comment out
the "begin" and "end" lines in your script:
;begin
....
;end
and then run the script with the -x option:
ncl -x zonal_T_test_polar.ncl
This will cause every line to get echoed as it is executed, and you should
be able to see the source of the problem.
--Mary
On Wed, May 2, 2018 at 6:24 AM, Anne <anne.seidenglanz at unive.it> wrote:
> Hello everybody,
>
> I am trying to plot and compare pressure-latitude plots of zonal wind of a
> control run vs. a sensitivity run (the control was created from someone
> else). There seems to be a problem with one of the files because of the
> error message 'fatal: Attribute assignment type mismatch' without any other
> comments.
>
> For the control zonal field, I created a new variable that would add level
> as a new dimension (see attached script), so as to end up with time x lev x
> lat x lon. The sensitivity zonal wind file already has the level dimension,
> so has time x lev x lat x lon as well.
>
> Is the assignment type mismatch because the dimensions are not exactly
> called in the same way between control and sensitivity (i.e. 'lev' and
> 'levs'), or is it related to the 'Copy_VarMeta' function?
>
> I know this error message has already been discussed here, but I do not
> seem to find a solution to this problem.
>
> Thanks for any help..
> Anne
>
>
>
> Nota automatica aggiunta dal sistema di posta.
>
> _______________________________________________
> 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/20180502/91a37e1d/attachment.html>
More information about the ncl-talk
mailing list