Re: Reshape and write binary

From: Noel Aloysius <noel.aloysius_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 26 2012 - 13:23:23 MDT

Hi Dennis

I am reading the file in matlab. Should I drop the 0 in that case?

Noel

On Thu, Apr 26, 2012 at 2:17 PM, Dennis Shea <shea@ucar.edu> wrote:

> That should be
> fbinrecwrite (fo, 0, vals(lat|:,lon|:,time|:) )
> Note the 0 ... not -1
>
> fbinrecwrite has fortran record information bytes
> before an after the record. If you are reading the data into a
> fortran program via a sequential read (default in fortran)
> then the abouve is fine.
>
> ==
> Otherwise use:
> fbindirwrite (fo, vals(lat|:,lon|:,time|:) )
>
>
>
>
> On 04/26/2012 12:10 PM, Dennis Shea wrote:
>
>> vals = fi->data
>> fbinrecwrite (fo, -1, (/ vals(lat|:,lon|:,time|:) /)) ;
>>
>> ===
>> The mini-language manual
>> http://www.ncl.ucar.edu/**Document/Manuals/<http://www.ncl.ucar.edu/Document/Manuals/>
>> briefly discusses this in section 2.10
>>
>> Also, the Reference manual
>>
>> http://www.ncl.ucar.edu/**Document/Manuals/Ref_Manual/**
>> NclVariables.shtml<http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml>
>>
>> See "Named Subscripting"
>>
>>
>> On 04/26/2012 11:26 AM, Noel Aloysius wrote:
>>
>>> Hi
>>>
>>> The netcdf data variable is written as data (time, lat, lon)
>>> where the dimenstion are time = 1200, lat = 180, lon = 360
>>>
>>> I use the following to write a binary file
>>>
>>> fi = addfile (fnames_in1, "r")
>>> fo = diri + fnames_out
>>> vals = (fi->data)
>>> fbinrecwrite (fo, -1, (/ vals(:,:,:) /)) ; data(time,lat,lon)
>>>
>>> I want to reshape the vals as data(lon,lat,time) and then write the
>>> binary file.
>>>
>>> I will appreciate any help on this.
>>>
>>> Thanks,
>>> Noel
>>>
>>>
>>>
>>>
>>> ______________________________**_________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>>
>>
>> ______________________________**_________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 26 13:23:35 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 30 2012 - 09:21:12 MDT