[Wrf-users] ASCII file to geogrid

Mouhamad Al-Sayed-Ali Mouhamad.Al-Sayed-Ali at u-bourgogne.fr
Thu Sep 25 08:14:25 MDT 2014


Dear all, 

I'm trying to convert ASCII files to geogrid binary format but without success. To do that, I have used the following fortran code 


--- 
PROGRAM asc2bin 

INTEGER isigned,i,j,endian,wordsize,nx,ny 
REAL*8 missvalue, xllcorner,yllcorner,cellsize 
INTEGER nz 
REAL scalefactor 
REAL, ALLOCATABLE :: rarray(:,:),iarray(:,:),barray(:,:) 
CHARACTER::head12 

isigned = 1 
endian = 0 
wordsize = 1 
scalefactor = 1.0 
nz = 1 
open(10,file='/work/crct/mo9378al/WRF/WPSv351_Cent0S64_Intel/geogrid/src/alpes4.grd') 
read(10,*)head12,nx 
read(10,*)head12,ny 
read(10,*)head12,xllcorner 
read(10,*)head12,yllcorner 
read(10,*)head12,cellsize 
read(10,*)head12,missvalue 
print*,'nx,ny',nx,ny,xllcorner,yllcorner,cellsize,missvalue 
allocate(rarray(nx,ny)) 
allocate(iarray(nx,ny)) 

do j = 1, ny 
read(10,*)iarray(:,j) 
enddo 

do j = 1, ny 
rarray(:,j)=iarray(:,ny-j+1) 
enddo 

!set the missing values 
do j = 1, ny 
do i = 1, nx 
if ( rarray(i,j) < 0 ) then 
rarray(i,j) = -99 ! set negative terrain to be zero since those are near coastal or river 
end if 
end do 
end do 

call write_geogrid(rarray,nx,ny,nz,isigned,endian,scalefactor,wordsize) 
print*,'Rarray2',rarray(nx,ny) 
deallocate(rarray) 

stop 
end 


--------- 



I have changed my GEOGRID.TBL, but when I run geogrid.exe, I get all zero values in the HGT. 

Can anyone help me please ? 

Thanks 

Mouhamad 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20140925/aab6b781/attachment.html 


More information about the Wrf-users mailing list