WSL/SLF GitLab Repository

Commit ab8d99cf authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Fixed the documentation as well as some warnings in the ARPSIO plugin

parent 7c5257dd
......@@ -52,7 +52,8 @@ class StationData {
/**
* @brief A constructor that takes three to six arguments
* @param _position Position of the station
* @param name_in Name of the station (default "")
* @param _id Station's id (short identification)
* @param _name Full name of the station (default "")
*/
StationData(const Coords& _position, const std::string& _id="", const std::string& _name="");
......@@ -64,7 +65,8 @@ class StationData {
/**
* @brief General setter function, requires three to six arguments
* @param _position Position of the station
* @param name_in Name of the station (default "")
* @param _id Station's id (short identification)
* @param _name Name of the station (default "")
*/
void setStationData(const Coords& _position, const std::string& _id="", const std::string& _name="");
......
......@@ -513,7 +513,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ./src ./src/plugins
INPUT = ./meteoio ./meteoio/plugins
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
......@@ -112,8 +112,12 @@ void ARPSIO::read3DGrid(Grid3DObject& grid_out, const std::string& /*_name*/)
for (unsigned int iy = 0; iy < dimy; iy++) {
for (unsigned int iz = 0; iz < dimz; iz++) {
double tmp;
fscanf(fin," %16lf%*[\n]",&tmp);
grid_out.grid3D(ix,iy,iz) = tmp;
if(fscanf(fin," %16lf%*[\n]",&tmp)==1) {
grid_out.grid3D(ix,iy,iz) = tmp;
} else {
cleanup();
throw InvalidFormatException("Failure in reading 3D grid in file "+_filename, AT);
}
}
}
}
......@@ -187,7 +191,11 @@ void ARPSIO::initializeGRIDARPS()
//go to read the sizes
moveToMarker("nnx");
fscanf(fin,"%*[^\n]"); //finish reading the line and move to the next one
//finish reading the line and move to the next one
if(fscanf(fin,"%*[^\n]")!=0) {
cleanup();
throw InvalidFormatException("Error in file format of file "+filename, AT);
}
if (fscanf(fin," %u %u %u \n",&dimx,&dimy,&dimz)!=3) {
cleanup();
throw InvalidFormatException("Can not read dimx, dimy, dimz from file "+filename, AT);
......@@ -265,7 +273,10 @@ void ARPSIO::openGridFile(const std::string& _filename)
char dummy[ARPS_MAX_LINE_LENGTH];
for (int j=0; j<5; j++) {
//the first easy difference in the structure happens at line 5
fgets(dummy,ARPS_MAX_STRING_LENGTH,fin);
if(fgets(dummy,ARPS_MAX_STRING_LENGTH,fin)==NULL) {
cleanup();
throw InvalidFormatException("Fail to read header lines of file "+filename, AT);
}
}
if (sscanf(dummy," nx = %u, ny = ", &v1)<1) {
//this is an ASCII file modified by ARPSGRID
......@@ -331,15 +342,22 @@ void ARPSIO::readGridLayer(const std::string& parameter, const unsigned int& lay
double tmp;
const unsigned int jmax=dimx*dimy*(layer-1);
for (unsigned int j = 0; j < jmax; j++)
fscanf(fin," %16lf%*[\n]",&tmp);
if(fscanf(fin," %16lf%*[\n]",&tmp)==EOF) {
cleanup();
throw InvalidFormatException("Fail to skip data layers in file "+filename, AT);
}
}
//read the data we are interested in
for (unsigned int ix = 0; ix < dimx; ix++) {
for (unsigned int iy = 0; iy < dimy; iy++) {
double tmp;
fscanf(fin," %16lf%*[\n]",&tmp);
grid.grid2D(ix,iy) = tmp;
if(fscanf(fin," %16lf%*[\n]",&tmp)==1) {
grid.grid2D(ix,iy) = tmp;
} else {
cleanup();
throw InvalidFormatException("Fail to read data layer in file "+filename, AT);
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment