<div dir="ltr"><div class="gmail_default" style="font-size:small">Dear Yi Lu,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are trying to extract the region from your HDF5 data by using coordinate subscripting.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Coordinate subscripting can only be done on rectilinear data, which is data represented by one-dimensional lat/lon arrays that are the same length as their corresponding dimension.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Your data is likely curvilinear, which means your data is represented by two-dimensional lat/lon arrays. I say this because in your code it looks like you are extracting 2D lat/lon arrays:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div style="font-size:12.8px"><font face="monospace, monospace">  lat2d    = f->cell_lat</font></div><div style="font-size:12.8px"><font face="monospace, monospace">  lon2d    = f->cell_lon</font></div><div style="font-size:12.8px"><font face="monospace, monospace">  nSmapLat = dimsizes(lat2d(:,0))<br>  nSmapLon = dimsizes(lon2d(0,:))</font></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Given this information, you cannot use coordinate subscripting to subscript your data.  Instead, you either need to use the function <b>getind_latlon2d</b> or <b>region_ind</b> to get the indexes of the area of interest.  For example:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  lat_reg  = (/minLatBoundary,maxLatBoundary/)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  lon_reg  = (/minLonBoundary,maxLonBoundary/)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  ij       = getind_latlon2d(lat2d,lon2d,lat_reg,lon_reg)</font></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  sm_regional = sm(ij(0,0):ij(1,0),ij(0,1):ij(1,1))</font></div><div style="font-size:small"><br></div>Before plotting, you need to subset your lat2d / lon2d arrays using the same indexing:<br><br><font face="monospace, monospace"> res@sfXArray = lon2d(ij(0,0):ij(1,0),ij(0,1):ij(1,1))<br> res@sfYArray = lat2d(ij(0,0):ij(1,0),ij(0,1):ij(1,1))</font><div style="font-size:small"><br></div><div style="font-size:small">Please see our "Subsetting / extracting data based on lat / lon values" example page:</div><div style="font-size:small"><br></div><div><a href="http://www.ncl.ucar.edu/Applications/latlon_subset.shtml">http://www.ncl.ucar.edu/Applications/latlon_subset.shtml</a><br></div><div><br></div><div>and in particular, look at examples latlon_subset_2.ncl and latlon_subset_3.ncl, which show the difference between getind_latlon2d and region_ind.</div><div><br></div><div>Also, to better understand the different types of data (rectilinear, curvilinear, unstructured) and how to plot them, see:</div><div><br></div><div><a href="http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml">http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml</a><br></div><div><br></div><div>Good luck,</div><div><br></div><div>--Mary</div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 13, 2017 at 7:05 PM, 易路 <span dir="ltr"><<a href="mailto:dg1225033@smail.nju.edu.cn" target="_blank">dg1225033@smail.nju.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi, all</div><div>Sorry to disturb you for technical help. </div><div> </div><div>I am trying to extract the regional data from the soil product SMAP L4 which is stored in the format of HDF5. I wrote the ncl script taking referecnce to the example listed on the web of <a href="http://www.ncl.ucar.edu/Applications/HDF.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/HDF.shtml</a>. But the extracted data were not in the demond region. So would you please help me to find the faults in my ncl script?  The main part of this script is as follow, and the detail information can be downloaded from the accessory. </div><div>********main part of the script *********</div><div><div> nFiles  = dimsizes(iFiles)  <br>  f       = addfile(iFiles(0), "r")</div><div>  lat2d     = f->cell_lat</div></div><div>  lon2d     = f->cell_lon</div><div> </div><div> nSmapLat = dimsizes(lat2d(:,0))<br> nSmapLon = dimsizes(lon2d(0,:))<br> minSmapLat = min(lat2d)<br> maxSmapLat = max(lat2d)<br> minSmapLon = min(lon2d)<br> maxSmapLon = max(lon2d)</div><div> </div><div> lat=fspan(minSmapLat, maxSmapLat, nSmapLat)   <br>    lat!0="lat"<br>    lat&lat=lat<br>    <a href="mailto:lat@units=%22degrees_north" target="_blank">lat@units="degrees_north</a>"<br>    <a href="mailto:lat@long_name=%22Latitude" target="_blank">lat@long_name="Latitude</a>"</div><div> lon=fspan(minSmapLon,<wbr>maxSmapLon, nSmapLon)<br>    lon!0="lon"<br>    lon&lon=lon<br>    <a href="mailto:lon@units=%22degrees_east" target="_blank">lon@units="degrees_east</a>"<br>    <a href="mailto:lon@long_name=%22Longitude" target="_blank">lon@long_name="Longitude</a>"<br>   <br>  lat2d!0="lat"<br>  lat2d!1="lon"<br>  lat2d&lon=lon<br>  lat2d&lat=lat</div><div> </div><div>  lon2d!0="lat"<br>  lon2d!1="lon"<br>  lon2d&lon=lon<br>  lon2d&lat=lat</div><div> </div><div>  minLatBoundary  = 25<br>  maxLatBoundary  = 35<br>  minLonBoundary  = 110<br>  maxLonBoundary  = 120</div><div><br>  sm   = f->sm_rootzone<br>  printVarSummary(sm)<br>  sm!0="lat"<br>  sm!1="lon"<br>  sm&lon=lon<br>  sm&lat=lat<br>  printVarSummary(sm)<br>  <br>  sm_regional = sm({minLatBoundary:<wbr>maxLatBoundary},{<wbr>minLonBoundary:maxLonBoundary}<wbr>)</div><div>******************************<wbr>*****</div><div> </div><div>Thanks a lot for your precious attentions and time!</div><div> </div><div>Yi Lu</div><div> </div><div><u></u><div style="color:rgb(144,144,144);font-family:Arial Narrow;font-size:12px"><br><br><br><br></div><div style="color:rgb(0,0,0);font-family:Verdana;font-size:14px"><div style="overflow:hidden"><table class="m_-3190131480961151276preview_table"><tbody><tr><td valign="middle"><img id="m_-3190131480961151276preview_qrcode" src="https://exmail.qq.com/cgi-bin/setting_qrcode_card?action=qrcode_card&alias=dg1225033@smail.nju.edu.cn&key=33b1e5708e6a55b5"></td><td valign="middle" style="color:rgb(160,160,160);font-size:12px"><h4 class="m_-3190131480961151276name" style="margin:0px;color:rgb(0,0,0);line-height:28px;font-size:14px;font-weight:bold">易路</h4><p class="m_-3190131480961151276department" style="margin:0px">南大邮件系统/学生/博士生/12级博士生</p><p class="m_-3190131480961151276addr" style="margin:0px;color:rgb(160,160,160);line-height:22px">南京市汉口路22号 </p></td></tr></tbody></table></div></div><u></u></div><div> </div><div><u></u><u></u></div><div id="m_-3190131480961151276QQMailBigAttach" style="padding:2px;width:auto;font-family:Verdana,Arial,Tahoma;font-size:14px;margin-bottom:15px;background-color:rgb(224,236,249)"><hr style="display:none"><div style="padding:6px 0pt 10px 6px;text-align:left"><b style="font-size:14px"><img align="absmiddle" style="margin-right:4px" src="http://res.mail.qq.com/zh_CN/htmledition/images/icon_att.gif" border="0">从腾讯企业邮箱发来的超大附件</b></div><div style="background:rgb(255,255,255);padding:0pt 8px 6px 12px"><div style="clear:both"><div style="padding:10px 0px;font-size:12px"><div title="SMAP_L4_SM_gph_20150815T013000_Vv3030_001.h5

