Skip to content

Instantly share code, notes, and snippets.

@sean0921
Created August 23, 2019 05:56
Show Gist options
  • Save sean0921/59cb6f393bb3044733af0f9440cd176e to your computer and use it in GitHub Desktop.
Save sean0921/59cb6f393bb3044733af0f9440cd176e to your computer and use it in GitHub Desktop.
diff --git a/bern2time.for b/bern2time_FN.for
index 665cdb7..b07dff7 100644
--- a/bern2time.for
+++ b/bern2time_FN.for
@@ -31,7 +31,7 @@ c
read(*,*)fve
print*,'vn (mm/yr): '
read(*,*)fvn
- print*,'vu (mm/yr): '
+ print*,'vh (mm/yr): '
read(*,*)fvh
else if(ch==2) then
fvn=0.
@@ -48,16 +48,15 @@ c
if(alive) call system('del fil.dat')
inquire(file='error.msg',exist=alive)
if(alive) call system('del error.msg')
- call system('del ts_????_b.dat ts_????_n_b.dat ts_????_e_b.dat ts_
- +????_u_b.dat')
+ call system('del ts_????_n_b.dat ts_????_e_b.dat ts_????_u_b.dat')
call system('for %f in (FN??????.OUT) do echo %f >> fil.dat')
#else
inquire(file='fil.dat',exist=alive)
if(alive) call system('rm -f fil.dat')
inquire(file='error.msg',exist=alive)
if(alive) call system('rm -f error.msg')
- call system('rm -f ts_????_b.dat ts_????_n_b.dat ts_????_e_b.dat t
- +s_????_u_b.dat')
+ call system('rm -f ts_????_n_b.dat ts_????_e_b.dat ts_????_u_b.dat
+ +')
call system('for f in $(ls FN??????.OUT);do echo $f;done >> fil.da
+t')
#endif
@@ -73,12 +72,14 @@ c
rewind(15)
allocate(outfile(n))
do i=1,n
- read(15,'(a12)',iostat=stat)inpfile
+ read(15,'(a12)',iostat=stat) inpfile
if(stat/=0) exit
print*,'Processing '//inpfile//' ...'
- outfile(i)=inpfile(3:8)//'.plh'
+ outfile(i)=inpfile(3:7)//'.plh'
+
open(11,file=inpfile)
open(12,file=outfile(i))
+
stat=0
do while (stat==0)
read(11,'(a)',iostat=stat) line
@@ -108,7 +109,7 @@ c
+laterr
sign=laterr*1000*10
else if(line(24:32)=='LONGITUDE') then
- read(line,'(54x,i3,1x,i2,1x,f9.6,16x,f6.4)')lon,lonm,lons,
+ read(line,'(54x,i3,1x,i2,1x,f9.6,16x,f8.4)')lon,lonm,lons,
+lonerr
sige=lonerr*1000*10
write(12,'(a4,2(i4,i3,f10.6),f10.4,3f10.2)')sta1,lon,lonm,
@@ -152,13 +153,14 @@ c***********************************************************************
print*,'Start time_anal'
do i=1,n
- open(11,file=plhfil(i),status='old')
+ open(11,file=plhfil(i))
read(11,'(f7.4)',iostat=stat)tt
if(stat/=0)exit
dy(1:3)=plhfil(i)(3:5)
yr(3:4)=plhfil(i)(1:2)
if(yr(3:3)=='9') yr(1:2)='19'
- if(yr(3:3)/='9') yr(1:2)='20'
+ if(yr(3:3)=='0') yr(1:2)='20'
+ if(yr(3:3)=='1') yr(1:2)='20'
t=yr//' '//dy
stat=0
do while (stat==0)
@@ -215,8 +217,8 @@ c***********************************************************************
open(15,file=out3)
open(16,file=out4)
- write(16,*)'year doy hr dn sn de se
- + dh sh (unit: mm)'
+ write(16,*)'year doy hr dn sn de
+ + se dh sh (unit: mm)'
n=0
avgn=0.
@@ -237,11 +239,10 @@ c***********************************************************************
close(16)
#ifdef MINGW
temp='del '//out1//' '//out2//' '//out3//' '//out4//' '//inp
- call system(temp)
#else
temp='rm -f '//out1//' '//out2//' '//out3//' '//out4//' '//inp
- call system(temp)
#endif
+ call system(temp)
open(11,file='error.msg',position='append')
write(11,'("Station ",a4," is not found!")')sta(i)
write(*,'(" Warning!! Station ",a4," is not found!")')sta(i)
@@ -252,10 +253,8 @@ c***********************************************************************
allocate(yr(n),dy(n),t(n),time(n),hgh(n),se(n),sn(n),sh(n),
+rlon(n),rlat(n),dn(n),de(n),dh(n))
do k=1,n
- read(12,'(2i4,f8.4,2(i4,i3,f10.6),f10.4,3f10.2)',iostat=stat)y
- +r(k),dy(k),t(k),lon,lonm,lons,lat,latm,lats,hgh(k),se(k),sn(k)
- +,sh(k)
- if(stat/=0) exit
+ read(12,'(2i4,f8.4,2(i4,i3,f10.6),f10.4,3f10.2)')yr(k),dy(k),
+ +t(k),lon,lonm,lons,lat,latm,lats,hgh(k),se(k),sn(k),sh(k)
rlon(k)=lon+lonm/60.+lons/3600.
rlat(k)=lat+latm/60.+lats/3600.
if(mod(yr(k),4)==0) then
@@ -290,10 +289,10 @@ c***********************************************************************
ade=ade/real(n)
adh=adh/real(n)
do k=1,n
- write(13,'(f10.5,1x,2f8.2)') time(k),dn(k)-adn,sn(k)
- write(14,'(f10.5,1x,2f8.2)') time(k),de(k)-ade,se(k)
- write(15,'(f10.5,1x,2f8.2)') time(k),dh(k)-adh,sh(k)
- write(16,'(2i4,f8.4,1x,6f8.2)') yr(k),dy(k),t(k),dn(k)-adn,
+ write(13,'(f10.5,1x,2f10.2)') time(k),dn(k)-adn,sn(k)
+ write(14,'(f10.5,1x,2f10.2)') time(k),de(k)-ade,se(k)
+ write(15,'(f10.5,1x,2f10.2)') time(k),dh(k)-adh,sh(k)
+ write(16,'(2i4,f8.4,1x,6f10.2)') yr(k),dy(k),t(k),dn(k)-adn,
+sn(k),de(k)-ade,se(k),dh(k)-adh,sh(k)
end do
close(12,status='delete')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment