<div dir="ltr"><div><div><div><div><div>If you wrote the binary using:<br><br><div> open(2,file=ofile,status='unkn<wbr>own',form='unformatted')<br></div><div> write(2) (((hgtm(i,j,k),i=1,imx),j=1,jm<wbr>x),k=1,lx)</div><br></div>I believe this is a fortran <b>sequential</b> write *not* fortran <b>direct</b> access write.<br><br></div>Sequential writes contain 'hidden' bytes. <br><br></div>You are using <br><br> hgt = fbindirread(path_prs, 0, dims, "float")<br></div><div> printMinMax(hgt, 0) ; what does this indicate<====<br></div><div><br></div>The " fbindirread" is for direct access *not* for sequential files.<br><br></div>Please look at:<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml</a><br><br> hgt = fbinrecread(path_prs, 0, dims, "float")<br> printMinMax(hgt, 0) ; what does this indicate<==== </div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 14, 2017 at 10:29 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You have defined your 3D array dimensions as nlat x nlon x nlev, but then you are defining the dimensions of "hgt" in a different order:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span class=""><div style="font-size:12.8px">hgt!0 = "level"</div><div style="font-size:12.8px">hgt!1 = "lat"</div><div style="font-size:12.8px">hgt!2 = "lon"</div><div style="font-size:12.8px"><br></div></span><div style="font-size:12.8px">The above implies your hgt array is ordered nlev x nlat x nlon.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I don't know how your data is ordered on the binary file, but you either need to fix your "dims" array:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"> dims = (/nlev,nlat,nlon/)</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">or you need to fix the order that you name the "hgt" dimensions:</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><div style="font-size:12.8px">hgt!0 = "lat"</div><div style="font-size:12.8px">hgt!1 = "lon"</div><div style="font-size:12.8px">hgt!2 = "level"</div><div style="font-size:12.8px"><br>I think everything else in your script looks okay, but this code is redundant:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span class=""><div style="font-size:12.8px">hgt&level@units = "hPa"</div><div style="font-size:12.8px">hgt&lat@units = "degrees_north"</div><div style="font-size:12.8px">hgt&lon@units = "degrees_east"</div><div style="font-size:12.8px"><br></div></span><div style="font-size:12.8px">You've already attached the "units" to the level, lat, and lon arrays, so you don't need to do it again.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">--Mary</div><div style="font-size:12.8px"><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Mar 13, 2017 at 11:41 PM, 김가은 <span dir="ltr"><<a href="mailto:gaeun.kim0921@gmail.com" target="_blank">gaeun.kim0921@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello, world!<div><br></div><div>I want to draw several plots with data which is a binary file contains 6 variables(3-dimensional) and made like below:</div><div><br></div><div>open(2,file=ofile,status='unkn<wbr>own',form='unformatted')<br></div><div><div> write(2) (((hgtm(i,j,k),i=1,imx),j=1,jm<wbr>x),k=1,lx)</div><div> write(2) (((ugrdm(i,j,k),i=1,imx),j=1,j<wbr>mx),k=1,lx)</div><div> write(2) (((vgrdm(i,j,k),i=1,imx),j=1,j<wbr>mx),k=1,lx)</div><div> write(2) (((vvelm(i,j,k),i=1,imx),j=1,j<wbr>mx),k=1,lx)</div><div> write(2) (((tmpm(i,j,k),i=1,imx),j=1,jm<wbr>x),k=1,lx)</div><div> write(2) (((rhm(i,j,k),i=1,imx),j=1,jmx<wbr>),k=1,lx)</div><div> close(2)</div></div><div><br></div><div>And then I wrote a NCL script to read and plot them. </div><div>Here is the prob: <br>fatal:No coordinate variable exists for dimension (level) in variable (hgt)</div><div><br></div><div>My script:</div><div><br></div><div><div> nlon = 659</div><div> nlat = 539</div><div> nlev = 17</div></div><div><br></div><div><div> dims = (/nlat,nlon,nlev/)</div><div> lat = fspan(slat,elat,nlat)</div><div> lon = fspan(slon,elon,nlon)</div><div> level = (/1000.,925.,850.,700.,600.,50<wbr>0.,400.,300.,\</div><div> 250.,200.,150.,100.,70.,50.,3<wbr>0.,20.,10./)</div><div><br></div><div> hgt = fbindirread(path_prs, 0, dims, "float")</div><div> u = fbindirread(path_prs, 1, dims, "float")</div><div> v = fbindirread(path_prs, 2, dims, "float")</div><div> vvel = fbindirread(path_prs, 3, dims, "float")</div><div> temp = fbindirread(path_prs, 4, dims, "float")</div><div> rh = fbindirread(path_prs, 5, dims, "float")</div></div><div><br></div><div><div> lon!0 = "lon"</div><div> lon@long_name = "lon"</div><div> lon@units = "degrees_east"</div><div> lon&lon = lon</div><div><br></div><div> lat!0 = "lat"</div><div> lat@long_name = "lat"</div><div> lat@units = "degrees_north"</div><div> lat&lat = lat</div><div><br></div><div> level!0 = "level"</div><div> level@units = "hPa"</div><div> level@long_name = "isobaric_surface"</div><div> level&level = level</div><div><br></div><div>hgt!0 = "level"</div><div>hgt!1 = "lat"</div><div>hgt!2 = "lon"</div><div>hgt&level = level <--- this one makes error!</div><div>hgt&lat = lat</div><div>hgt&lon = lon</div><div>hgt&level@units = "hPa"</div><div>hgt&lat@units = "degrees_north"</div><div>hgt&lon@units = "degrees_east"</div><div>hgt@units = "gpm"</div><div>hgt@long_name = "geopotential height"</div></div><div><br></div><div><br></div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></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>