<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thank you so much for your kind response</div><div dir="ltr">Please the outputs of each print statement below. I am still seeing the same result as described in my earlier email<div><br></div><div><br></div><div> <b>printVarSummary(marray)</b><br></div><div><br></div><div><div>Variable: marray</div><div>Type: integer</div><div>Total Size: 108360 bytes</div><div> 27090 values</div><div>Number of Dimensions: 2</div><div>Dimensions and sizes: [ncl0 | 129] x [ncl1 | 210]</div><div>Coordinates:</div><div>Number Of Attributes: 1</div><div> _FillValue : -2147483647</div><div><br></div><div><b>printMinMax(marray, False)</b><br></div><div>(0) min=0 max=1</div><div>(0) -----------------</div><div><br></div><div><br></div><div><b>printVarSummary(lu_mask)</b><br></div><div>Variable: lu_mask</div><div>Type: float</div><div>Total Size: 108360 bytes</div><div> 27090 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes: [1] x [129] x [210]</div><div>Coordinates:</div><div>Number Of Attributes: 1</div><div> _FillValue : 9.96921e+36</div><div><br></div><div><b>printMinMax(lu_mask, False)</b><br></div><div>(0) min=2 max=40</div><div>(0) -----------------</div><div><br></div><div><div><b>print("n11=" +n11)</b></div><div><b> print("n17=" +n17)</b></div></div><div><br></div><div><br></div><div>(0) n11=0</div><div>(0) n17=623</div><div>(0) -----------------</div><div><br></div><div><div><b>printVarSummary(lu_index)</b></div></div><div><br></div><div>Variable: lu_index</div><div>Type: float</div><div>Total Size: 108360 bytes</div><div> 27090 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes: [1] x [129] x [210]</div><div>Coordinates:</div><div>Number Of Attributes: 1</div><div> _FillValue : 9.96921e+36</div><div><div> </div><div><b>printMinMax(lu_index, False)</b></div></div><div>(0) min=2 max=40<br></div><div>(0) -----------------</div><div><b>printVarSummary(lu_index)</b><br></div><div>Variable: lu_index</div><div>Type: float</div><div>Total Size: 108360 bytes</div><div> 27090 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes: [Time | 1] x [south_north | 129] x [west_east | 210]</div><div>Coordinates:</div><div>Number Of Attributes: 9</div><div> NCL_task : Index 17 replaced with 11</div><div> FieldType : 104</div><div> MemoryOrder : XY</div><div> units : category</div><div> description : Dominant category</div><div> stagger : M</div><div> sr_x : 1</div><div> sr_y : 1</div><div> _FillValue : 9.96921e+36</div><div><b>printMinMax(lu_index, False)</b><br></div><div>(0) Dominant category: min=2 max=40</div><div>(0) -----------------</div></div><div><br></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 30, 2021 at 4:13 AM Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Maybe .... code is not tested</div><div><br></div><div>+++always use PrintVarSummary when debugging+++<br></div><div><br></div><div> a = addfile("<a href="http://geo_em.nc" target="_blank">geo_em.nc</a>","w")<br> lu = wrf_user_getvar(a,"LU_INDEX",-1)<br><br> f = addfile("<a href="http://wrf_mask.nc" target="_blank">wrf_mask.nc</a>","r")<br> marray = f->WRF_mask<br> printVarSummary(marray)<br> printMinMax(marray, False)<br> print("-----------------")<br> <br><br> lu_mask = mask(lu,marray,1)<br> printVarSummary(lu_mask)<br> printMinMax(lu_mask, False)<br> print("-----------------")</div><div><br></div><div><div> n11 = num(lu_mask.eq.11)</div></div><div> n17 = num(lu_mask.eq.17)</div><div> print("n11="+n11+ ; n17="+n17)<br></div><div><div> print("-----------------")</div><div><br></div></div><div> lu_index = where(lu_mask.eq.17, 11, lu) ; replace value<br></div><div><div> printVarSummary(lu_index)<br> printMinMax(lu_indek, False)<br> print("-----------------")</div><div><br></div><div> a->LU_INDEX = <b>(/</b> lu_index<b> /)</b> ; overwrite values on netCDF file<br></div>or<br><br> copy_VarMeta(lu, lu_index)<br> lu_index@NCL_task "Index 17 replaced with 11" ; add informative attribute</div><div><div> printVarSummary(lu_index)<br> printMinMax(lu_index, False)<br> print("-----------------")</div><div> </div></div><div> a->LU_INDEX = lu_index ; replace values and add new meta data<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 29, 2021 at 1:11 AM ali mughal via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Dear NCL users </div><div>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. </div><div dir="ltr"><div><br></div><div><div> a = addfile("<a href="http://geo_em.nc" target="_blank">geo_em.nc</a>","w")<br></div><div> lu=wrf_user_getvar(a,"LU_INDEX",-1)<br></div><div> f = addfile("<a href="http://wrf_mask.nc" target="_blank">wrf_mask.nc</a>","r")<br></div><div> marray = f->WRF_mask</div><div> lu_mask = mask(lu,marray,1)</div><div> a->LU_INDEX=where(lu_mask .eq. 17,11,a->LU_INDEX)</div></div><div><br></div><div>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 ?</div><div><br></div><div><br></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>