Re: reading ASCII file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 14 Mar 2007 22:59:08 -0600 (MDT)

>
[SNIP]

minor corrections to previous email

> [1] NCL look for logical breaks [eg, spaces, commas, etc] so
> it knows how to break numbers up. There are no such breaks
> in this numeric sequence. How is any language that *automatically*
> reads the file supposed to know where a number starts/ends?
>
> IMHO ... this is a very poor file.
>
> [2] You need a language that allows user defined granularity, eg fortran.
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> external DEBASH "./rdascii.so"
>
> nlat = 72
> mlon = 144
>
> lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
>
> lon = lonGlobeFo(mlon, "lon", "longitude", "degrees_east")
> lon = (/ lon - 180. /) ; subtract 180 from all values
> lon&lon = lon ; update coordinates
>
> x = new ( (/nlat,mlon/), "float" )
> x_at_long_name = "..."
> x_at_units = "..."

      x!0 = "lat"
      x!1 = "lon"
      x&lat = lat
      x&lon = lon
>
> DEBASH::rdascii( nlat, mlon, x)
>
> printVarSummary(x)
> printMinMax(x, True)
>
>
> [3] fortran: rdascii.f
>
> C NCLFORTSTART
> subroutine rdascii(nlat,mlon,z)
> implicit none
> integer nlat, mlon
        real z(nlat,mlon)
> C NCLEND
> open(10, file="....") ! put file name here
        read(10,"(8f10.3)") z
>
> return
> end
>
>
> [4] WRAPIT rdascii.f
>
> will create .so
> _______________________________________________
> 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 Wed Mar 14 2007 - 22:59:08 MDT

This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 09:15:24 MDT