Re: import ascii data question

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 11 2010 - 14:45:46 MDT

If there are no headers,

   x = asciiread(filename, (/141,111/), "float")
or
   x = asciiread(filename, (/111,141/), "float")

On 6/11/10 2:40 PM, Erik Noble wrote:
> Dear NCL
> I am trying to extract data from an ascii file that I am told is in
> 10f8.2 format.
> I know that the data was generated on a 141x111 grid for 12 days, and
> then outputted as 10f8.2 format into a file.
>
> Is there a way to "read-in" 10f8.2 data?
> (I understand how to Output data in this format.)
>
> Below is some NCL code, which shows the step I got stuck on.
> -Erik
>
>
> ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
> ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ncl 5> filename = "pcp.acc.daily.2-13Sep2006"
> ncl 6> ; Calculate the number of columns.
> ncl 7> ncols = numAsciiCol(filename)
> ncl 8> print(ncols)
>
>
> Variable: ncols
> Type: integer
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 10
> ncl 9> nrows = numAsciiRow(filename)
> ncl 10> print(nrows)
>
>
> Variable: nrows
> Type: integer
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 21924
> ncl 11> ; User says that data is 10f8.2 but my goal is a 141x111 grid
> for 12 days
> ncl 12> ; 141*111=15651; 21924 rows/15651 = 14.045; 15651/10=1565.1
> ~~> 1566 for a record
> ncl 13> ; 1566 * 12 (days) = 18792
> ncl 14> ; print("?????')
> 0 ??????????
> _______________________________________________
> 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 Jun 11 14:45:52 2010

This archive was generated by hypermail 2.1.8 : Wed Jun 16 2010 - 15:28:33 MDT