[ncl-talk] two miising values

Mary Haley haley at ucar.edu
Fri Jun 3 13:07:43 MDT 2016


Geeta,

As I mentioned in an earlier email, the '-88.88' value may not be exact.
If you look at your output, you had values like this:

-99.98999999999999

The -88.88 values may be the same situation, i.e., they may be:

-88.8777777777777

or similar.

To catch this possible roundoff error, Use "-88.8" instead of "-88.88", and
use ".lt" instead of ".eq":

    RF_fnl          =  where(RF_with_missing.lt.-88.8,-RF_with_missing@
_FillValue,RF_with_missing)

--Mary




On Fri, Jun 3, 2016 at 11:07 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

> Hi Mary.
> There was some problem with the earlier script that I sent you. Pl s look
> at this one.
> this is the output.
> 0) 9247
> (1) 49
>
> Variable: RF_flt
> Type: float
> Total Size: 144992960 bytes
>             36248240 values
> Number of Dimensions: 3
> Dimensions and sizes: [9247] x [49] x [80]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : -9999
> (0)
> (0) min=-8888   max=9783
>
> Variable: RF_with_missing
> Type: double
> Total Size: 289985920 bytes
>             36248240 values
> Number of Dimensions: 3
> Dimensions and sizes: [9247] x [49] x [80]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : -9999
> (0)
> (0) min=-88.88   max=97.83
>
> Variable: RF_fnl
> Type: double
> Total Size: 289985920 bytes
>             36248240 values
> Number of Dimensions: 3
> Dimensions and sizes: [9247] x [49] x [80]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : -9999
> (0)
> (0) min=-88.88   max=97.83
> aditya at agniilap:~/geeta/ncl/ReadHDF-2A25$
>
> RF_with_missing has min value of -88.88,  After where statement, the
> -88.88 is not replaced by -9999.
>
> thank you for your help
>
> Geeta.
>
>
> On Friday, 3 June 2016 9:50 PM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>
>
> Thanks Mary.
> I am sending my code and pls tell me where to upload the data?.
> This is output now. I made changes as you told.
> (0) min=-9999   max=9783
>
> Variable: RF_fnl
> Type: double
> Total Size: 289985920 bytes
>             36248240 values
> Number of Dimensions: 3
> Dimensions and sizes: [9247] x [49] x [80]
> Coordinates:
> (0)
> (0) min=-99.98999999999999   max=97.83
> (0)
> (0) min=-99.98999999999999   max=1.85
> (0)
> (0) min=-99.98999999999999   max=1.48
> (0)
> (0) min=-99.98999999999999   max=1.58
> (0)
> (0) min=-99.98999999999999   max=1.73
> (0)
> (0) min=-99.98999999999999   max=1.99
> (0)
> (0) min=-99.98999999999999   max=2.6
> (0)
> (0) min=-99.98999999999999   max=1.7
>
> Variable: RF_fnl
> Type: double
> Total Size: 289985920 bytes
>             36248240 values
> Number of Dimensions: 3
> Dimensions and sizes: [9247] x [49] x [80]
> Coordinates:
> Number Of Attributes: 2
>   lat2d : <ARRAY of 453103 elements>
>   lon2d : <ARRAY of 453103 elements>
> (0)
> (0) min=-99.98999999999999   max=97.83
> aditya at agniilap:~/geeta/ncl/ReadHDF-2A25$
>
>
> Geeta.
>
>
> On Friday, 3 June 2016 8:22 PM, Mary Haley <haley at ucar.edu> wrote:
>
>
> Geeta,
>
> Are the -999900 and -888800 values correct? They seem a bit odd.  Perhaps
> you are supposed to divide the data by the scale_factor rather than
> multiple by it.  I think the "short2flt" function does a multiply.
>
> Try this (UNTESTED):
>
>    RF_short  =  hdf4_file->rain
>    printVarSummary(RF_short)
>    printMinMax(RF_short,0)
>    Rf_fnl  = tofloat(RF_short) / RF_short at scale_factor
>    copyVarMeta(RF_short,Rf_fnl)
>
>    printVarSummary(Rf_fnl)
>    printMinMax(Rf_fnl,0)
>    Rf_fnl  =  where(Rf_fnl.eq.-88.88,Rf_fnl at _FillValue,Rf_fnl)
>    printMinMax(Rf_fnl,0)
>    Rf_fnl at lon2d      =  longitude
>    Rf_fnl at lat2d      =  latitude
> I added several "printVarSummary" and "prinMinMax" calls to make sure that
> the conversions are working at every step.
> If this continues to fail, it would help if I could have access to your
> latest script and data.
> --Mary
>
> On Fri, Jun 3, 2016 at 2:04 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>
> thanks Mary for your suggestions..
> I was able to get the plot but I am getting a band like structure in the
> plot that is middle part is white. Dont know why???
>
> can u pls suggest.
>
> Geeta.
>
>
> On Friday, 3 June 2016 3:29 AM, Mary Haley <haley at ucar.edu> wrote:
>
>
>
> Geeta,
>
> You will need to approach this with two steps.
>
> First, since this data is of type "short" and has scale_factor and
> add_offset attributes, you should read the data using "short2flt", which
> will apply these attributes for you. Afterwards, use "printVarSummary" and
> "printMinMax" to make sure the data looks okay.
>
> Second, whenever your data has multiple missing value values, you can use
> the "where" function
>
> First, use "-9999" as your standard missing value:
>
> rf at _FillValue = -9999
>
> Now that "-9999" is a recognized missing value, you can then coerce the
> -88.88 value to missing as well:
>
>   rf = where(rf.eq.-88.88,rf at _FillValue,rf)
>
> Note: it's not generally a good idea to do a straight comparison of float
> data with "if(x.eq.12.34)" type of comparisons. If you know that all your
> data is positive, for example, except for the potential -88.88 value, then
> a better way to do this is:
>
>   rf = where(rf.lt.0,rf at _FillValue,rf)
>
> Or, if you feel more comfortable about comparing values that are closer to
> -88.88. then use a roundoff of -88:
>
>   rf = where(rf.lt.-88,rf at _FillValue,rf)
>
> This will then catch anything less than -88 and set it to missing.
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
> http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml
>
> --Mary
>
>
> On Thu, Jun 2, 2016 at 12:37 PM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>
> I am using TRMM data that has rain rate in vertical up to 20 km from the
> Radar .
> the variable "rain" has data type as short
> Variable: RF
> Type: short
> Total Size: 72496480 bytes
>             36248240 values
> Number of Dimensions: 3
> Dimensions and sizes: [nscan | 9247] x [nray | 49] x [ncell1 | 80]
> Coordinates:
> Number Of Attributes: 9
>   lat2d : <ARRAY of 453103 elements>
>   lon2d : <ARRAY of 453103 elements>
>   scale_factor : 100
>   scale_factor_err :   0
>   add_offset :   0
>   add_offset_err :   0
>   calibrated_nt : 22
>   units : mm/hr
>   hdf_name : rain
> (0)
> (0) min=-9999   max=9783
>
> It has two types of missing values -88.88 (referrred to as the ground
> clutter) and -9999 as the missing value.
> I have to plot this data . ho w should i put two values as miising?
> I am getting a plot like this.
>
> Geeta.
>
> _______________________________________________
> 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/20160603/b1e9faa0/attachment.html 


More information about the ncl-talk mailing list