Re: import ascii data question

From: Erik Noble <nobleeu_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 11 2010 - 16:55:22 MDT

There are no headers.
But it is daily data produced on a 141x111 grid, but for 12 days, that
is outputted (10f8.2 format) to a file. I want to use NCL to extract
the daily data back into an array of 12 days (each day, 141x111).
Apparently there are 10 columns and 21924 rows in the ascii file.

This command will solve extract it correctly?
x = asciiread(filename, (/141,111/), "float")

On Fri, Jun 11, 2010 at 4:45 PM, Dennis Shea <shea@ucar.edu> wrote:
> 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 16:55:31 2010

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