! A fortran95 program for G95
! By WQY
program main
implicit none
integer::i,m
! real::lon
character(len=4)::LO,CL,SILO,CLLO,SACL,SICL,SALO,LOSA,SA
character(len=4) , allocatable :: type_soil(:)
character(len=9) , allocatable :: site(:)
real , allocatable :: lat(:),lon(:),SBDM(:),SLOC(:),SLCL(:),SLHW(:)
m=46086 !//m 此时的含义为,有多少个数据(而不是有多少行)
allocate(site(m),lat(m),lon(m),type_soil(m),SBDM(m),SLOC(m),SLCL(m),SLHW(m))
open(8, File='D:/DNDC/soil.txt')
do i=1,m
read(8,"(a9,2x,f5.2,2x,f6.2,2x,a4,2x,f5.3,2x,f4.2,2x,f4.1,2x,f3.1)")&
&site(i),lat(i),lon(i),type_soil(i),SBDM(i),SLOC(i),SLCL(i),SLHW(i)
! write(*,*)type_soil(i)
! Open (11, File='D:/DNDC/filename.dat')
! do
!╤ах║нд╪ЧцШ
! read(11,*) filename
! if(i/=0) exit
open(7,File='D:/DNDC/double_rice/'//site(i)//'.dnd')
! if (filename==site(i))then
write(7,'(a)')'DNDC_Input_Parameters'
write(7,'(a)')'----------------------------------------'
write(7,'(a)')'Site_infomation'
write(7,'(t1,a,a9)')
write(7,'(t1,a,a6)')'__Site_name CN',site(i)(4:9)
write(7,'(a)')'__Simulated_years 10'
write(7,'(t1,a,f7.4)')'__Latitude ',lat(i)
write(7,'(a)')'__Daily_record 0'
write(7,'(a)')'__Unit_system 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'----------------------------------------'
write(7,'(a)')'Climate_data'
write(7,'(a)')
write(7,'(a)')'__Climate_data_type 1'
write(7,'(a)')'__N_in_rainfall 0.0000'
write(7,'(a)')'__Air_NH3_concentration 0.0600'
write(7,'(a)')'__Air_CO2_concentration 350.0000'
write(7,'(a)')'__Climate_files 10'
write(7,'(a,a6)')'1 F:\weather-DNDC\1961\CN',site(i)(4:9)
write(7,'(a,a6)')'2 F:\weather-DNDC\1962\CN',site(i)(4:9)
write(7,'(a,a6)')'3 F:\weather-DNDC\1963\CN',site(i)(4:9)
write(7,'(a,a6)')'4 F:\weather-DNDC\1964\CN',site(i)(4:9)
write(7,'(a,a6)')'5 F:\weather-DNDC\1965\CN',site(i)(4:9)
write(7,'(a,a6)')'6 F:\weather-DNDC\1966\CN',site(i)(4:9)
write(7,'(a,a6)')'7 F:\weather-DNDC\1967\CN',site(i)(4:9)
write(7,'(a,a6)')'8 F:\weather-DNDC\1968\CN',site(i)(4:9)
write(7,'(a,a6)')'9 F:\weather-DNDC\1969\CN',site(i)(4:9)
write(7,'(a,a6)')'10 F:\weather-DNDC\1970\CN',site(i)(4:9)
write(7,'(a)')'__Climate_file_mode 0'
write(7,'(a)')'__CO2_increase_rate 0.0000'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'__None 0'
write(7,'(a)')'----------------------------------------'
write(7,'(a)')'Soil_data'
write(7,'(a)')
write(7,'(a)')'__Land_use_ID 2'
! print*,type_soil(i)
if(type_soil(i)==LO)THEN
print*,type_soil(i)
write(7,'(a)')'__Soil_texture_ID 5'
elseif (type_soil(i)==CL)THEN
write(7,'(a)')'__Soil_texture_ID 11'
elseif (type_soil(i)==SILO)THEN
write(7,'(a)')'__Soil_texture_ID 4'
elseif (type_soil(i)==CLLO)THEN
write(7,'(a)')'__Soil_texture_ID 8'
elseif (type_soil(i)==SACL)THEN
write(7,'(a)')'__Soil_texture_ID 6'
elseif (type_soil(i)==SICL)THEN
write(7,'(a)')'__Soil_texture_ID 7'
elseif (type_soil(i)==SALO)THEN
write(7,'(a)')'__Soil_texture_ID 3'
elseif (type_soil(i)==LOSA)THEN
write(7,'(a)')'__Soil_texture_ID 2'
elseif (type_soil(i)==SA)THEN
write(7,'(a)')'__Soil_texture_ID 1'
else
write(7,'(a)')'__Soil_texture_ID 6'
END IF
! end if
close(7)
print*,site(i),' is end'
! end do
end do
deallocate(site,lat,lon,type_soil,SBDM,SLOC,SLCL,SLHW)
end program main
TIM截图20180201015201.png (20.48 KB, 下载次数: 266)
Jackdaw 发表于 2018-2-1 10:36
一、LO,CL,SILO,CLLO,SACL,SICL,SALO,LOSA,SA 这些变量都没有初始化啊
二、type_soil读文件第四列,要4个字 ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |