2)他们可以以ascii的格式保存,也可以以2进制保存。 对于ascii格式: a) 必须有6行头文件(他们是什么不重要,什么都不是;因为这些值来自于snowmdodel.par 模型设置文件中) b) 这些行必须从西北角开始从左到右写。然后一行一行写下去。 d) 下面是Fortran写的例子: open (23,file='topo.dat') write (23,*) 'ncols 101' write (23,*) 'nrows 101' write (23,*) 'xllcorner 0' write (23,*) 'yllcorner 0' write (23,*) 'cellsize 30' write (23,*) 'NODATA_value -9999.0' do j=ny,1,-1 write (23,90) (topo(i,j),i=1,nx) enddo 90 format (101f12.4) 3)模型矩阵空间(从左到右,从下到上写)和GIS数据格式的y轴是相反,但是我为了将输出改写成GIS格式,因此我在输出的时候: do j=ny,1,-1 write (23,form) (swe_depth(i,j),i=1,nx) enddo 所有是这样结果:在模型中,任何二进制的输入和输出都是按照大气模型的约定,也就是从左到右,从下到上写; 任何ascii格式的输入和输出都是按照GIS的约定。
模型空间: 1 2 3 4 5 6 7 8 9
gis 空间 7 8 9 4 5 6 1 2 3 存储时 第1列 第2列 。。。 第j列 。。。 第88 列 第1行 name [0][0] , name [0][1] name [0][2]。。。, name [0][j-1] 。。。 ,name [0][87] 第2行 name [0][0] , name [0][1] name [0][2]。。。,name [0][j-1] 。。。 ,name [0][87] 。。。 第i行 name [i-1][0] , name [i-1][1], name [i-1][2]。。。,name [i-1][j-1] 。。。,name [i-1][87] 。。。 第12行 name [11][0] , name [0][1], name [0][2] 。。。, name [11][j-1]。。。, name [11][87] 无论Fortran还是C,C++的,二维数组前面一个是行,后面一个是列。
! Number of x and y cells in the computational grid. !Ling Zhang: nx 为列数,ny为行数 nx = 50 ny = 35
! deltax = grid increment in x direction. Meters. ! deltay = grid increment in y direction. Meters. !Ling Zhang: 格网大小 deltax = 5000.0 deltay = 5000.0
! Location (like UTM, in meters) value of lower-left grid point. ! xmn = value of x coordinate in center of lower left grid cell. ! Meters. ! ymn = value of y coordinate in center of lower left grid cell. ! Meters. xmn = -571811.53424883 ymn = 4043727.467686
! Model time step, dt. Should be the same increment as in the input ! data file. In seconds. !Ling Zhang: 时间步长 ! One day. dt = 86400.0 ! Six hours. ! dt = 21600.0 ! Three hours. ! dt = 10800.0 ! One hour. ! dt = 3600.0
! Start year of input data file. Four digit year. Integer. !Ling Zhang: 开始时间 iyear_init = 1989
! Start month of input data file. One or two digit month. Integer. imonth_init = 1
! Start day of input data file. One or two digit day. Integer. iday_init = 1
! Start hour of input data file. Local time, like in solar time. ! Decimal hour. Each day the clock runs from 0.00 through 23.99. ! Real. xhour_init = 12.0
! Number of model iterations defines how many times to process. !Ling Zhang: 时间总长度,本例为总共的天数 ! max_iter = 7656 max_iter = 7670 ! Define the meteorologial input file name. Note that this input ! file has very specific input format requirements (see the ! MicroMet preprocessor). The required met variables are: ! Tair (deg C or K), rh (%), wind speed (m/s), wind direction ! (0-360 True N), and precipitation (mm/time_step). ! met_input_fname = met/SnowModel_test_met.dat met_input_fname = met/ghq_met.dat
! The number used as an undefined value for both inputs and outputs. undef = -9999.0
! Define whether the topography and vegetation input files will ! be ARC/INFO ascii text (grid) files, or a GrADS binary file ! (ascii = 1.0, GrADS = 0.0). ascii_topoveg = 1.0
! Define the GrADS topography and vegetation input file name ! (record 1 = topo, record 2 = veg). Note that if you are using ! ascii files, you still cannot comment this line out (it is okay ! for it to point to something that doesn't exist) or you will ! an error message. topoveg_fname = xxxxxx
! For the case of using ascii text topography and vegetation files, ! provide the file names. Note that if you are using a grads ! file, you still cannot comment these two lines out (it is okay ! for it to point to something that doesn't exist) or you will ! an error message. ! topo_ascii_fname = xxxxxx ! veg_ascii_fname = xxxxxx topo_ascii_fname = topo_veg/hhup_dem.asc veg_ascii_fname = topo_veg/fake_veg.asc ********************************************************************** 对DEM进行重采样,为5Km 裁剪得到一个50×30的矩阵 **********************************************************************
! Define which fields you want to process/distribute. 1 = do it, ! 0 = don't do it. As an example, if you are running SnowTran-3D ! with no melting, you don't need solar radiation. !Ling Zhang 定义插值的变量 i_tair_flag = 0 i_rh_flag = 0 i_wind_flag = 0 i_solar_flag = 0 i_longwave_flag = 0 i_prec_flag = 1
! Define whether the precipitation adjustment factor, with units of ! km^-1 (kind of a precipitation lapse rate, used to adjust the ! precipitation for locations above and below the precipitation ! observing station(s)), is to use the default monthly lapse ! rates (= 0) or user supplied monthly lapse rates (= 1). To use ! user supplied lapse rates, you have to edit the user lapse rate ! data array in micromet_code.f (subroutine get_lapse_rates). iprecip_lapse_rate_user_flag = 1
!Ling Zhang 修改代码:1481行 ******************************************************************* c If you want to use the 'user' array, put your monthly values in c here and set iprecip_lapse_rate_user_flag = 1 in the .par file. data precip_lapse_rate_user /0.1296,0.2108,0.109,0.1657,0.2384, & 0.2641,0.272,0.2859,0.2364,0.2056, & 0.0419,0.225/ ********************************************************************
! The code is set up to write out an individual data file for each ! sub-model. Define whether you want the data written out ! (print_micromet = 1.0, else 0.0), and the name of that output ! file. print_micromet = 1.0 micromet_output_fname = outputs/output1989-2009.gdat