Re: Problem in reading ascii file

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 26 2012 - 11:45:58 MDT

Try:

;***********************************************************
; Read eape from ascii files and store seasonal mean into
; an array
;***********************************************************
  nens = 2007 - 1978 + 1
  nlat = 128
  mlon = 256

  eape_ltw = new((/nens,nlat,mlon/),"float")

  t=0
  do i= 1978,2007
     eape_ltw(t,:,:) = asciiread("eape_fall_raw_ens1"+i,(/nlat,mlon/),"float")

     t=t+1
  end do

  if (any(ismissing(eape_ltw))) then
      print("Your data has missing")
  end if

  eape_ltw@_FillValue = -999
  eape_ltw!0 = "year"
  eape_ltw!1 = "lat"
  eape_ltw!2 = "lon"

 ;copy_VarCoords(temp,eape_ltw)
  printVarSummary(eape_ltw)
 ;printMinMax(eape_ltw,True)
  print("Min(eape_ltw) = " + min(eape_ltw))
  print("Max(eape_ltw) = " + max(eape_ltw))

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Apr 26, 2012, at 11:08 AM, Soumik Basu wrote:

> Thanks for the reply. I am already using asciiread it already and
> checked for missing value. Here is the portion of the code I am using to
> read the file.
>
> ;***********************************************************
> ; Read eape from ascii files and store seasonal mean into
> ; an array
> ;***********************************************************
> eape_ltw = new((/nens,nlat,mlon/),"float")
> eape_ltw@_FillValue = -999
> eape_ltw!0 = "year"
> eape_ltw!1 = "lat"
> eape_ltw!2 = "lon"
>
> n=0
> t=0
> do i= 1978,2007
> eape_ltw(t,:,:) =
> asciiread("/data2/6-hourly/ensemble_run/tracks/energy/eape/raw/fall2/eape_fall_raw_ens1"+i,(/nlat,mlon/),"float")
> t=t+1
> if (any(ismissing(eape_ltw)))then
> print("Your data is missing")
> n=n+1
> print(n)
> end if
> end do
>
> copy_VarCoords(temp,eape_ltw)
> printVarSummary(eape_ltw)
> printMinMax(eape_ltw,True)
>
>
> Thanks,
>
>
> On 2012-04-26 08:55, Wei Huang wrote:
>> Soumik,
>>
>> try:
>>
>> var = asciiread("eape_fall_raw_ens11986.txt", (/128, 256/), "float")
>>
>> printVarSummary(var)
>>
>> Wei
>>
>> huangwei@ucar.edu
>> VETS/CISL
>> National Center for Atmospheric Research
>> P.O. Box 3000 (1850 Table Mesa Dr.)
>> Boulder, CO 80307-3000 USA
>> (303) 497-8924
>>
>>
>>
>>
>>
>>
>> On Apr 26, 2012, at 10:45 AM, Soumik Basu wrote:
>>
>>> Hi,
>>>
>>> I am trying to read my data from a simple ascii file of dimension
>>> 128x256. But somehow I am getting the warning that my data is missing.
>>> I am sure that there is no missing values in the file it's just
>>> somehow NCL is skipping some values while reading. I used the format
>>> statement 256f11.5 to create the ascii file. I am attaching two sample
>>> ascii file that I am trying to read. Can anybody please help me
>>> pointing out where is it going wrong.
>>>
>>> Thanks,
>>>
>>> --
>>> "Numbing the pain for a while will make it worse when you finally
>>> feel it.
>>> ~J.K. Rowling"
>>> *****************************************
>>> Soumik Basu
>>> Graduate Student, Research Assistant
>>> International Arctic Research Center
>>> University of Alaska Fairbanks
>>> Fairbanks,Alaska,USA
>>>
>>> *****************************************<eape_fall_raw_ens11986.txt><eape_fall_raw_ens12003.txt>_______________________________________________
>>> 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
>
> --
> "Numbing the pain for a while will make it worse when you finally feel
> it.
> ~J.K. Rowling"
> *****************************************
> Soumik Basu
> Graduate Student, Research Assistant
> International Arctic Research Center
> University of Alaska Fairbanks
> Fairbanks,Alaska,USA
> *****************************************
> _______________________________________________
> 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 Apr 26 11:46:07 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 30 2012 - 09:21:12 MDT