1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
int main(){
string line;
ifstream file ("./file_list.txt");
int count=0;
char * file_ptr;
char file_name[46];
enum variable{LATITUDE=0,LONGITUDE=1,RAIN=2,WIND=3,TEMP=4,RH=5};
FireWeatherWRF latitude, longitude,rain_temp,rain,wind,temp,rh;
if (file.is_open()){
while (!file.eof()){
getline (file,line);
for (int i=0;i<46;i++){file_name[i]=line[i];}
file_ptr=file_name;
if (count==0){
latitude.read_WRF(file_ptr,LATITUDE);
longitude.read_WRF(file_ptr,LONGITUDE);
rain.read_WRF(file_ptr,RAIN);
wind.read_WRF(file_ptr,WIND);
temp.read_WRF(file_ptr,TEMP);
rh.read_WRF(file_ptr,RH);
count++;
}
else{
rain_temp.read_WRF(file_ptr,RAIN);
cout<<rain_temp.data[0][0]<<endl;
for (int lat=0;lat<SN;lat++){
for (int lon=0;lon<WE;lon++){
rain.data[lat][lon]=rain.data[lat][lon]+rain_temp.data[lat][lon];
}
}
if (count==24){count=0;}
else {count++;}
}
}
cout<<"cum rain: "<<rain.data[0][0]<<endl;
file.close();
}
return 0;
}
|