Re: Changing FillValues

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 30 2011 - 12:12:59 MDT

Hi Adrian,
You just need to delete the existing _FillValue attribute first.

delete(var@_FillValue)
then:

 var@_FillValue=integertoshort(-3333) ; note with current versions of NCL you can instead say: var@_FillValue = -3333h (h means short -- think half of a full integer size)
 var=where(var.lt.0,var@_FillValue,var)

Note a slightly simpler
On Jun 30, 2011, at 12:07 PM, Tompkins Adrian wrote:

> hello,
>
> sorry, I used to know how to do this, but I have forgotten and I can't
> find the solution on the search NCL pages.
>
> I have a variable (cloudsat data) that has the FillValue defined as
> zero, while missing values have a variety of negative value flags (e.g.
> -3333, -4444 and so on).
>
> I wanted to set the fillvalue to -3333, and then set all negative
> numbers to the fillvalue, while leaving the zeros unchanged (i.e. they
> are not really missing...)
>
> I did this
>
> ;
> ; set all negative values to missing values.
> ;
> var@_FillValue=integertoshort(-3333)
> var=where(var.lt.0,var@_FillValue,var)
>
> but the first line changes all the Zeros to -3333...
>
> How can I "define" the missing/fillvalue as -3333 without changing the
> zeros in the field array?
>
> Many thanks,
>
> Adrian
>
>
> --
> Adrian Tompkins | Earth System Physics
> +39 040 2240579 (office) | ICTP (UNESCO-IAEA)
> +39 040 2240449 (fax) | Strada Costiera 11
> www.ictp.it | 34151 Trieste, Italy
> _______________________________________________
> 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
Received on Thu Jun 30 12:13:16 2011

This archive was generated by hypermail 2.1.8 : Thu Jun 30 2011 - 12:54:44 MDT