Re: A few simple questions!

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 9 Feb 2007 14:07:14 -0700 (MST)

There is a difference.

It has nothing to do with big- or little endian binary.

*Each* fortran *sequential* record is prepended and
postpended with record control words. Usually, the
control word length is 4 bytes. However, this is
not required by the fortran standard. The control
words allow the records to be of different lengths.

Consider:

      real x(51,51,21185)
      open (10,,file="foo",format="unformated")
      
(a) write(10) x
      
      [4-byte control word] [ x ] [4-byte control word]
      
      Only once do the control bytes/words get written.
      
(b) do n=1,21185
         write(10) ((x(ml,nl),ml=1,51),nl=1,51)
      end do

      Here 21185 sets of control words/bytes are written.
      
Moral: Read the data the way it was written

D

>Dear NCL users,
>
>I've two simple questions:
>1) I have a sequential access binary file created in a little_endian
>plataform in which the dimension data are (time | 21185, lat | 50, lon |
>50). So, to read this file I should use fbinrecread() function. My
>doubt: what's the difference reading this file with two different ways?
>These different ways are below:
>
> prec = new((/21185,51,51/),float)
> prec = fbinrecread("brazil.daily.prcp.le.b19480101.e20051231",
>0, (/21185,51,51/), "float")
>
>and
> prec = new((/21185,51,51/),float)
> do i=0,21184
> prec(i,:,:) =
>fbinrecread("brazil.daily.prcp.le.b19480101.e20051231", i, (/51,51/),
>"float")
> end do
>
>I ask it because the precipitation plots obtained with the same data,
>but read with these different ways, aren't equal. The plots from the
>first way of reading these data appears to move to right (or east),
>while with the second way they are correct.
>
>2) My following question is about resources. I've resources that are
>defaults depending of the kind of the plot. So, I made some tests with
>the load command, putting it inside the code, instead of putting it at
>beginning of the script, like illustrated below:
>
> load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> vento_u=addfile("u.200.jun.2002.nc","r")
> ventu_v=addfile("v.200.jun.2002.nc","r")
> u=vento_u->uwnd(0,0,:,:)
> v=ventu_v->vwnd(0,0,:,:)
> arquivo="vectors"
>
> Xwks = gsn_open_wks("ps",arquivo)
> load "./vectors.res" ; <<=== LOADING RESOURCES FROM
>EXTERNAL FILE
> plot = gsn_csm_streamline_map(Xwks,u,v,res)
> end
>
>
>VECTORS.RES
>res = True
> res_at_mpOutlineBoundarySets = "National"
> res_at_mpLimitMode = "LatLon"
> res_at_mpMinLonF = 270
> res_at_mpMaxLonF = 330
> res_at_mpMinLatF = -60
> res_at_mpMaxLatF = 15
> res_at_mpPerimOn = True
>
>Is it a good programming practice? There is another way to read default
>resources for specific kind of plots?
>
>Thanks
>
>Mateus
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk_at_ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 09 2007 - 14:07:14 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 13 2007 - 14:07:37 MST