Re: LittleEndian help

From: Erik Noble <enoble_at_nyahnyahspammersnyahnyah>
Date: Sat, 9 May 2009 11:02:54 -0400

Oh, I see that I got it backwards; I am working on a LittleEndian machine
but importing data from a BigEndian machine. Thank you.-Erik

On Fri, May 8, 2009 at 8:58 AM, Dennis Shea <shea_at_ucar.edu> wrote:

> It should be:
> setfileoption("bin","ReadByteOrder","BigEndian")
>
> This says that the input is BigEndian. NCL will
> automatically switch to the appropriate endian
> of the current machine. On a big-endian machine
> no switch will occur.
>
> ---
> It is best to always include units for coordinate variables.
>
> lat = ispan(0,nlat-1,1)*0.25 - 49.875
> lat_at_units = "degrees_north"
> finarr&lat = lat
> finarr!2 = "lon"
> lon = ispan(0,mlon-1,1)*0.25 - 179.875
> lon_at_units = "degrees_east"
> finarr&lon = lon
>
>
>
> Erik Noble wrote:
> > Hi. I am reading binary data.
> > I know that it was made on a AIX machine and is bigEndian, so I made the
> > following script to extract the data, which includes the line
> > setfileoption("bin","ReadByteOrder","LittleEndian")
> >
> > At the end of the script, I use the printMinMax function to look a the
> > the data and I can see that the setfileoption did not fix the data.
> > am I missing something?
> >
> > Thank you ahead of time for the help.
> > Sincerely,
> > Erik
> >
> > noble:TRMM3B42 enoble$ ncl extract_Trmm_binary.ncl
> > Copyright (C) 1995-2009 - All Rights Reserved
> > University Corporation for Atmospheric Research
> > NCAR Command Language Version 5.1.0
> > The use of this software is governed by a License Agreement.
> > See http://www.ncl.ucar.edu/ for more details.
> > (0) Assigning coordinate variable information
> > fatal:Variable (mlon) is undefined
> > fatal:Execute: Error occurred at or near line 24 in file
> > extract_Trmm_binary.ncl
> >
> > fatal:Variable (lon) is undefined
> > fatal:Execute: Error occurred at or near line 25 in file
> > extract_Trmm_binary.ncl
> >
> >
> >
> > Variable: finarr
> > Type: float
> > Total Size: 71424000 bytes
> > 17856000 values
> > Number of Dimensions: 3
> > Dimensions and sizes: [time | 31] x [lat | 400] x [lon | 1440]
> > Coordinates:
> > time: [1..31]
> > lat: [-49.875..49.875]
> > Number Of Attributes: 1
> > _FillValue : -999
> > (0)
> > (0) min=-3.40268e+38 max=3.40242e+38
> > noble:TRMM3B42 enoble$ vi extract_Trmm_binary.ncl
> >
> > ***************
> >
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> > setfileoption("bin","ReadByteOrder","LittleEndian")
> >
> > nlat = 400
> > nlon = 1440
> >
> > fils = systemfunc("ls 3B42_daily*.bin")
> > nfils = dimsizes(fils)
> > finarr = new((/nfils,nlat,nlon/),"float")
> > do gg = 0,dimsizes(fils)-1 ; loop thru each file
> > finarr(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float")
> > end do
> > print("Assigning coordinate variable information")
> > finarr!0 = "time"
> > finarr&time = ispan(1,dimsizes(fils),1)
> > finarr!1 = "lat"
> > lat = ispan(0,nlat-1,1)*0.25 - 49.875 ; Dr. Shea gave you this.
> > finarr&lat = lat
> > finarr!2 = "lon"
> > lon = ispan(0,mlon-1,1)*0.25 - 179.875 ; Dr. Shea gave you
> this.
> > finarr&lon = lon
> > printVarSummary(finarr)
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat May 09 2009 - 09:02:54 MDT

This archive was generated by hypermail 2.2.0 : Mon May 11 2009 - 09:43:46 MDT