Re: error reading WRF netCDF data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 1 Dec 2005 22:57:03 -0700 (MST)

I looked at your file:

   36128579696 wrfout_d01_2003-07-03_00:00:00

Is this a 36*GB* file?

I was able to open the file with "ncl.new" [version a033].

%>ncl.new
  Copyright (C) 1995-2005 - All Rights Reserved
  University Corporation for Atmospheric Research
  NCAR Command Language Version 4.2.0.a033
                                ^^^^^^^^^^^
  The use of this software is governed by a License Agreement.
  See http://www.ncl.ucar.edu/ for more details.

ncl 0> f = addfile ("wrfout_d01_2003-07-03_00:00:00.nc" , "r")
ncl 1> print(f)
Variable: f (file variable)

filename: wrfout_d01_2003-07-03_00:00:00
path: wrfout_d01_2003-07-03_00:00:00
    file global attributes:
       TITLE : OUTPUT FROM WRF V2.1 MODEL
       START_DATE : 2003-07-03_00:00:00
       SIMULATION_START_DATE : 2003-07-03_00:00:00
       WEST-EAST_GRID_DIMENSION : 241
       SOUTH-NORTH_GRID_DIMENSION : 181
       BOTTOM-TOP_GRID_DIMENSION : 41
[SNIP]

ncl 2> rainnc = f->RAINNC
ncl 3> printVarSummary(rainnc)

Variable: rainnc
Type: float
Total Size: 58233600 bytes
             14558400 values
Number of Dimensions: 3
Dimensions and sizes: [Time | 337] x [south_north | 180] x [west_east | 240]
Coordinates:
Number Of Attributes: 5
   FieldType : 104
   MemoryOrder : XY
   description : ACCUMULATED TOTAL GRID SCALE PRECIPITATION
   units : mm
   stagger :

ncl 4> T = f->T
ncl 3> printVarSummary(T)

Variable: T
Type: float
Total Size: -1965623296 bytes
             582336000 values
Number of Dimensions: 4
Dimensions and sizes: [Time | 337] x [bottom_top | 40] x [south_north | 180] x [west_east | 240]
Coordinates:
Number Of Attributes: 5
   FieldType : 104
   MemoryOrder : XYZ
   description : perturbation potential temperature (theta-t0)
   units : K
-------------------------------------------

Use ncl.new

good luck

On Thu, 1 Dec 2005, Kyoko Ikeda wrote:

