[ncl-talk] Masked data
ali mughal
mughalali655 at gmail.com
Mon Nov 29 19:43:53 MST 2021
Thank you so much for your kind response
Please the outputs of each print statement below. I am still seeing the
same result as described in my earlier email
*printVarSummary(marray)*
Variable: marray
Type: integer
Total Size: 108360 bytes
27090 values
Number of Dimensions: 2
Dimensions and sizes: [ncl0 | 129] x [ncl1 | 210]
Coordinates:
Number Of Attributes: 1
_FillValue : -2147483647
*printMinMax(marray, False)*
(0) min=0 max=1
(0) -----------------
*printVarSummary(lu_mask)*
Variable: lu_mask
Type: float
Total Size: 108360 bytes
27090 values
Number of Dimensions: 3
Dimensions and sizes: [1] x [129] x [210]
Coordinates:
Number Of Attributes: 1
_FillValue : 9.96921e+36
*printMinMax(lu_mask, False)*
(0) min=2 max=40
(0) -----------------
*print("n11=" +n11)*
* print("n17=" +n17)*
(0) n11=0
(0) n17=623
(0) -----------------
*printVarSummary(lu_index)*
Variable: lu_index
Type: float
Total Size: 108360 bytes
27090 values
Number of Dimensions: 3
Dimensions and sizes: [1] x [129] x [210]
Coordinates:
Number Of Attributes: 1
_FillValue : 9.96921e+36
*printMinMax(lu_index, False)*
(0) min=2 max=40
(0) -----------------
*printVarSummary(lu_index)*
Variable: lu_index
Type: float
Total Size: 108360 bytes
27090 values
Number of Dimensions: 3
Dimensions and sizes: [Time | 1] x [south_north | 129] x [west_east | 210]
Coordinates:
Number Of Attributes: 9
NCL_task : Index 17 replaced with 11
FieldType : 104
MemoryOrder : XY
units : category
description : Dominant category
stagger : M
sr_x : 1
sr_y : 1
_FillValue : 9.96921e+36
*printMinMax(lu_index, False)*
(0) Dominant category: min=2 max=40
(0) -----------------
On Tue, Nov 30, 2021 at 4:13 AM Dennis Shea <shea at ucar.edu> wrote:
> Maybe .... code is not tested
>
> +++always use PrintVarSummary when debugging+++
>
> a = addfile("geo_em.nc","w")
> lu = wrf_user_getvar(a,"LU_INDEX",-1)
>
> f = addfile("wrf_mask.nc","r")
> marray = f->WRF_mask
> printVarSummary(marray)
> printMinMax(marray, False)
> print("-----------------")
>
>
> lu_mask = mask(lu,marray,1)
> printVarSummary(lu_mask)
> printMinMax(lu_mask, False)
> print("-----------------")
>
> n11 = num(lu_mask.eq.11)
> n17 = num(lu_mask.eq.17)
> print("n11="+n11+ ; n17="+n17)
> print("-----------------")
>
> lu_index = where(lu_mask.eq.17, 11, lu) ; replace
> value
> printVarSummary(lu_index)
> printMinMax(lu_indek, False)
> print("-----------------")
>
> a->LU_INDEX = *(/* lu_index* /)* ;
> overwrite values on netCDF file
> or
>
> copy_VarMeta(lu, lu_index)
> lu_index at NCL_task "Index 17 replaced with 11" ; add informative
> attribute
> printVarSummary(lu_index)
> printMinMax(lu_index, False)
> print("-----------------")
>
> a->LU_INDEX = lu_index ; replace values and
> add new meta data
>
> On Mon, Nov 29, 2021 at 1:11 AM ali mughal via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear NCL users
>> I use the following simple code to create map (C) in the attached image.
>> As you can see, I am trying to change the land use index inside the mask
>> from 17 to 11, which I succeeded in achieving. However, due to masking I
>> lose the rest of the data.
>>
>> a = addfile("geo_em.nc","w")
>> lu=wrf_user_getvar(a,"LU_INDEX",-1)
>> f = addfile("wrf_mask.nc","r")
>> marray = f->WRF_mask
>> lu_mask = mask(lu,marray,1)
>> a->LU_INDEX=where(lu_mask .eq. 17,11,a->LU_INDEX)
>>
>> To correct this problem I do step D and E in the attached image but I
>> still am unable to achieve the required result. Can someone tell me how to
>> correct this issue ?
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20211130/08264709/attachment.html>
More information about the ncl-talk
mailing list