Re: LittleEndian help

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 08 May 2009 06:58:38 -0600

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
Received on Fri May 08 2009 - 06:58:38 MDT

This archive was generated by hypermail 2.2.0 : Fri May 08 2009 - 10:05:07 MDT