<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">geo_em.nc</a>","w")<br> lu = wrf_user_getvar(a,"LU_INDEX",-1)<br><br> f = addfile("<a href="http://wrf_mask.nc">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">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>