<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }div.foxdiv20140815165041469047 { }body { font-size: 10.5pt; font-family: 微软雅黑; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span>The following is Java code to read GrADS map data, which should be useful for understanding the format.</div><div><br></div><div>String fileName = "../hires"</div><div><span style="background-color: rgba(0, 0, 0, 0);">DataInputStream br = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(fileName))));</span></div><div><span style="background-color: rgba(0, 0, 0, 0);">int i, lineNum;
<br>        byte b;
<br>        short N, lType;
<br>        double lon, lat;
<br>        byte[] bytes;</span></div><div><span style="background-color: rgba(0, 0, 0, 0);"><br></span></div><div><span style="background-color: rgba(0, 0, 0, 0);">lineNum = 0;
<br>        do {
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">b = br.readByte();    // 1-data, 2-skip
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">if ("2".equals(Byte.toString(b))) {
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">br.skipBytes(18);&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">continue;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">}&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">b = br.readByte();    // Line type: country, river ...
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">lType = (short) DataConvert.byte2Int(b);
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">b = br.readByte();   // Point number
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">N = (short) DataConvert.byte2Int(b);
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">for (i = 0; i &lt; N; i++) {
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">bytes = new byte[3];&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">br.read(bytes);    //Longitude&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">int val = 0;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">for (int bb = 0; bb &lt; 3; bb++) {&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">val &lt;&lt;= 8;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">val |= (int) bytes[bb] &amp; 0xFF;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">}&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">lon = val / 10000.0;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0);">
<br></span><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">bytes = new byte[3];&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">br.read(bytes);    //Latitude&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">val = 0;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">for (int bb = 0; bb &lt; 3; bb++) {&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">val &lt;&lt;= 8;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">val |= (int) bytes[bb] &amp; 0xFF;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">}&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">lat = val / 10000.0 - 90.0;&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">}&nbsp;</span></div><div><span style="background-color: rgba(0, 0, 0, 0);"><br></span></div><div><span style="background-color: rgba(0, 0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span style="background-color: rgba(0, 0, 0, 0);">lineNum++;</span><span style="background-color: rgba(0, 0, 0, 0);">
<br>        } while (br.available() &gt; 0);
<br>
<br>        br.close();</span></div><div><span style="background-color: rgba(0, 0, 0, 0);"><br></span></div><div><span style="background-color: rgba(0, 0, 0, 0);">Regards</span></div><div><span style="background-color: rgba(0, 0, 0, 0);">Yaqiang</span></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">*************************************************</span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">Dr. Yaqiang Wang</span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">Chinese Academy of Meteorological Sciences (CAMS)</span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">46, Zhong-Guan-Cun South Avenue</span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">Beijing, 100081</span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">China</span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">             </span><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><a href="mailto:yaqiang.wang@gmail.com" target="_blank" style="font-family: 微软雅黑; font-size: 14px; line-height: 21px;">yaqiang.wang@gmail.com</a><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><a href="http://www.meteothinker.com" target="_blank" style="font-family: 微软雅黑; font-size: 14px; line-height: 21px;">http://www.meteothinker.com</a><br style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;"><span style="color: rgb(136, 136, 136); font-family: 微软雅黑; font-size: 14px; line-height: 21px;">**************************************************</span></div></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div>&nbsp;</div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>發件人:</b>&nbsp;<a href="mailto:raymond90255@hotmail.com">Tsai Ray</a></div><div><b>發送時間:</b>&nbsp;2014-08-15&nbsp;03:06</div><div><b>收件人:</b>&nbsp;<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a></div><div><b>主題:</b>&nbsp;[gradsusr] How to read latitude/longitude data from background map</div></div></div><div><div class="FoxDiv20140815165041469047">
<div dir="ltr"><div>Dear GrASD users,</div><div><br></div><div>I already have a high-resolution regional backgruond map data(same formation as hires and lowres), and</div><div><br></div><div>now I'm trying to read the latitude/longitude from it by fortran program.</div><div><br></div><div>But I'm not sure about the formation of background map data, and still can't get the correct latitude/longitude information.</div><div><br></div><div>Is there any way to solve this problem, please~~~~</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Ray</div>                                               </div>
</div></div></blockquote>
</body></html>