# [ncl-talk] two miising values

Mary Haley haley at ucar.edu
Mon Jun 6 11:53:47 MDT 2016

```Geeta,

The red color band represents all values less than 2.  I do see that your
data has a max of greater than 90, but it's possible that a large
percentage of your data is still less than 2.0, so you are going to get red
for these locations.

You can do some debugging to see where the bulk of your data is.  For
example:

res = True
res at cnLevels  =  (/2,3,4,5,6,10,12/)

nlevels = dimsizes(res at cnLevels)
print("# of values < " + res at cnLevels(0) + " = " + \
num(RF_fnl(:,:,61).lt.res at cnLevels(0)))
do n=0,nlevels-2
print("# of values >= " + res at cnLevels(n) + \
" and  < " + res at cnLevels(n+1) + " = " + \
num(RF_fnl(:,:,61).ge.res at cnLevels(n).and.\
RF_fnl(:,:,61).lt.res at cnLevels(n+1)))
end do
print("# of values >= " + res at cnLevels(nlevels-1) + " = " + \
num(RF_fnl(:,:,61).ge.res at cnLevels(nlevels-1)))

​Please try debugging some of these issues yourself.  I will be in a
workshop all week and won't have much time to continue helping you with
this.

--Mary
​

On Sat, Jun 4, 2016 at 1:48 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

> thanks Mary it worked and now the data looks reasonable.
> Pls find the plots for the layer 57 and layer 61 (where the rainrate is
> MAX).
> I am unable to understand why the Red Colored band is coming..
>
>
>
> Geeta.
>
>
> On Saturday, 4 June 2016 12:37 AM, Mary Haley <haley at ucar.edu> wrote:
>
>
> 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
>
> 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
>
>
> 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
> 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
> 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
>   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
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> 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/20160606/b2b4a7ac/attachment.html
```