Hi Liang,
The statement:
latentHeatAtt = 0
creates 'latentHeatAtt' as an integer, but the _FillValue
is created as a float, presumably matching the type of the variable
'latentHeat'.
In this case the fix is simple. Just create 'latentHeatAtt' as a float:
latentHeatAtt = 0.0
In other situations (e.g. you have a short type variable) it's not
quite so simple.
You would need to explicitly create the variable using 'new' before
assigning to it.
varAtt = new(1, short)
varAtt = integertoshort(0)
varAtt@_FillValue = integertoshort (-999)
Of course you could also define the _FillValue in the 'new' statement:
varAtt = new(1, short, integertoshort(-999))
Hope this helps,
-dave
On Sep 10, 2007, at 9:50 PM, Liang Guo wrote:
> Dear All,
>
> I am convert .hdf file to .nc file.
>
> I add missing value attribution to one of variables, as follow:
> ...
> latentHeatAtt = 0
> latentHeatAtt@_FillValue = -9999.9
> latentHeatAtt_at_units = "deg/hr"
> latentHeatAtt_at_long_name = "Latent Heating"
> filevarattdef( fout, "latentHeat", latentHeatAtt )
> ...
>
> But, it does not work. Here is the mistake information:
> "fatal:Type Mismatch: The type of missing value could not be
> converted to type of variable (latentHeatAtt)
> fatal:Execute: Error occurred at or near line 63 in file readNC.ncl"
>
> What's matter?
>
> Thanks.
>
> Liang
> 2007/09/11
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 11 2007 - 10:44:52 MDT
This archive was generated by hypermail 2.2.0 : Tue Sep 11 2007 - 10:46:49 MDT