> Hello,
>
> I am trying to read in WRF dataset (in netCDF) on bluesky (set to 32-bit,
> double precision) and write a selection of variables to a new netCDF file.
> But I have been having problems.
> The following is my script:
>
> load "WRFOptions.ncl"
> load "$NCARG_LIB/ncarg/nclscripts/csm/gsn_code.ncl"
> load "WRFPlot.ncl"
> load "WRFUserARW.ncl"
> load "$NCARG_LIB/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
> ;-------------------------------------------------------------- ;
> The WRF ARW input file. ;--------------------------------------------------------------
> OUTDIR = "/ptmp/kyoko/"
> INDIR = "/mmm/mmmtmp/chliu/wrf/WRFV2/run/"
> FILENM = "wrfout_d01_2003-07-03_00:00:00.nc"
>
> a = addfile(INDIR+FILENM,"r")
>
> ;-------------------------------------------------------------- ;
> Debug information. ;--------------------------------------------------------------
>
> ; debug = False
> debug = True
>
> ;--------------------------------------------------------------
> ;--------------------------------------------------------------
> Times = a->Times;
> times = chartostring(Times) ;
>
> RAINC = a->RAINC;
> RAINNC = a->RAINNC;
> LH = a->LH;
> tmpvar = a->RAINC;
>
> printVarSummary(tmpvar)
> ndim_tmpvar = dimsizes(tmpvar);
> ntime = ndim_tmpvar(0);
> ny = ndim_tmpvar(1);
> nx = ndim_tmpvar(2);
> delete(tmpvar)
> delete(ndim_tmpvar)
>
> system("/bin/rm $TMPDIR/example.nc") ; remove if exists fout
> = addfile("/ptmp/kyoko/example.nc","c") ; open output file ;--------------------------------------------------------------
> ;--------------------------------------------------------------
> fAtt = True ; assign file attributes
> fAtt_at_title = "NCL write_wrf_nc"
> fAtt_at_source_file = FILENM
> fAtt_at_Conventions = "None"
> fAtt_at_creation_date = systemfunc("date")
> fileattdef(fout,fAtt)
>
> ;--------------------------------------------------------------
> ;-------------------------------------------------------------- dimNames = (/"Time","south_north","west_east"/)
> dimSizes = (/ntime,ny,nx/)
> dimUnlim = (/False,False,False/)
> filedimdef(fout,dimNames,dimSizes,dimUnlim)
>
> ;--------------------------------------------------------------
> ;-------------------------------------------------------------- filevardef(fout, "Times", typeof(Times), "Time")
> filevardef(fout, "RAINC",
> typeof(RAINC),(/"Time","south_north","west_east"/))
> filevardef(fout, "RAINNC", typeof(RAINNC),
> (/"Time","south_north","west_east"/)) filevardef(fout, "LH",
> typeof(LH), (/"Time","south_north","west_east"/)) ;--------------------------------------------------------------
> ;--------------------------------------------------------------
> filevarattdef(fout,"RAINC",RAINC)
> filevarattdef(fout,"RAINNC",RAINNC)
> filevarattdef(fout,"LH",LH)
>
> ;--------------------------------------------------------------
> ;--------------------------------------------------------------
> fout->Times = (/Times/)
> fout->RAINC=(/RAINC/)
> fout->RAINNC=(/RAINNC/)
> fout->LH=(/LH/)
>
> end
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Troubles are,
> (1) I get following error messages
> ncvarget: Error in getting the data: Invalid argument
> ncvarget: Error in getting the data: Invalid argument
> ncvarget: Error in getting the data: Invalid argument
> ncvarget: Error in getting the data: Invalid argument
> ncvarget: Error in getting the data: Invalid argument
>
> corresponding to these commands
> Times = a->Times;
> RAINC = a->RAINC;
> RAINNC = a->RAINNC;
> LH = a->LH;
> tmpvar = a->RAINC;
> (2) values do not exist after the 20th time index. However,results from
> ncdump on these variables tells me that values do exist at all time and
> grid points.(3) When I check times that has been converted via chartostring, I get
> correct times from index 0 to 19, but the rest is blank or have funny
> characters: Variable: times (subsection)
> Type: string
> Total Size: 176 bytes
> 22 values
> Number of Dimensions: 1
> Dimensions and sizes: [22]
> Coordinates:
> (0) 2003-07-03_00:30:00
> (1) 2003-07-03_01:00:00
> (2) 2003-07-03_01:30:00
> (3) 2003-07-03_02:00:00
> (4) 2003-07-03_02:30:00
> (5) 2003-07-03_03:00:00
> (6) 2003-07-03_03:30:00
> (7) 2003-07-03_04:00:00
> (8) 2003-07-03_04:30:00
> (9) 2003-07-03_05:00:00
> (10) 2003-07-03_05:30:00
> (11) 2003-07-03_06:00:00
> (12) 2003-07-03_06:30:00
> (13) 2003-07-03_07:00:00
> (14) 2003-07-03_07:30:00
> (15) 2003-07-03_08:00:00
> (16) 2003-07-03_08:30:00
> (17) 2003-07-03_09:00:00
> (18) 2003-07-03_09:30:00
> (19) 2003-07-03_10:00:00
> (20)
> (21)
> .
> .
> .
> (228) òÍp
> (229)
> (230)
> (231) òÒÐ
> .
> .
> .
> (336)
>
> (4) If I try to plot out a variable following examples from
> http://www.ncl.ucar.edu/Applications/wrf.shtml and WRF_NCL scripts, I also
> have trouble reading times and variables after 19th time index.
> Could someone help me?
>
> Thank you.
>
> -kyoko
>
>
>
> _______________________________________________
> 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 Thu Dec 01 2005 - 22:57:03 MST

This archive was generated by hypermail 2.2.0 : Fri Dec 02 2005 - 16:53:55 MST