[ncl-talk] Error creating binary file

Andrew Kren - NOAA Affiliate andrew.kren at noaa.gov
Fri Feb 23 15:56:48 MST 2018


That could be, I'll check.

On Friday, February 23, 2018, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Andrew,
>
> That binary file looks correct to me, as far as I can tell. The begins
> with 5929560 values in the 100,000-ish range, followed by values in the
> -20/+20 ish range.
>
> Is there possibly a mismatch between the array sizes on the NCL side, and
> the array sizes on the Fortran side (which appear to be determined via a
> parameter file?)?
>
> Rick
>
> On Fri, Feb 23, 2018 at 2:46 PM, Andrew Kren - NOAA Affiliate <
> andrew.kren at noaa.gov> wrote:
>
>> It says this in the fortran program. However, I am confused if ncl prints
>> out bad wind values, so was thinking it was something on my end that I did
>> in the ncl script since slp was fine. I attached the fortran code and the
>> binary file and grads ctl file I made as google drive links.​
>>  analysis_1.dat
>> <https://drive.google.com/a/noaa.gov/file/d/1Y3JXqmxZ7ViBeGkGncFkkIS9wncmAVg4/view?usp=drive_web>
>> ​​
>>  create_binary.ncl
>> <https://drive.google.com/a/noaa.gov/file/d/1fyDQeLSom9Za7r73xpeWvv6nMrVO0o7P/view?usp=drive_web>
>> ​​
>>  track.F
>> <https://drive.google.com/a/noaa.gov/file/d/1Pn9ON5epsr6u_24jxi8eDXBjV8DgizqC/view?usp=drive_web>
>> ​​
>>  grads_ecm.ctl
>> <https://drive.google.com/a/noaa.gov/file/d/1M9KUlm2HZwlaD_gw29Z7hn2qahYJ2Jhv/view?usp=drive_web>
>>>>
>> open(luin,file=filename,form='unformatted',status='unknown',
>>
>>      &       access='direct',recl=idim*jdim*4)
>>
>>
>> On Fri, Feb 23, 2018 at 2:27 PM, Rick Brownrigg <brownrig at ucar.edu>
>> wrote:
>>
>>> Hi Andrew,
>>>
>>> How are you opening the file from the fortran side? The docs for
>>> fbindirwrite state that the fortran equivalent is a file opened with
>>> "'form=unformatted, access=direct, recl= ...'.".
>>>
>>> If that doesn't help, I'd be happy to take a look at the file if you are
>>> able to send it to me.
>>>
>>> Rick
>>>
>>> On Fri, Feb 23, 2018 at 2:03 PM, Andrew Kren - NOAA Affiliate <
>>> andrew.kren at noaa.gov> wrote:
>>>
>>>> Dear ncl-talk,
>>>>
>>>> I wrote a program to convert grib data to binary format, as needed for
>>>> a fortran program to track cyclones. I write slp, u at 500, and v at 500 to
>>>> binary using fbindirwrite. I ran the fortran program, which gave erroneous
>>>> wind values. So, I checked my binary program again and printed out the wind
>>>> for a few points and they were erroneous. Is this because the wind is
>>>> negative at times in direction? Here are some wind values I get when
>>>> putting into binary:
>>>>
>>>> (0) -3.98
>>>>
>>>> (1) -3.98
>>>>
>>>> (2) -3.98
>>>>
>>>> (3) -3.99
>>>>
>>>> (4) -3.95
>>>>
>>>> (5) -3.96
>>>>
>>>> (6) -3.96
>>>>
>>>> (7) -3.96
>>>>
>>>> (8) -3.96
>>>>
>>>> (9) -3.96
>>>>
>>>> (10) -3.95
>>>>
>>>> And here is what I get when I read the binary file back in after
>>>> created:
>>>>
>>>> (0) 102011.4
>>>>
>>>> (1) 102011.4
>>>>
>>>> (2) 102011.4
>>>>
>>>> (3) 102011.4
>>>>
>>>> (4) 102011.4
>>>>
>>>> (5) 102011.4
>>>>
>>>> (6) 102011.4
>>>>
>>>> (7) 102011.4
>>>>
>>>> (8) 102011.4
>>>>
>>>> (9) 102011.4
>>>>
>>>> (10) 102011.4
>>>>
>>>> Am I missing something. I also attached my code. Any help is much
>>>> appreciated!
>>>>
>>>> Thanks,
>>>>
>>>> --
>>>> Andrew Kren
>>>> Assistant Scientist
>>>> CIMAS & NOAA/AOML
>>>> 325 Broadway, Boulder, CO 80305
>>>> <https://maps.google.com/?q=325+Broadway,+Boulder,+CO+80305&entry=gmail&source=g>
>>>> (303) 497-5418
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>>
>> --
>> Andrew Kren
>> Assistant Scientist
>> CIMAS & NOAA/AOML
>> 325 Broadway, Boulder, CO 80305
>> <https://maps.google.com/?q=325+Broadway,+Boulder,+CO+80305&entry=gmail&source=g>
>> (303) 497-5418
>>
>
>

-- 
Andrew Kren
Assistant Scientist
CIMAS & NOAA/AOML
325 Broadway, Boulder, CO 80305
(303) 497-5418
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180223/61c28e02/attachment.html>


More information about the ncl-talk mailing list