文件大小:136.33M

到期时间:2018年01月12日 11:27" class="m_-3190131480961151276bigatt_bt"><div style="margin:2px 8px 0px 0px;float:left"><a href="http://exmail.qq.com/cgi-bin/ftnExs_download?k=523465623d8c4a92182f6ffe1038075719575c5a030c065706190304015b1d51000c504f0e0e55561b075257010c0452050d070051381e65657924326874043a65793a0547506f57060550520f0905310605565207086f334007555107670055181a4b4c5f0d3058&t=exs_ftn_download&code=64eb780e&s=email" target="_blank"><img src="http://res.mail.qq.com/zh_CN/htmledition/images/fj/fu_qita.gif" border="0"></a></div><div class="m_-3190131480961151276name_big"><span class="m_-3190131480961151276qqmailbgattach"><a style="color:rgb(0,0,0)" href="http://exmail.qq.com/cgi-bin/ftnExs_download?k=523465623d8c4a92182f6ffe1038075719575c5a030c065706190304015b1d51000c504f0e0e55561b075257010c0452050d070051381e65657924326874043a65793a0547506f57060550520f0905310605565207086f334007555107670055181a4b4c5f0d3058&t=exs_ftn_download&code=64eb780e&s=email" target="_blank">SMAP_L4_SM_gph_<wbr>20150815T013000_Vv3030_001.h5</a><span style="color:rgb(160,160,160)"> (136.33M, 2018年01月12日 11:27 到期)</span></span><div class="m_-3190131480961151276down_big"><a href="http://exmail.qq.com/cgi-bin/ftnExs_download?k=523465623d8c4a92182f6ffe1038075719575c5a030c065706190304015b1d51000c504f0e0e55561b075257010c0452050d070051381e65657924326874043a65793a0547506f57060550520f0905310605565207086f334007555107670055181a4b4c5f0d3058&t=exs_ftn_download&code=64eb780e&s=email" target="_blank">进入下载页面</a><span style="display:none">:<a href="http://exmail.qq.com/cgi-bin/ftnExs_download?k=523465623d8c4a92182f6ffe1038075719575c5a030c065706190304015b1d51000c504f0e0e55561b075257010c0452050d070051381e65657924326874043a65793a0547506f57060550520f0905310605565207086f334007555107670055181a4b4c5f0d3058&t=exs_ftn_download&code=64eb780e&s=email" target="_blank">http://exmail.qq.com/<wbr>cgi-bin/ftnExs_download?k=<wbr>523465623d8c4a92182f6ffe103807<wbr>5719575c5a030c065706190304015b<wbr>1d51000c504f0e0e55561b07525701<wbr>0c0452050d070051381e6565792432<wbr>6874043a65793a0547506f57060550<wbr>520f0905310605565207086f334007<wbr>555107670055181a4b4c5f0d3058&<wbr>t=exs_ftn_download&code=<wbr>64eb780e&s=email</a></span></div></div></div></div></div></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>