c-----------------------------1. explaination-------------------------------- c c --- 1.test windgen direction c test windgen--| c --- 2.test windgen speed c c----------------------------------------------------------------------------- c c 1.test windgen direction c c source code output c c |--windgen_mid_direction.for -> windgen_mid_direction c test |--test_eachyear_direction.for -> test_eachyear_direction c windgen --|--test_allyear_direction.for -> test_allyear_direction c direction |--error_direction_direction.for -> error_direction_direction c |--error_month_direction.for -> error_month_direction c c c windgen_output ----| c | |->test_eachyear_direction c | | c | | |->error_direction_direction c v |->test_allyear_direction-| c windgen_mid_direction-| |->error_month_direction c c c c 1)."windgen_output": output file generated by bin>wind_gen, c should be in bin subdirectory. c ex: c bin>wind_gen -v -D -f ../../db/wind_gen.wdb c -s 25704 -y 100 -o windgen_output c c 2)."windgen_mid_direction.for": from the "windgen_output", the program c generated a output file c "windgen_mid_direction" which is used c for internal process output. c 3)."test_eachyear_direction.for": from the "windgen_mid_direction" file, c the program generated a output file c "test_eachyear_direction" which is c used for detail by month/dir of c each year. c 4)."test_allyear_direction.for": from the "windgen_mid_direction" file, c the program generated a output file c "test_allyear_direction" which is c used for detail by month/dir of c all year (5, 10, 15, ...100...). c 5)."error_direction_direction.for": from the "test_allyear_direction" file, c the program generated a output file c "error_direction_direction" which c is used for the summary error in c each direction of years. c 6)."error_month_direction.for": from the "test_allyear_direction" file, c the program generated a output file c "error_month_direction" which is used c for the summary error in each month c of years. c---------------------------------------------------------------------------- c---------------------2.variable & i/o format-------------------------------- c for variable c count(17): counter for the appear times of 16 dir & calm c respectively c day, month, year: day, month and year c month0: month, used for a sign of month changing c dir: wind direction c pro(17): percent for the appear times of 16 dir & calm c respectively integer count(17), day, month, year, month0 real dir, pro(17) c for output header 100 format(' 16 dir + Calm: 0 45 90 135 +180 225 270 315 -1.0') 110 format(' 22.5 67.5 112.5 157.5 + 202.5 247.5 292.5 337.5') 120 format ('The amount & percent of 16 dir& calm in each month') 130 format ('--------------------------------------------------------- +---------------------------------------------') 140 format ('========================================================= +=============================================') c for output format 200 format (i2, 'days,', i2, ',', i4, 17(3x,i2)) 300 format (4x, 'percent ', 17(1x,f4.1)) c for input format 400 format(1x,i2,1x,i2,1x,i4,1x,f5.1) 500 format (1x) integer i c--------------------3. read and write file----------------------------- c write record to 'windgen_mid_direction' file open (8, file = 'windgen_mid_direction') write(8,120) write(8,130) write(8,100) write(8,110) write(8,140) c read record from 'windgen_output' file open(1,file='../bin/windgen_output', status='old') do 10 i=1, 74 read(1, 500) 10 continue c initialize value day = 1 month = 1 month0 = 1 year = 1900 do 20 i =1 ,17 count(i) = 0 20 continue c count the appear times of 16dir & calm respectively in each month 900 read(1, 400, end=999) day, month, year, dir if (month0 .eq. month) then if (dir .eq. 0.0) then count(1) = count(1) + 1 else if (dir .eq. 22.5) then count(2) = count(2) + 1 else if (dir .eq. 45.0) then count(3) = count(3) + 1 else if (dir .eq. 67.5) then count(4) = count(4) + 1 else if (dir .eq. 90.0) then count(5) = count(5) + 1 else if (dir .eq. 112.5) then count(6) = count(6) + 1 else if (dir .eq. 135.0) then count(7) = count(7) + 1 else if (dir .eq. 157.5) then count(8) = count(8) + 1 else if (dir .eq. 180.0) then count(9) = count(9) + 1 else if (dir .eq. 202.5) then count(10) = count(10) + 1 else if (dir .eq. 225.0) then count(11) = count(11) + 1 else if (dir .eq. 247.5) then count(12) = count(12) + 1 else if (dir .eq. 270.0) then count(13) = count(13) + 1 else if (dir .eq. 292.5) then count(14) = count(14) + 1 else if (dir .eq. 315.0) then count(15) = count(15) + 1 else if (dir .eq. 337.5) then count(16) = count(16) + 1 else if (dir .eq. -1.0) then count(17) = count(17) + 1 endif goto 900 c calculate the percent of the appear times of 16dir&calm c respectively in each month else month0 = month backspace (1) backspace (1) read(1, 400) day, month, year, dir write(8,200) day, month, year, (count(i), i=1,17) do 30 i= 1, 17 pro(i) = 100 * real(count(i))/real(day) 30 continue write(8,300) (pro(i), i=1,17) write(8,130) do 40 i =1, 17 count(i) = 0 40 continue goto 900 endif 999 write(8,200) day,month,year,(count(i), i=1,17) do 50 i= 1, 17 pro(i) = 100 * real(count(i))/real(day) 50 continue write(8,300) (pro(i), i=1,17) write(8,130) close(1) close(8) end