Re: asciiread_error

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 06 2013 - 12:58:02 MDT

Bithi,

This is probably caused by input files that do not have spaces
separating every number. This can happen when you write fixed with
columns, and you have numbers larger than expected. Please check your
files for this.

There is a way to read fixed with columns with no spaces between the
numbers, but it is inefficient and slow for large amounts of data.
Let us know if you need this. If you can easily regenerate the input
files with sufficient column width for all numbers, that would be the
better solution.

Please reply only to the user list.

--Dave

On Fri, Sep 6, 2013 at 12:44 PM, Bithi De <bde@alaska.edu> wrote:
> Hi,
> I am having some problem with reading data.
> I have total 384 files for each month for 32years. Print Variable
> summary for each file is like this:
> Variable: PEdec_mean
> Type: float
> Total Size: 42048 bytes
> 10512 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 73] x [lon | 144]
> Coordinates:
> lat: [90..-90]
> lon: [ 0..357.5]
> Number Of Attributes: 3
> average_op_ncl : dim_avg_n over dimension(s): time
> sum_op_ncl : dim_sum_n over dimension(s): level
> _FillValue : -32767
>
> I need to make an array with dimension (month,year, lat, lon) . When i
> am trying to read the files , I am having some error.
>
> the part of my code is as follows:
>
> PeT= new((/12,32,73,144/),"float")
> n = 0
> do y =1979,2010
>
> PeT(0,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEjan_"+y,
> (/73,144/), "float")
> PeT(1,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEfeb_"+y,
> (/73,144/), "float")
> PeT(2,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEmar_"+y,
> (/73,144/), "float")
> PeT(3,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEapr_"+y,
> (/73,144/), "float")
> PeT(4,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEmay_"+y,
> (/73,144/), "float")
> PeT(5,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEjun_"+y,
> (/73,144/), "float")
> PeT(6,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEjul_"+y,
> (/73,144/), "float")
> PeT(7,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEaug_"+y,
> (/73,144/), "float")
> PeT(8,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEsep_"+y,
> (/73,144/), "float")
> PeT(9,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEoct_"+y,
> (/73,144/), "float")
> PeT(10,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEnov_"+y,
> (/73,144/), "float")
> PeT(11,n,:,:) = asciiread("/data/home/bithi/R2/NCL/PE/PEdec_"+y,
> (/73,144/), "float")
> n=n+1
> end do
>
> PeT!2 = "lat"
> PeT!3 = "lon"
> PeT&lat = lat
> PeT&lon = lon
>
> printVarSummary (PeT)
> printMinMax (PeT, True)
>
> And the error is like this:
> warning:asciiread: End of file reached and only (10452) elements were
> read from the file, filling remaining elements with the default
> missing value for the requested type
> warning:asciiread: End of file reached and only (10459) elements were
> read from the file, filling remaining elements with the default
> missing value for the requested type
> warning:asciiread: End of file reached and only (10510) elements were
> read from the file, filling remaining elements with the default
> missing value for the requested type
> warning:asciiread: End of file reached and only (10466) elements were
> read from the file, filling remaining elements with the default
> missing value for the requested type
> warning:asciiread: End of file reached and only (10335) elements were
> read from the file, filling remaining elements with the default
> missing value for the requested type
>
> I tried to find if there is any missing value with
> if(any(ismissing(data))) then
> print("Your data contains some missing values. Beware.")
> end if
> But it did not give any warning.
>
> Thanks,
> Bithi
>
>
> --
>
>
> Bithi De
>
> Graduate Student , Research Assistant
> International Arctic Research Center , University of Alaska Fairbanks
> Fairbanks , Alaska -99775
> USA
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 6 12:58:09 2013

This archive was generated by hypermail 2.1.8 : Mon Sep 16 2013 - 13:43:52 MDT