<div dir="ltr">Thanks Gus. Mary and myself both tried &quot;endian&quot; options, and presently trying with <span lang="EN"><p>&quot;setfileoption(&quot;bin&quot;,&quot;readbyteorder&quot;,&quot;bigendian&quot;) option which seems to produce reasonable minimum and maximum of data values. However, as Mary mentioned large number of values are constant whcih is bit strange. </p></span><div>You mentioned about &quot;double&quot; and I think input is in &quot;<span style="color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-weight:normal;word-spacing:0px;float:none;display:inline;white-space:normal;background-color:rgb(255,255,255)">double precision floating point data and it is 8 bytes&quot;.</span></div><div><span style="color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-weight:normal;word-spacing:0px;float:none;display:inline;white-space:normal;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-weight:normal;word-spacing:0px;float:none;display:inline;white-space:normal;background-color:rgb(255,255,255)">Thanks.</span></div><div><span style="color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-weight:normal;word-spacing:0px;float:none;display:inline;white-space:normal;background-color:rgb(255,255,255)">Debasish</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 30, 2017 at 4:06 PM, Gus Correa <span dir="ltr">&lt;<a href="mailto:gus@ldeo.columbia.edu" target="_blank">gus@ldeo.columbia.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mary, Debasish<br>
<br>
Could it be a little-endian vs. big-endian issue?<br>
I don&#39;t know IDL (I should! My boss uses it! :) )<br>
but their &quot;read_binary&quot; default endianness is &quot;native&quot; (like NCL).<br>
I.e., the endianness of the data on the file depends on the<br>
machine it was created (and data_type=5 is indeed double precision).<br>
<br>
Maybe using setfileoption(&#39;bin&#39;,&quot;<wbr>ReadByteOrder&quot;,&quot;BigEndian&quot;),<br>
and trying also &quot;LittleEndian&quot; if not lucky with &quot;Big&quot;<br>
(who knows where the file was written ....),<br>
then cbinread/fbindirread with datatype &quot;double&quot; would help?<br>
Just a guess, and you probably tried the endianness thing already ...<br>
<br>
Best,<br>
Gus Correa<br>
<div><div class="h5"><br>
On 03/30/2017 02:54 PM, Mary Haley wrote:<br>
&gt; Hi Debasish,<br>
&gt;<br>
&gt; Dennis guess that maybe the &quot;read_binary&quot; function in IDL was meant to<br>
&gt; read files created by &quot;write_binary&quot; but I didn&#39;t see a function with<br>
&gt; that name. However, is it possible that this is some kind of special IDL<br>
&gt; file and not a flat C binary file?<br>
&gt;<br>
&gt; In your IDL script, you have:<br>
&gt;<br>
&gt; fdata=read_binary(&#39;viirs_<wbr>meandbdi_gridded_statis2013&#39;+<wbr>day+&#39;.dat&#39;,data_type=5,data_<wbr>dims=[1440,720])<br>
&gt;<br>
&gt; If you read the documentation for &quot;read_binary&quot;, it states that<br>
&gt; &quot;data_type=5&quot; is double.<br>
&gt;<br>
&gt; In your NCL script, you are reading the data as an unsigned integer.<br>
&gt;<br>
&gt; I tried reading your data as a double, but I get what looks like<br>
&gt; nonsensical values:<br>
&gt;<br>
&gt;  min=-1.642556686681977e+308   max=6.633924105807938e+307<br>
&gt;<br>
&gt; You are right that the unsigned integer values look reasonable, but only<br>
&gt; after you multiply them by 1e-9.<br>
&gt;<br>
&gt; When I look at your unsigned values, I see that<br>
&gt; ​517,484<br>
&gt; of your values are equal to the same number: 6.3615e-05, while only<br>
&gt; ​ 1,831<br>
&gt;  values are equal to something else.<br>
&gt; ​ This seems a bit suspicious to me, and is likely the​ source of the<br>
&gt; problem.<br>
&gt;<br>
&gt; ​I modified your script to plot red markers where the values are all<br>
&gt; equal to 6.3615e-05, and black markers everywhere else. Does this look<br>
&gt; correct?​<br>
&gt;<br>
&gt; I have a feeling that there&#39;s something more to the &quot;read_binary&quot;<br>
&gt; function that we need to know in order to read the file correctly.  As I<br>
&gt; think I mentioned before: perhaps each byte of data represents something<br>
&gt; different, and you need to use something like dim_gbits to pick off values.<br>
&gt;<br>
&gt; In your IDL script, is there anything you have to do additionally to the<br>
&gt; data before you plot it?  Can you check the IDL script to see if you are<br>
&gt; getting a lot of values equal to the same constant value that NCL is?<br>
&gt;<br>
&gt; --Mary<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Mar 30, 2017 at 8:36 AM, Debasish Hazra<br>
</div></div><span>&gt; &lt;<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@gmail.com</a> &lt;mailto:<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@gmail.<wbr>com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Mary,<br>
&gt;<br>
&gt;     Thanks.Taking your suggestion and reading that as 2 * 720 * 1440 and<br>
&gt;     assuming input as C binary file, I am getting      min=1.4e-08<br>
&gt;     max=4.29371 , which is reasonble. Attached is the new script. Any<br>
&gt;     suggestions.<br>
&gt;<br>
&gt;     Debasish<br>
&gt;<br>
&gt;     On Wed, Mar 29, 2017 at 5:28 PM, Mary Haley &lt;<a href="mailto:haley@ucar.edu">haley@ucar.edu</a><br>
</span><div><div class="h5">&gt;     &lt;mailto:<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;         Hi Debasish,<br>
&gt;<br>
&gt;         Kevin and I took a look at this. For starters, there *is* an<br>
&gt;         error message coming out of your script:<br>
&gt;<br>
&gt;         warning:cbinread: The size implied by the dimension arrays is<br>
&gt;         greater that the size of the file.<br>
&gt;          The default _FillValue for the specified type will be filled in.<br>
&gt;          Note dimensions and values may not be aligned properly<br>
&gt;<br>
&gt;         If you look at the size of the file, it doesn&#39;t match with the<br>
&gt;         dimensions you&#39;re requesting:<br>
&gt;<br>
&gt;         Size of file = 8294400 bytes<br>
&gt;<br>
&gt;         Size of dimensions = 5 * 720 * 1440 * 4 (for a uint) = 20736000<br>
&gt;<br>
&gt;         If this is truly a C binary file, it looks like it only has 2 *<br>
&gt;         720 * 1440 * 4 bytes.<br>
&gt;<br>
&gt;         This doesn&#39;t really change the results, however, because you<br>
&gt;         still get two strange looking plots.<br>
&gt;<br>
&gt;         We tried several different things:<br>
&gt;<br>
&gt;         1) reading the data as ubyte, int, and ushort<br>
&gt;         2) reversing the array to 1440 x 720 x 2<br>
&gt;         3) reading the data as little endian<br>
&gt;         4) plotting the data as a simple contour plot to take out the<br>
&gt;         map component.<br>
&gt;<br>
&gt;         Nothing we did produced more information about the file, or<br>
&gt;         produced better plots.<br>
&gt;<br>
&gt;         Is there some documentation on this file to understand how it<br>
&gt;         was written? For example, are you sure the &quot;uint&quot; type is<br>
&gt;         correct? Are you sure the dimension sizes are correct? Why are<br>
&gt;         the values so large? Is it possible that this is &quot;packed&quot; data,<br>
&gt;         and that you need to use a function like dim_gbits to pick off<br>
&gt;         individual bits of information?<br>
&gt;<br>
&gt;         If you can find a C or Fortran code that was used to create this<br>
&gt;         file, then it should be fairly straightforward to figure out how<br>
&gt;         to read it.<br>
&gt;<br>
&gt;         --Mary<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         On Wed, Mar 29, 2017 at 2:18 PM, Debasish Hazra<br>
</div></div>&gt;         &lt;<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@gmail.com</a> &lt;mailto:<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@gmail.<wbr>com</a>&gt;&gt;<br>
<span>&gt;         wrote:<br>
&gt;<br>
&gt;             Hi,<br>
&gt;<br>
&gt;             I am trying to read a binary file with the attached code,<br>
&gt;             but  getting all empty fields in the figure with no apparent<br>
&gt;             error message. Uploaded  the data file in the ftp server<br>
&gt;             &quot;viirs_meandbdi_gridded_<wbr>statis2015048.dat&quot;. Any help with<br>
&gt;             this is appreciated.<br>
&gt;<br>
&gt;             Thanks.<br>
&gt;             Debasish<br>
&gt;<br>
&gt;             On Wed, Mar 22, 2017 at 10:33 AM, Debasish Hazra<br>
&gt;             &lt;<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@gmail.com</a><br>
</span><span>&gt;             &lt;mailto:<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@gmail.<wbr>com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;                 Hi,<br>
&gt;<br>
&gt;                 I am trying to read a binary file with the attached<br>
&gt;                 code, but  getting all empty fields in the figure with<br>
&gt;                 no apparent error message. Uploaded  the data file in<br>
&gt;                 the ftp server<br>
&gt;                 &quot;viirs_meandbdi_gridded_<wbr>statis2015002.dat&quot;. Any help<br>
&gt;                 with this is appreciated.<br>
&gt;<br>
&gt;                 Thanks.<br>
&gt;                 Debasish.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;             ______________________________<wbr>_________________<br>
&gt;             ncl-talk mailing list<br>
</span>&gt;             <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a> &lt;mailto:<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>&gt;<br>
<span>&gt;             List instructions, subscriber options, unsubscribe:<br>
&gt;             <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" rel="noreferrer">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
</span>&gt;             &lt;<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" rel="noreferrer">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a>&gt;<br>
<div class="HOEnZb"><div class="h5">&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ______________________________<wbr>_________________<br>
&gt; ncl-talk mailing list<br>
&gt; <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" rel="noreferrer">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
&gt;<br>
<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" target="_blank" rel="noreferrer">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></div>