Re: reading gtopo30 data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 26 2009 - 20:39:12 MST

The data are 16-bit [type short].

  nlat=6000
  nlon=4800
  z=fbindirread ("E060N40.DEM",0,(/nlon,nlat/),"short")

p s wrote:
> Hi,
> I am having some problem trying to read the gtopo30 binary data, could
> anyone help me out?
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
> setfileoption("bin","ReadByteOrder","BigEndian")
> nlat=6000-1
> nlon=4800-1
> z=fbindirread ("E060N40.DEM",0,(/nlon,nlat/),"byte")
> res=0.00833333333333
> ulat=39.99583333333333
> ulon=60.00416666666667
> lat = ulat + ispan(-nlat,0,1)*res
> lon = ispan(0,nlon,1)*res + ulon
>
>
>
> ;=============================
> ; create lat and long coordinate variables
> ;============================
> lon!0 = "lon"
> lon@long_name = "lon"
> lon@units = "degrees-east"
> lon&lon = lon
>
> lat!0 = "lat"
> lat@long_name = "lat"
> lat@units = "degrees_north"
> lat&lat = lat
> print(lat)
> print(lon)
> ;=============================
> ; name dimensions of z and assign coordinate variables
> ;============================
> z!0 = "lat"
> z!1 = "lon"
> z&lat = lat
> z&lon = lon
> z@long_name = "Elevation"
> z@units = "meters"
>
> Its giving a error message saying
> fatal:Coordinate variables must be the same dimension as their dimension
> fatal:No coordinate variable exists for dimension (lat) in variable (z)
> Segmentation fault
>
> Also I am not sure if the format is "byte" if I use double or float
> while reading the binary file, it gives error message.
> Regards,
> Prabhakar
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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 Thu Nov 26 20:39:58 2009

This archive was generated by hypermail 2.1.8 : Sun Nov 29 2009 - 20:52:58 MST