[gradsusr] ARW Post for Grads

Roger Shi shi at agnes.gsfc.nasa.gov
Thu Oct 28 11:32:18 EDT 2010


Dear Sravan,

Yes, the xy array size in your grads file should be 129 x 144 (not 331 x 
306) based on your ctl file created by ARWpost. There are a few coding 
errors in your fortran code. Your main problem is that you are trying to 
use the fortran read statement for the "sequential access" format to 
read a file with the "direct access" format. Try to modify the code like 
the following

irec=0

do 5  it = 1,nt
do 10 iz = 1,nz
     irec=irec+1
     read (12,rec=irec) dum
do 15 ix = 1,nx
do 16 iy = 1,ny
   x(ix,iy,iz) = dum(ix,iy)
16 continue
15 continue
10 continue

   :
   :
   : 

5  continue


Good luck,
Roger

================================================
Dr. Jainn Jong Shi (aka Roger)
Bldg 33 Rm C425
Code 613.1
NASA/Goddard Space Flight Center
Greenbelt, MD 20771
email: shi at agnes.gsfc.nasa.gov



Matei Georgescu wrote:
> Dear Sravan,
>
> It makes sense that the record length matches.  You are (via your 
> Fortran declaration) only writing arrays of size (129,144) (these are 
> smaller than the 331 X 306 sized arrays you should be writing, so 
> executing your Fortran code will not produce an error). That does not 
> mean you are reading/writing the 'correct' output - this is why you 
> are not 'picking the right output'.
>
> Your Fortran declaration needs to have the number of x- and y-points 
> that correspond to your control file (i.e., 331 and 306 points, 
> respectively). When you open Grads and 'open .ctl', your pdef line 
> automatically tells Grads, "I'm using xdef = 331 and ydef = 306" - 
> otherwise, what is the point of having pdef?
>
> good luck,
> matei
>
> On Thu, Oct 28, 2010 at 2:29 AM, Sravan <sravan_sase at yahoo.in 
> <mailto:sravan_sase at yahoo.in>> wrote:
>
>     Dear Matei,
>     I want to inform you that the no. of points in x and y directions
>     are as per the pdef in the ctl file.
>     Even the record length and all are perfectly matching. I have
>     computed the no of levels also as per the control file.
>     One more thing is if I compute the same parameters from the
>     WRF2GrADS output it is picking up the values very fine.
>     The problem is with the ARW post only. Even I have fixed the lat
>     and lon values fix and picked up the
>     24hr accumulated (rainc+rainnc) values. It is giving some
>     exponentional values for some time steps.
>     What can be done in this regard.
>
>      
>
>     Thanks
>
>     Sravan
>
>
>      
>     ############################
>     M.SRAVAN KUMAR
>     SCIENTIST
>     RDC SASE
>     CHANDIGARH - 160036
>     INDIA
>     ############################
>
>
>     ------------------------------------------------------------------------
>     *From:* Matei Georgescu <Matei.Georgescu at asu.edu
>     <mailto:Matei.Georgescu at asu.edu>>
>     *To:* GrADS Users Forum <gradsusr at gradsusr.org
>     <mailto:gradsusr at gradsusr.org>>
>     *Sent:* Wed, 27 October, 2010 8:25:18 PM
>     *Subject:* Re: [gradsusr] ARW Post for Grads
>
>     Dear Sravan,
>
>     It appears that there is a mismatch between your .ctl file and
>     fortran declarations.
>
>     You have this as a fortran declaration:
>     parameter(nx=129,ny=144,nz=171,ns=30,nt=41,nd=5)
>
>     but your .ctl file contains 331 x-points and 306 y-points (check
>     your z-levels as well). In using pdef, ARWPost is regridding to a
>     new resolution, which will be reflected in your .ctl file.
>
>     matei
>
>     *======================================*
>     *Matei Georgescu, Ph.D.*
>     /School of Mathematical and Statistical Sciences and
>     Center for Environmental Fluid Dynamics/
>     /Arizona State University/
>     *Phone*: (480) 965-3770
>     *Fax*: (480) 965-8119
>     *E-mail*: Matei.Georgescu at asu.edu <mailto:Matei.Georgescu at asu.edu>
>     *======================================*
>
>     On Tue, Oct 26, 2010 at 10:08 PM, Sravan <sravan_sase at yahoo.in
>     <mailto:sravan_sase at yahoo.in>> wrote:
>
>         Dear Users
>         I am using ARW post to reate .ctl and .dat files for the GrADS.
>         Now I want to extract some perameters from the .dat file for
>         some particular locations.
>         I have used a fortran script to extract the perameters. But it
>         is not picking the one which I want.
>         I am giving the .ctl file for your reference.
>
>         dset ^dom3.dat
>
>         options byteswapped
>
>         undef 1.e30
>
>         title OUTPUT FROM WRF V3.2.1 MODEL
>
>         pdef 129 144 lcc 31.672 78.135 65.000 72.500 30.00000 10.00000
>         77.00000 9000.000 9000.000
>
>         xdef 331 linear 71.47070 0.04054054
>
>         ydef 306 linear 25.33539 0.04054054
>
>         zdef 19 levels
>
>         1000.00000
>
>         950.00000
>
>         900.00000
>
>         850.00000
>
>         800.00000
>
>         750.00000
>
>         700.00000
>
>         650.00000
>
>         600.00000
>
>         550.00000
>
>         500.00000
>
>         450.00000
>
>         400.00000
>
>         350.00000
>
>         300.00000
>
>         250.00000
>
>         200.00000
>
>         150.00000
>
>         100.00000
>
>         tdef 41 linear 00Z26OCT2010 180MN
>
>         VARS 27
>
>         LU_INDEX 1 0 LAND USE CATEGORY (-)
>
>         U 19 0 x-wind component (m s-1)
>
>         V 19 0 y-wind component (m s-1)
>
>         W 19 0 z-wind component (m s-1)
>
>         PH 19 0 perturbation geopotential (m2 s-2)
>
>         PHB 19 0 base-state geopotential (m2 s-2)
>
>         T 19 0 perturbation potential temperature (theta-t0) (K)
>
>         MU 1 0 perturbation dry air mass in column (Pa)
>
>         MUB 1 0 base state dry air mass in column (Pa)
>
>         P 19 0 perturbation pressure (Pa)
>
>         PB 19 0 BASE STATE PRESSURE (Pa)
>
>         T2 1 0 TEMP at 2 M (K)
>
>         TH2 1 0 POT TEMP at 2 M (K)
>
>         PSFC 1 0 SFC PRESSURE (Pa)
>
>         U10 1 0 U at 10 M (m s-1)
>
>         V10 1 0 V at 10 M (m s-1)
>
>         LANDMASK 1 0 LAND MASK (1 FOR LAND, 0 FOR WATER) (-)
>
>         VEGFRA 1 0 VEGETATION FRACTION (-)
>
>         SST 1 0 SEA SURFACE TEMPERATURE (K)
>
>         HGT 1 0 Terrain Height (m)
>
>         TSK 1 0 SURFACE SKIN TEMPERATURE (K)
>
>         RAINC 1 0 ACCUMULATED TOTAL CUMULUS PRECIPITATION (mm)
>
>         RAINNC 1 0 ACCUMULATED TOTAL GRID SCALE PRECIPITATION (mm)
>
>         XLAT 1 0 LATITUDE, SOUTH IS NEGATIVE (degree_north)
>
>         XLONG 1 0 LONGITUDE, WEST IS NEGATIVE (degree_east)
>
>         TMN 1 0 SOIL TEMPERATURE AT LOWER BOUNDARY (K)
>
>         PBLH 1 0 PBL HEIGHT (m)
>
>         ENDVARS
>
>         And the fortran code which I have used to extract the
>         variables is given below.
>
>         parameter(nx=129,ny=144,nz=171,ns=30,nt=41,nd=5)
>
>         dimension x(nx,ny,nz),dum(nx,ny)
>
>         open(12,file='./dom3.dat',form='unformatted',access='direct',recl=nx*ny*4)
>
>         do 5 it = 1,nt
>
>         do 10 iz = 1,nz
>
>         read (12) dum
>
>         do 15 ix = 1,nx
>
>         do 16 iy = 1,ny
>
>         x(ix,iy,iz) = dum(ix,iy)
>
>         16 continue
>
>         15 continue
>
>         10 continue
>
>         do 99 k=1,10
>
>         p1(k,it) = x(ix,iy,166)+x(ix,iy,167)
>
>         write (*,*) p1(k,it)
>         99 continue
>         stop
>         end
>          
>         I am using a 64 bit Linux Machine with pgf77 compiler.
>         Can any one clarify what options byteswapped means?
>         Kindly Help Me
>          
>         Regards
>         Sravan
>          
>         ############################
>         M.SRAVAN KUMAR
>         SCIENTIST
>         RDC SASE
>         CHANDIGARH - 160036
>         INDIA
>         ############################
>
>         _______________________________________________
>         gradsusr mailing list
>         gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>         http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>     _______________________________________________
>     gradsusr mailing list
>     gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>     http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> -- 
> *======================================*
> *Matei Georgescu, Ph.D.*
> /School of Mathematical and Statistical Sciences and
> Center for Environmental Fluid Dynamics/
> /Arizona State University/
> *Phone*: (480) 965-3770
> *Fax*: (480) 965-8119
> *E-mail*: Matei.Georgescu at asu.edu <mailto:Matei.Georgescu at asu.edu>
> *======================================*
> ------------------------------------------------------------------------
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20101028/197cc800/attachment-0003.html 


More information about the gradsusr mailing list