c this subroutine is used for retrieving all the data of a c specific station from wind_gen.wdb (master database) c and putting them into the global variables defined in the c wind_db.fi include file. subroutine read_wdb i (iu, station_no) integer iu ! wind_gen database file unit no. integer station_no ! desired wban station no. include 'wind_db.fi' ! global common variables of wind_gen record character*128 line ! temporary storage for reading in data integer line_cnt integer record_cnt integer i, m c for the database header --- 2 lines 100 format (a,1x,i5,1x,a,a,1x,a) 110 format (i2,1x,i2,1x,a,1x,i3,1x,i2,1x,a,1x,i2,1x,a,1x,a,1x,a) c for dir(i,m) --- 17 lines 200 format (12(1x,f4.1)) c for scale(i,m) and shape(i,m) --- 32 lines 300 format (12(2x,f4.2)) c for ratio(m) --- 1 line 400 format (12(2x,f3.1)) c for hr_max(m) --- 1 line 500 format (12(3x,i2)) c for the search_no 800 format (i5) 810 format (2x,i5) 820 format (1x) line_cnt = 0 record_cnt = 0 ! print*, 'station_no: ',station_no 50 read (iu, '(A)') line if (line(1:1) .eq. '#') then read (line(2:), *) st_no record_cnt = record_cnt +1 ! print*, 'read a # sign and st_no is: ',st_no, record_cnt if (st_no .eq. station_no) then !found correct station record ! read in record here read (line(2:),*) st_no, st_country, st_state, st_city ! print*, st_no, st_country, st_state, st_city read (iu, '(A)') line read (line,*) lati_deg, lati_min, lati_hem, long_deg, * long_min, long_hem, elevation, s_date, e_date, obs ! print*, lati_deg, lati_min, lati_hem, ' ', long_deg, ! * long_min, long_hem, ' ', elevation, s_date,' ', ! * e_date,' ', obs do 40 i = 0, NDIR !get dir(i,m) read (iu,*) (dir(i,m), m=0,NMONTHS-1) 40 continue do 72 i = 0, NDIR-1 !get scale(i,m) read (iu,*) (scale(i,m), m=0,NMONTHS-1) 72 continue do 73 i = 0, NDIR-1 ! get shape(i,m) read (iu,*) (shape(i,m), m=0,NMONTHS-1) 73 continue read (iu,*) (ratio(m), m=0,NMONTHS-1) !get ratio(m) read (iu,*) (hr_max(m), m=0,NMONTHS-1) !get hr_max(m) else ! wrong station, goto next one goto 50 endif else ! not start of a wind_db record, goto next line goto 50 endif return 999 print*, 'not found it !' end