WSL/SLF GitLab Repository
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
meteoio
Commits
d5782e4c
Commit
d5782e4c
authored
Mar 03, 2016
by
Mathias Bavay
Browse files
Introducing a new "GRID3D" key...
parent
bb694fb0
Changes
4
Hide whitespace changes
Inline
Side-by-side
meteoio/IOHandler.cmake.cc
View file @
d5782e4c
...
...
@@ -329,6 +329,18 @@ void IOHandler::read2DGrid(Grid2DObject& grid_out, const MeteoGrids::Parameters&
plugin
->
read2DGrid
(
grid_out
,
parameter
,
date
);
}
void
IOHandler
::
read3DGrid
(
Grid3DObject
&
grid_out
,
const
std
::
string
&
i_filename
)
{
IOInterface
*
plugin
=
getPlugin
(
"GRID3D"
,
"Input"
);
plugin
->
read3DGrid
(
grid_out
,
i_filename
);
}
void
IOHandler
::
read3DGrid
(
Grid3DObject
&
grid_out
,
const
MeteoGrids
::
Parameters
&
parameter
,
const
Date
&
date
)
{
IOInterface
*
plugin
=
getPlugin
(
"GRID3D"
,
"Input"
);
plugin
->
read3DGrid
(
grid_out
,
parameter
,
date
);
}
void
IOHandler
::
readDEM
(
DEMObject
&
dem_out
)
{
IOInterface
*
plugin
=
getPlugin
(
"DEM"
,
"Input"
);
...
...
@@ -402,6 +414,18 @@ void IOHandler::write2DGrid(const Grid2DObject& grid_in, const MeteoGrids::Param
plugin
->
write2DGrid
(
grid_in
,
parameter
,
date
);
}
void
IOHandler
::
write3DGrid
(
const
Grid3DObject
&
grid_out
,
const
std
::
string
&
options
)
{
IOInterface
*
plugin
=
getPlugin
(
"GRID3D"
,
"Output"
);
plugin
->
write3DGrid
(
grid_out
,
options
);
}
void
IOHandler
::
write3DGrid
(
const
Grid3DObject
&
grid_out
,
const
MeteoGrids
::
Parameters
&
parameter
,
const
Date
&
date
)
{
IOInterface
*
plugin
=
getPlugin
(
"GRID3D"
,
"Output"
);
plugin
->
write3DGrid
(
grid_out
,
parameter
,
date
);
}
/**
* Make sure all timestamps are unique and in increasing order
*/
...
...
meteoio/IOHandler.h
View file @
d5782e4c
...
...
@@ -45,6 +45,9 @@ class IOHandler : public IOInterface {
//methods defined in the IOInterface class
virtual
void
read2DGrid
(
Grid2DObject
&
out_grid
,
const
std
::
string
&
parameter
=
""
);
virtual
void
read2DGrid
(
Grid2DObject
&
grid_out
,
const
MeteoGrids
::
Parameters
&
parameter
,
const
Date
&
date
);
virtual
void
read3DGrid
(
Grid3DObject
&
grid_out
,
const
std
::
string
&
i_filename
=
""
);
virtual
void
read3DGrid
(
Grid3DObject
&
grid_out
,
const
MeteoGrids
::
Parameters
&
parameter
,
const
Date
&
date
);
virtual
void
readDEM
(
DEMObject
&
dem_out
);
virtual
void
readLanduse
(
Grid2DObject
&
landuse_out
);
virtual
void
readStationData
(
const
Date
&
date
,
...
...
@@ -60,6 +63,8 @@ class IOHandler : public IOInterface {
virtual
void
readPOI
(
std
::
vector
<
Coords
>&
pts
);
virtual
void
write2DGrid
(
const
Grid2DObject
&
grid_in
,
const
std
::
string
&
name
);
virtual
void
write2DGrid
(
const
Grid2DObject
&
grid_in
,
const
MeteoGrids
::
Parameters
&
parameter
,
const
Date
&
date
);
virtual
void
write3DGrid
(
const
Grid3DObject
&
grid_out
,
const
std
::
string
&
options
);
virtual
void
write3DGrid
(
const
Grid3DObject
&
grid_out
,
const
MeteoGrids
::
Parameters
&
parameter
,
const
Date
&
date
);
const
std
::
string
toString
()
const
;
...
...
meteoio/plugins/ARPSIO.cc
View file @
d5782e4c
...
...
@@ -49,7 +49,8 @@ namespace mio {
* - ARPS_XCOORD: x coordinate of the lower left corner of the grids; [Input] section
* - ARPS_YCOORD: y coordinate of the lower left corner of the grids; [Input] section
* - GRID2DPATH: path to the input directory where to find the arps files to be read as grids; [Input] section
* - GRID2DEXT: arps file extension, or <i>none</i> for no file extension (default: .asc)
* - GRID3DPATH: path to the input directory where to find the arps 3D files to be read as grids; [Input] section
* - ARPS_EXT: arps file extension, or <i>none</i> for no file extension (default: .asc)
*/
const
double
ARPSIO
::
plugin_nodata
=
-
999.
;
//plugin specific nodata value
...
...
@@ -58,7 +59,7 @@ const std::string ARPSIO::default_ext=".asc"; //filename extension
ARPSIO
::
ARPSIO
(
const
std
::
string
&
configfile
)
:
cfg
(
configfile
),
coordin
(),
coordinparam
(),
coordout
(),
coordoutparam
(),
grid2dpath_in
(),
ext
(
default_ext
),
dimx
(
0
),
dimy
(
0
),
dimz
(
0
),
cellsize
(
0.
),
grid2dpath_in
(),
grid3dpath_in
(),
ext
(
default_ext
),
dimx
(
0
),
dimy
(
0
),
dimz
(
0
),
cellsize
(
0.
),
xcoord
(
IOUtils
::
nodata
),
ycoord
(
IOUtils
::
nodata
),
zcoord
(),
is_true_arps
(
true
)
{
IOUtils
::
getProjectionParameters
(
cfg
,
coordin
,
coordinparam
,
coordout
,
coordoutparam
);
...
...
@@ -68,7 +69,7 @@ ARPSIO::ARPSIO(const std::string& configfile)
ARPSIO
::
ARPSIO
(
const
Config
&
cfgreader
)
:
cfg
(
cfgreader
),
coordin
(),
coordinparam
(),
coordout
(),
coordoutparam
(),
grid2dpath_in
(),
ext
(
default_ext
),
dimx
(
0
),
dimy
(
0
),
dimz
(
0
),
cellsize
(
0.
),
grid2dpath_in
(),
grid3dpath_in
(),
ext
(
default_ext
),
dimx
(
0
),
dimy
(
0
),
dimz
(
0
),
cellsize
(
0.
),
xcoord
(
IOUtils
::
nodata
),
ycoord
(
IOUtils
::
nodata
),
zcoord
(),
is_true_arps
(
true
)
{
IOUtils
::
getProjectionParameters
(
cfg
,
coordin
,
coordinparam
,
coordout
,
coordoutparam
);
...
...
@@ -82,6 +83,7 @@ ARPSIO& ARPSIO::operator=(const ARPSIO& source) {
coordout
=
source
.
coordout
;
coordoutparam
=
source
.
coordoutparam
;
grid2dpath_in
=
source
.
grid2dpath_in
;
grid3dpath_in
=
source
.
grid3dpath_in
;
ext
=
source
.
ext
;
dimx
=
source
.
dimx
;
dimy
=
source
.
dimy
;
...
...
@@ -101,12 +103,17 @@ void ARPSIO::setOptions()
if
(
grid_in
==
"ARPS"
)
{
//keep it synchronized with IOHandler.cc for plugin mapping!!
cfg
.
getValue
(
"GRID2DPATH"
,
"Input"
,
grid2dpath_in
);
}
const
string
grid3d_in
=
cfg
.
get
(
"GRID3D"
,
"Input"
,
IOUtils
::
nothrow
);
if
(
grid3d_in
==
"ARPS"
)
{
//keep it synchronized with IOHandler.cc for plugin mapping!!
cfg
.
getValue
(
"GRID3DPATH"
,
"Input"
,
grid3dpath_in
);
}
cfg
.
getValue
(
"ARPS_XCOORD"
,
"Input"
,
xcoord
,
IOUtils
::
nothrow
);
cfg
.
getValue
(
"ARPS_YCOORD"
,
"Input"
,
ycoord
,
IOUtils
::
nothrow
);
//default value has been set in constructor
cfg
.
getValue
(
"
GRID2D
EXT"
,
"Input"
,
ext
,
IOUtils
::
nothrow
);
cfg
.
getValue
(
"
ARPS_
EXT"
,
"Input"
,
ext
,
IOUtils
::
nothrow
);
if
(
ext
==
"none"
)
ext
.
clear
();
}
...
...
@@ -268,7 +275,7 @@ void ARPSIO::read2DGrid_internal(FILE* &fin, const std::string& filename, Grid2D
void
ARPSIO
::
read3DGrid
(
Grid3DObject
&
grid_out
,
const
std
::
string
&
i_name
)
{
const
size_t
pos
=
i_name
.
find_last_of
(
":"
);
//a specific parameter can be provided as {filename}:{parameter}
const
std
::
string
filename
=
(
pos
!=
IOUtils
::
npos
)
?
grid
2
dpath_in
+
"/"
+
i_name
.
substr
(
0
,
pos
)
:
grid
2
dpath_in
+
"/"
+
i_name
;
const
std
::
string
filename
=
(
pos
!=
IOUtils
::
npos
)
?
grid
3
dpath_in
+
"/"
+
i_name
.
substr
(
0
,
pos
)
:
grid
3
dpath_in
+
"/"
+
i_name
;
if
(
pos
==
IOUtils
::
npos
)
{
//TODO: read by default the first data grid that is found?
listFields
(
i_name
);
throw
InvalidArgumentException
(
"Please provide the parameter that has to be read!"
,
AT
);
...
...
meteoio/plugins/ARPSIO.h
View file @
d5782e4c
...
...
@@ -73,7 +73,7 @@ class ARPSIO : public IOInterface {
static
const
double
plugin_nodata
;
//plugin specific nodata value, e.g. -999
static
const
std
::
string
default_ext
;
std
::
string
coordin
,
coordinparam
,
coordout
,
coordoutparam
;
//projection parameters
std
::
string
grid2dpath_in
;
//where are input grids stored
std
::
string
grid2dpath_in
,
grid3dpath_in
;
//where are input grids stored
std
::
string
ext
;
//file extension
unsigned
int
dimx
,
dimy
,
dimz
;
double
cellsize
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment