Skip to content

Commit

Permalink
improved the weather station csv pathing for CLI point initialization…
Browse files Browse the repository at this point in the history
… runs
  • Loading branch information
tfinney9 committed Aug 2, 2018
1 parent 07b2a06 commit 0a20c90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Recent_Station_File_List,
WXSTATIONS-2018-06-25-1237-missoula_valley/KMSO-2018-06-25_1237-0.csv
WXSTATIONS-2018-06-25-1237-missoula_valley/TS934-2018-06-25_1237-1.csv
WXSTATIONS-2018-06-25-1237-missoula_valley/PNTM8-2018-06-25_1237-2.csv
WXSTATIONS-2018-06-25-1237-missoula_valley/TR266-2018-06-25_1237-3.csv
KMSO-2018-06-25_1237-0.csv
TS934-2018-06-25_1237-1.csv
PNTM8-2018-06-25_1237-2.csv
TR266-2018-06-25_1237-3.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Station_File_List,
WXSTATIONS-MDT-2018-06-20-2128-2018-06-21-2128-missoula_valley/KMSO-MDT-2018-06-20_2128-2018-06-21_2128-0.csv
WXSTATIONS-MDT-2018-06-20-2128-2018-06-21-2128-missoula_valley/TS934-MDT-2018-06-20_2128-2018-06-21_2128-1.csv
WXSTATIONS-MDT-2018-06-20-2128-2018-06-21-2128-missoula_valley/PNTM8-MDT-2018-06-20_2128-2018-06-21_2128-2.csv
WXSTATIONS-MDT-2018-06-20-2128-2018-06-21-2128-missoula_valley/TR266-MDT-2018-06-20_2128-2018-06-21_2128-3.csv
KMSO-MDT-2018-06-20_2128-2018-06-21_2128-0.csv
TS934-MDT-2018-06-20_2128-2018-06-21_2128-1.csv
PNTM8-MDT-2018-06-20_2128-2018-06-21_2128-2.csv
TR266-MDT-2018-06-20_2128-2018-06-21_2128-3.csv
11 changes: 4 additions & 7 deletions src/ninja/pointInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,13 @@ vector<string> pointInitialization::openCSVList(string csvPath)
{
vector<string> csvList;
FILE *wxStationList = VSIFOpen( csvPath.c_str(), "r" ); //If we detect that this is a pointer csv
std::string wxStationDir = std::string(CPLGetPath(csvPath.c_str()));
while(1){ //Open it up and check it
const char* f = CPLReadLine(wxStationList);
if (f == NULL) //Means its not what we want
break;
if(strstr(f,".csv")){ //It is what we want
csvList.push_back(f);
csvList.push_back(wxStationDir+"/"+f);
}
}
VSIFClose(wxStationList);
Expand Down Expand Up @@ -2893,13 +2894,8 @@ void pointInitialization::writeStationLocationFile(string stationPath, std::stri
std::string baseName(CPLGetBasename(demFile.c_str()));
pathName = CPLGetPath(demFile.c_str());
rootFile = CPLFormFilename(pathName.c_str(), baseName.c_str(), NULL);
// cout<<baseName<<endl;
// cout<<baseName<<endl;
// cout<<rootFile<<endl;

cName=stationPath+baseName+ "_" + "stations_" + statLen.str() + ".csv";
// cout<<cName<<endl;
// exit(1);
ofstream outFile;
outFile.open(cName.c_str());
if(current_data==true)
Expand All @@ -2912,7 +2908,8 @@ void pointInitialization::writeStationLocationFile(string stationPath, std::stri
}
// outFile<<"Station_File_List,"<<endl;
for(int i=0;i<stationFiles.size();i++){
outFile<<stationFiles[i]<<endl;
// outFile<<stationFiles[i]<<endl;
outFile<<CPLGetFilename(stationFiles[i].c_str())<<endl;
}
}
/**
Expand Down

0 comments on commit 0a20c90

Please sign in to comment.