||
Update 2016/11/30
今天我又重新写了subdaily to monthly的程序,现在放在这里一并和大家分享。
截个图:
DHSVM模型流域出口的河川径流的格式(3小时为例):
现在要将Subdaily的streamflow转化为daily,我写了一个C的程序来实现,先贴结果.
源代码如下:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MaxLine 1024
int main(int argc, char *argv[])
{
FILE *InputFid, *OutputFid;
int TempStrComp, CountForDay;
long offset;
char strline01[MaxLine];
char StartLine[MaxLine];
double TempDischarge, ReadDischarge, MeanDailyDischarge;
char StrDate01[11],TempStrDate[11];
const char *input_name = "Streamflow.Only";
const char *Output_name = "Streamflow_daily.Only";
char *TempStrDischarge;
if ((InputFid=fopen(input_name,"r"))==NULL){
printf("Open %s Failed", input_name);
return;
}
if ((OutputFid=fopen(Output_name,"w+"))==NULL){
printf("Open %s Failed", Output_name);
return;
}
/* Write header, DATE OUTLET */
fgets(strline01,MaxLine,InputFid);
fprintf(OutputFid,"%s %sn", "DATE", "Discharge(m^3/timestep)");
/* Provide StartLine */
fgets(strline01,MaxLine,InputFid);
strncpy(TempStrDate, strline01, 10);
TempStrDate[10]='