input conversion error --- SWAT模型
各位大侠:好!我在对SWAT水文模型进行了一个简单的修改。现在出现了一个问题和我自己的代码编写同时传上,请大家帮我看看看。感谢各位了
貌似只能上传一张图片,出现的问题如下:
forrt1: severe <64>:input conversion error, unit999, file G:\SWAT\CHCO2FAO\Scenarios\Default\TxtInout\co2measfile.txt
数据格式为:2004001370.0 ,前4位表示年,5-7位表示天数,最后5位表示二氧化碳数据
坐等大家的回复了,感谢群论坛
不知道我的描述清楚不清楚,忐忑 给全部代码,数据文件(不是截图) !! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! Intrinsic: Max, Min
!! SWAT: pmeas, tmeas, smeas, hmeas, wmeas
!! SWAT: pgen, tgen, weatgn, clgen, slrgen, rhgen, wndgen
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
integer :: k, inum3sprev, npcpbsb, ii, iyp, idap, ib
real :: tmxbsb, tmnbsb, rbsb, rhdbsb, rabsb, u10bsb, rmxbsb
real :: daylbsb, fradbsb(24), tdif, pdif, ratio
! real, dimension (:), allocatable :: rhrbsb, rstpbsb
! if (nstep > 0) then
! allocate (rstpbsb(nstep))
! allocate (rhrbsb(24))
! end if
!! Precipitation: Measured !!
if (pcpsim == 1) call pmeas
!! Temperature: Measured !!
if (tmpsim == 1) call tmeas
!! Solar Radiation: Measured !!
if (slrsim == 1) call smeas
!! Relative Humidity: Measured !!
if (rhsim == 1) call hmeas
!! Wind Speed: Measured !!
if (wndsim == 1 .and. ipet == 1) call wmeas
!! Potential ET: Read in data !!
if (ipet == 3) then
if (ifirstpet == 0) then
read (140,5100) petmeas
else
ifirstpet = 0
do
iyp = 0
idap = 0
read (140,5000) iyp, idap, petmeas
if (iyp == iyr .and. idap == id1) exit
end do
end if
end if
!! CO2:Read in data!!
open (199,file="co2measfile")
do
iyp = 0
idap = 0
read (199,5000) iyp, idap, co2meas
if (iyp == iyr .and. idap == id1) exit
end do
!! Generate Relative Humidity, Wind Speed, Radiation
!! Precipitation and Temperature if = 2
inum3sprev = 0
do k = 1, nhru
!! use same generated data for all HRUs in a subbasin
if (hru_sub(k) == inum3sprev .and. hru_sub(k) /= 0) then
if (tmpsim == 2) then
tmx(k) = tmxbsb
tmn(k) = tmnbsb
end if
if (pcpsim == 2) then
subp(k) = rbsb
if (ievent > 1) then
do l = 1, 24
hhsubp(k,l) = rhrbsb(l)
end do
do l = 1, nstep
rainsub(k,l) = rstpbsb(l)
end do
end if
end if
if (rhsim == 2) rhd(k) = rhdbsb
if (slrsim == 2) then
hru_ra(k) = rabsb
hru_rmx(k) = rmxbsb
dayl(k) = daylbsb
npcp(k) = npcpbsb
do ii = 1, 24
frad(k,ii) = fradbsb(ii)
end do
end if
if (wndsim == 2) u10(k) = u10bsb
else
if (pcpsim == 2) call pgen(k)
if (tmpsim == 2) then
call weatgn(k)
call tgen(k)
end if
if (slrsim == 2) then
call clgen(k)
call slrgen(k)
end if
if (rhsim == 2) call rhgen(k)
if (ipet == 1) then
if (wndsim == 2) call wndgen(k)
end if
!! set subbasin generated values
inum3sprev = 0
tmxbsb = 0.
tmnbsb = 0.
rbsb = 0.
rhdbsb = 0.
rabsb = 0.
rmxbsb = 0.
daylbsb = 0.
npcpbsb = 0
u10bsb = 0.
fradbsb = 0.
inum3sprev = hru_sub(k)
tmxbsb = tmx(k)
tmnbsb = tmn(k)
rbsb = subp(k)
if (ievent > 1) then
rhrbsb = 0.
rstpbsb = 0.
do l = 1, 24
rhrbsb(l) = hhsubp(k,l)
end do
do l = 1, nstep
rstpbsb(l) = rainsub(k,l)
end do
end if
rhdbsb = rhd(k)
rabsb = hru_ra(k)
rmxbsb = hru_rmx(k)
daylbsb = dayl(k)
npcpbsb = npcp(k)
u10bsb = u10(k)
do ii = 1, 24
fradbsb(ii) = frad(k,ii)
end do
end if
tmpav(k) = (tmx(k) + tmn(k)) / 2.
end do
!! Climate Change Adjustments !!
do k = 1, nhru
subp(k) = subp(k) * (1. + rfinc(hru_sub(k),i_mo) / 100.)
if (subp(k) < 0.) subp(k) = 0.
if (nstep > 0) then
do ii = 1, nstep
rainsub(k,ii) = rainsub(k,ii) * &
& (1. + rfinc(hru_sub(k),i_mo) / 100.)
if (rainsub(k,ii) < 0.) rainsub(k,ii) = 0.
end do
do ii = 1, 24
hhsubp(k,ii) = hhsubp(k,ii) * &
& (1. + rfinc(hru_sub(k),i_mo) / 100.)
if (hhsubp(k,ii) < 0.) hhsubp(k,ii) = 0.
end do
end if
tmx(k) = tmx(k) + tmpinc(hru_sub(k),i_mo)
tmn(k) = tmn(k) + tmpinc(hru_sub(k),i_mo)
tmpav(k) = tmpav(k) + tmpinc(hru_sub(k),i_mo)
hru_ra(k) = hru_ra(k) + radinc(hru_sub(k),i_mo)
hru_ra(k) = Max(0.,hru_ra(k))
rhd(k) = rhd(k) + huminc(hru_sub(k),i_mo)
rhd(k) = Max(0.01,rhd(k))
rhd(k) = Min(0.99,rhd(k))
end do
!! Elevation Adjustments !!
do k = 1, nhru
if (elevb(1,hru_sub(k)) > 0. .and. &
& elevb_fr(1,hru_sub(k)) > 0.) then
!! determine temperature and precipitation for individual bands
ratio = 0.
do ib = 1, 10
if (elevb_fr(ib,hru_sub(k)) < 0.) exit
tdif = 0.
pdif = 0.
if (tmpsim == 1) then
tdif = (elevb(ib,hru_sub(k)) - &
& Real(elevt(itgage(hru_sub(k))))) * tlaps(hru_sub(k)) / 1000.
else
tdif = (elevb(ib,hru_sub(k)) - welev(hru_sub(k))) &
& * tlaps(hru_sub(k)) / 1000.
end if
if (pcpsim == 1) then
pdif = (elevb(ib,hru_sub(k)) - &
& Real(elevp(irgage(hru_sub(k))))) * plaps(hru_sub(k)) / 1000.
else
pdif = (elevb(ib,hru_sub(k)) - welev(hru_sub(k))) &
& * plaps(hru_sub(k)) / 1000.
end if
tavband(ib,k) = tmpav(k) + tdif
tmxband(ib,k) = tmx(k) + tdif
tmnband(ib,k) = tmn(k) + tdif
if (subp(k) > 0.01) then
pcpband(ib,k) = subp(k) + pdif
if (pcpband(ib,k) < 0.) pcpband(ib,k) = 0.
end if
ratio = ratio + pdif * elevb_fr(ib,hru_sub(k))
end do
!! determine fraction change in precipitation for HRU
if (subp(k) >= 0.01) then
ratio = ratio / subp(k)
else
ratio = 0.
end if
!! determine new overall temperature and precipitation values
!! for HRU
tmpav(k) = 0.
tmx(k) = 0.
tmn(k) = 0.
subp(k) = 0.
do ib = 1, 10
if (elevb_fr(ib,hru_sub(k)) < 0.) exit
tmpav(k) = tmpav(k) + tavband(ib,k) * elevb_fr(ib,hru_sub(k))
tmx(k) = tmx(k) + tmxband(ib,k) * elevb_fr(ib,hru_sub(k))
tmn(k) = tmn(k) + tmnband(ib,k) * elevb_fr(ib,hru_sub(k))
subp(k) = subp(k) + pcpband(ib,k) * elevb_fr(ib,hru_sub(k))
end do
if (nstep > 0) then
do ii = 1, nstep
if (rainsub(k,ii) > 0.01) then
rainsub(k,ii) = rainsub(k,ii) + ratio * rainsub(k,ii)
if (rainsub(k,ii) < 0.) rainsub(k,ii) = 0.
end if
end do
do ii = 1, 24
if (hhsubp(k,ii) > 0.01) then
hhsubp(k,ii) = hhsubp(k,ii) + ratio * hhsubp(k,ii)
if (hhsubp(k,ii) < 0.) hhsubp(k,ii) = 0.
end if
end do
end if
end if
end do
! if (nstep > 0) then
! deallocate (rhrbsb)
! deallocate (rstpbsb)
! end if
return
5000 format (i4,i3,f5.1)
5100 format (7x,f5.1)
end
由于这个子程序不能一下全部粘贴上去,所以我只要分开附上:
subroutine clicon
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine controls weather inputs to SWAT. Precipitation and
!! temperature data is read in and the weather generator is called to
!! fill in radiation, wind speed and relative humidity as well as
!! missing precipitation and temperatures. Adjustments for climate
!! changes studies are also made in this subroutine.
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! elevb(:,:)|m |elevation at center of band
!! elevb_fr(:,:)|none |fraction of subbasin area within elevation
!! |band
!! elevp(:) |m |elevation of precipitation gage station
!! elevt(:) |m |elevation of temperature gage station
!! hru_sub(:)|none |subbasin in which HRU is located
!! huminc(:,:) |none |monthly humidity adjustment. Daily values
!! |for relative humidity within the month are
!! |raised or lowered by the specified amount.
!! |(used in climate change studies)
!! id1 |julian date |first day of simulation in year
!! ifirstpet |none |potential ET data search code
!! |0 first day of potential ET data located in
!! |file
!! |1 first day of potential ET data not located
!! |in file
!! ipet |none |code for potential ET method
!! |0 Priestley-Taylor method
!! |1 Penman/Monteith method
!! |2 Hargreaves method
!! |3 read in daily potential ET values
!! irgage(:) |none |HRU rain gage data code (gage # for rainfall
!! |data used in HRU)
!! itgage(:) |none |HRU temperature gage data code (gage # for
!! |temperature data used in HRU)
!! iyr |year |year currently being simulated (eg 1980)
!! i_mo |none |current month of simulation
!! nhru |none |number of HRUs in watershed
!! nstep |none |number of lines of rainfall data for each
!! |day
!! pcpsim |none |rainfall input code
!! |1 gage read for each subbasin
!! |2 gage simulated for each subbasin
!! plaps(:) |mm H2O/km |precipitation lapse rate: precipitation
!! |increase due to increase in elevation
!! radinc(:,:) |MJ/m^2 |monthly solar radiation adjustment. Daily
!! |radiation within the month is raised or
!! |lowered by the specified amount. (used in
!! |climate change studies)
!! rfinc(:,:)|% |monthly rainfall adjustment. Daily rainfall
!! |within the month is adjusted to the specified
!! |percentage of the original value (used in
!! |climate change studies)
!! rhsim |none |relative humidity input code
!! |1 measured data read for each subbasin
!! |2 data simulated for each subbasin
!! slrsim |none |solar radiation input code
!! |1 measured data read for each subbasin
!! |2 data simulated for each subbasin
!! tlaps(:) |deg C/km |temperature lapse rate: temperature increase
!! |due to increase in elevation
!! tmpinc(:,:) |deg C |monthly temperature adjustment. Daily maximum
!! |and minimum temperatures within the month are
!! |raised or lowered by the specified amount
!! |(used in climate change studies)
!! tmpsim |none |temperature input code
!! |1 daily max/min read for each subbasin
!! |2 daily max/min simulated for each subbasin
!! welev(:) |m |elevation of weather station used to compile
!! |weather generator data
!! wndsim |none |wind speed input code
!! |1 measured data read for each subbasin
!! |2 data simulated for each subbasin
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! frad(:,:) |none |fraction of solar radiation occuring during
!! |hour in day in HRU
!! hhsubp(:,:) |mm H2O |precipitation falling during hour in day in
!! |HRU
!! hru_ra(:) |MJ/m^2 |solar radiation for the day in HRU
!! hru_rmx(:)|MJ/m^2 |maximum solar radiation for the day in HRU
!! ifirstpet |none |potential ET data search code
!! |0 first day of potential ET data located in
!! |file
!! |1 first day of potential ET data not located
!! |in file
!! pcpband(:,:)|mm H2O |precipitation for the day in band in HRU
!! petmeas |mm H2O |potential ET value read in for day
!! rainsub(:,:)|mm H2O |precipitation for the time step during the
!! |day in HRU
!! rhd(:) |none |relative humidity for the day in HRU
!! subp(:) |mm H2O |precipitation for the day in HRU
!! tavband(:,:)|deg C |average temperature for the day in band in HRU
!! tmn(:) |deg C |minimum temperature for the day in HRU
!! tmnband(:,:)|deg C |minimum temperature for the day in band in HRU
!! tmpav(:) |deg C |average temperature for the day in HRU
!! tmx(:) |deg C |maximum temperature for the day in HRU
!! tmxband(:,:)|deg C |maximum temperature for the day in band in HRU
!! u10(:) |m/s |wind speed for the day in HRU
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! fradbsb(:)|none |hourly solar radiation fractions for subbasin
!! ib |none |counter
!! idap |julain date |day currently being simulated
!! ii |none |counter
!! inum3sprev|none |subbasin number of previous HRU
!! iyp |none |year currently being simulated
!! k |none |counter
!! pdif |mm H2O |difference in precipitation for station and
!! |precipitation for elevation band
!! rabsb |MJ/m^2 |generated solar radiation for subbasin
!! ratio |none |fraction change in precipitation due to
!! |elevation changes
!! rbsb |mm H2O |generated precipitation for subbasin
!! rhdbsb |none |generated relative humidity for subbasin
!! rmxbsb |MJ/m^2 |generated maximum solar radiation for subbasin
!! tdif |deg C |difference in temperature for station and
!! |temperature for elevation band
!! tmnbsb |deg C |generated minimum temperature for subbasin
!! tmxbsb |deg C |generated maximum temperature for subbasin
!! u10bsb |m/s |generated wind speed for subbasin 数据为:
2004001370.0
2004002370.0
2004003370.0
2004004370.0
2004005370.0
2004006370.0
2004007370.0
2004008370.0
2004009370.0
2004010370.0
2004011370.0
2004012370.0
2004013370.0
2004014370.0
2004015370.0
2004016370.0
2004017370.0
2004018370.0
2004019370.0
2004020370.0
2004021370.0
2004022370.0
2004023370.0
2004024370.0
2004025370.0
2004026370.0
2004027370.0
2004028370.0
2004029370.0
2004030370.0
2004031370.0
2004032375.0
2004033375.0
2004034375.0
2004035375.0
2004036375.0
2004037375.0
2004038375.0
2004039375.0
2004040375.0
2004041375.0
2004042375.0
2004043375.0
2004044375.0
2004045375.0
2004046375.0
2004047375.0
2004048375.0
2004049375.0
2004050375.0
2004051375.0
2004052375.0
2004053375.0
2004054375.0
2004055375.0
2004056375.0
2004057375.0
2004058375.0
2004059375.0
2004060375.0
2004061375.0
2004062375.0
2004063375.0
2004064375.0
2004065375.0
2004066375.0
2004067375.0
2004068375.0
2004069375.0
2004070375.0
2004071375.0
2004072375.0
2004073375.0
2004074375.0
2004075375.0
2004076375.0
2004077375.0
2004078375.0
2004079375.0
2004080375.0
2004081375.0
2004082375.0
2004083375.0
2004084375.0
2004085375.0
2004086375.0
2004087375.0
2004088375.0
2004089375.0
2004090375.0
2004091375.0
2004092375.0
2004093375.0
2004094375.0
2004095375.0
2004096375.0
2004097375.0
2004098375.0
2004099375.0
2004100375.0
2004101375.0
2004102375.0
2004103375.0
2004104375.0
2004105375.0
2004106375.0
2004107375.0
2004108375.0
2004109375.0
2004110375.0
2004111375.0
2004112375.0
2004113375.0
2004114375.0
2004115375.0
2004116375.0
2004117375.0
2004118375.0
2004119375.0
2004120375.0
2004121375.0
2004122375.0
2004123375.0
2004124375.0
2004125375.0
2004126375.0
2004127375.0
2004128375.0
2004129375.0
2004130375.0
2004131375.0
2004132375.0
2004133375.0
2004134375.0
2004135375.0
2004136375.0
2004137375.0
2004138375.0
2004139375.0
2004140375.0
2004141375.0
2004142375.0
2004143375.0
2004144375.0
2004145375.0
2004146375.0
2004147375.0
2004148375.0
2004149375.0
2004150375.0
2004151375.0
2004152375.0
2004153375.0
2004154375.0
2004155375.0
2004156375.0
2004157375.0
2004158375.0
2004159375.0
2004160375.0
2004161375.0
2004162375.0
2004163375.0
2004164375.0
2004165375.0
2004166375.0
2004167375.0
2004168375.0
2004169375.0
2004170375.0
2004171375.0
2004172375.0
2004173375.0
2004174375.0
2004175375.0
2004176375.0
2004177375.0
2004178375.0
2004179375.0
2004180375.0
2004181375.0
2004182375.0
2004183375.0
2004184375.0
2004185375.0
2004186375.0
2004187375.0
2004188375.0
2004189375.0
2004190375.0
2004191375.0
2004192375.0
2004193375.0
2004194375.0
2004195375.0
2004196375.0
2004197375.0
2004198375.0
2004199375.0
2004200375.0
2004201375.0
2004202375.0
2004203375.0
2004204375.0
2004205375.0
2004206375.0
2004207375.0
2004208375.0
2004209375.0
2004210375.0
2004211375.0
2004212375.0
2004213375.0
2004214375.0
2004215375.0
2004216375.0
2004217375.0
2004218375.0
2004219375.0
2004220375.0
2004221375.0
2004222375.0
2004223375.0
2004224375.0
2004225375.0
2004226375.0
2004227375.0
2004228375.0
2004229375.0
2004230375.0
2004231375.0
2004232375.0
2004233375.0
2004234375.0
2004235375.0
2004236375.0
2004237375.0
2004238375.0
2004239375.0
2004240375.0
2004241375.0
2004242375.0
2004243375.0
2004244383.7
2004245383.7
2004246383.7
2004247383.7
2004248383.7
2004249383.7
2004250383.7
2004251383.7
2004252383.7
2004253383.7
2004254383.7
2004255383.7
2004256383.7
2004257383.7
2004258383.7
2004259383.7
2004260383.7
2004261383.7
2004262383.7
2004263383.7
2004264383.7
2004265383.7
2004266383.7
2004267383.7
2004268383.7
2004269383.7
2004270383.7
2004271383.7
2004272383.7
2004273383.7
2004274383.7
2004275383.7
2004276383.7
2004277383.7
2004278383.7
2004279383.7
2004280383.7
2004281383.7
2004282383.7
2004283383.7
2004284383.7
2004285383.7
2004286383.7
2004287383.7
2004288383.7
2004289383.7
2004290383.7
2004291383.7
2004292383.7
2004293383.7
2004294383.7
2004295383.7
2004296383.7
2004297383.7
2004298383.7
2004299383.7
2004300383.7
2004301383.7
2004302383.7
2004303383.7
2004304383.7
2004305383.7
2004306383.7
2004307383.7
2004308383.7
2004309383.7
2004310383.7
2004311383.7
2004312383.7
2004313383.7
2004314383.7
2004315383.7
2004316383.7
2004317383.7
2004318383.7
2004319383.7
2004320383.7
2004321383.7
2004322383.7
2004323383.7
2004324383.7
2004325383.7
2004326383.7
2004327383.7
2004328383.7
2004329383.7
2004330383.7
2004331383.7
2004332383.7
2004333383.7
2004334383.7
2004335390.3
2004336390.3
2004337390.3
2004338390.3
2004339390.3
2004340390.3
2004341390.3
2004342390.3
2004343390.3
2004344390.3
2004345390.3
2004346390.3
2004347390.3
2004348390.3
2004349390.3
2004350390.3
2004351390.3
2004352390.3
2004353390.3
2004354390.3
2004355390.3
2004356390.3
2004357390.3
2004358390.3
2004359390.3
2004360390.3
2004361390.3
2004362390.3
2004363390.3
2004364390.3
2004365390.3
2004366390.3
2005001390.3
2005002390.3
2005003390.3
2005004390.3
2005005390.3
2005006390.3
2005007390.3
2005008390.3
2005009390.3
2005010390.3
2005011390.3
2005012390.3
2005013390.3
2005014390.3
2005015390.3
2005016390.3
2005017390.3
2005018390.3
2005019390.3
2005020390.3
2005021390.3
2005022390.3
2005023390.3
2005024390.3
2005025390.3
2005026390.3
2005027390.3
2005028390.3
2005029390.3
2005030390.3
2005031390.3
2005032390.3
2005033390.3
2005034390.3
2005035390.3
2005036390.3
2005037390.3
2005038390.3
2005039390.3
2005040390.3
2005041390.3
2005042390.3
2005043390.3
2005044390.3
2005045390.3
2005046390.3
2005047390.3
2005048390.3
2005049390.3
2005050390.3
2005051390.3
2005052390.3
2005053390.3
2005054390.3
2005055390.3
2005056390.3
2005057390.3
2005058390.3
2005059391.7
2005060391.7
2005061391.7
2005062391.7
2005063391.7
2005064391.7
2005065391.7
2005066391.7
2005067391.7
2005068391.7
2005069391.7
2005070391.7
2005071391.7
2005072391.7
2005073391.7
2005074391.7
2005075391.7
2005076391.7
2005077391.7
2005078391.7
2005079391.7
2005080391.7
2005081391.7
2005082391.7
2005083391.7
2005084391.7
2005085391.7
2005086391.7
2005087391.7
2005088391.7
2005089391.7
前4为是年,中间三位是天数,后面五位是数据 代码没拷贝全。
天哪,你就不会上传附件吗?打个包,直接上传 zip 或 rar 压缩包。
页:
[1]