<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Dear all,<br></div><div><br></div><div>I'm trying to convert ASCII files to geogrid binary format but without success. To do that, I have used the following fortran code<br></div><div><br></div><div><br></div><div>---<br></div><div>PROGRAM asc2bin<br><br>INTEGER isigned,i,j,endian,wordsize,nx,ny<br>REAL*8 missvalue, xllcorner,yllcorner,cellsize<br>INTEGER nz<br>REAL scalefactor<br>REAL, ALLOCATABLE :: rarray(:,:),iarray(:,:),barray(:,:)<br>CHARACTER::head12<br><br>isigned = 1<br>endian = 0<br>wordsize = 1<br>scalefactor = 1.0<br>nz = 1<br>open(10,file='/work/crct/mo9378al/WRF/WPSv351_Cent0S64_Intel/geogrid/src/alpes4.grd')<br>read(10,*)head12,nx<br>read(10,*)head12,ny<br>read(10,*)head12,xllcorner<br>read(10,*)head12,yllcorner<br>read(10,*)head12,cellsize<br>read(10,*)head12,missvalue<br>print*,'nx,ny',nx,ny,xllcorner,yllcorner,cellsize,missvalue<br>allocate(rarray(nx,ny))<br>allocate(iarray(nx,ny))<br><br>do j = 1, ny<br>read(10,*)iarray(:,j)<br>enddo<br><br>do j = 1, ny<br>rarray(:,j)=iarray(:,ny-j+1)<br>enddo<br><br>!set the missing values<br>do j = 1, ny<br>do i = 1, nx<br>if ( rarray(i,j) < 0 ) then<br>rarray(i,j) = -99 ! set negative terrain to be zero since those are near coastal or river<br>end if<br>end do<br>end do<br><br>call write_geogrid(rarray,nx,ny,nz,isigned,endian,scalefactor,wordsize)<br>print*,'Rarray2',rarray(nx,ny)<br>deallocate(rarray)<br><br>stop<br>end<br><br><br></div><div>---------<br></div><div><br></div><div><br></div><div><br></div><div>I have changed my GEOGRID.TBL, but when I run geogrid.exe, I get all zero values in the HGT. <br></div><div><br></div><div>Can anyone help me please ?<br></div><div><br></div><div>Thanks <br></div><div><br></div><div>Mouhamad<br></div><div><br></div></div></body></html>