Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
86cfcb16
Commit
86cfcb16
authored
Oct 26, 2018
by
Purves, Murray
Browse files
Removing height as a variable from radixsnd2arl
parent
cb5d4971
Pipeline
#16720
passed with stages
in 17 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixio/examples/radixsnd2arl.cc
View file @
86cfcb16
...
...
@@ -198,11 +198,10 @@ int main(int argc, char **argv)
std
::
cout
<<
"Reading input csv file: "
<<
inputCsvPath
<<
std
::
endl
;
// Header strings to denote fields
std
::
string
pressureString
=
"pres"
,
heightString
=
"zhgt"
,
tempString
=
"temp"
,
relHumString
=
"rh"
,
dewPtString
=
"tdew"
,
wDirString
=
"wdir"
,
wSpdString
=
"wspd"
;
int
pressureIndex
=
-
1
,
heightIndex
=
-
1
,
tempIndex
=
-
1
,
relHumIndex
=
-
1
,
wDirIndex
=
-
1
,
wSpdIndex
=
-
1
;
std
::
string
pressureString
=
"pres"
,
tempString
=
"temp"
,
relHumString
=
"rh"
,
dewPtString
=
"tdew"
,
wDirString
=
"wdir"
,
wSpdString
=
"wspd"
;
int
pressureIndex
=
-
1
,
tempIndex
=
-
1
,
relHumIndex
=
-
1
,
wDirIndex
=
-
1
,
wSpdIndex
=
-
1
;
// Open and read the csv
CSVFile
inputCsv
(
inputCsvPath
);
...
...
@@ -236,11 +235,6 @@ int main(int argc, char **argv)
std
::
cout
<<
" Found pressure at index "
<<
entry
<<
std
::
endl
;
pressureIndex
=
entry
;
}
else
if
(
inputData
[
1
][
entry
]
==
heightString
)
{
std
::
cout
<<
" Found height at index "
<<
entry
<<
std
::
endl
;
heightIndex
=
entry
;
}
else
if
(
inputData
[
1
][
entry
]
==
tempString
)
{
std
::
cout
<<
" Found temperature at index "
<<
entry
<<
std
::
endl
;
...
...
@@ -263,8 +257,8 @@ int main(int argc, char **argv)
}
}
// If we are missing one, we can't continue
if
(
pressureIndex
==
-
1
||
height
Index
==
-
1
||
temp
Index
==
-
1
||
relHumIndex
==
-
1
||
wDirIndex
==
-
1
||
wSpdIndex
==
-
1
)
if
(
pressureIndex
==
-
1
||
temp
Index
==
-
1
||
relHum
Index
==
-
1
||
wDirIndex
==
-
1
||
wSpdIndex
==
-
1
)
{
std
::
cout
<<
"Missing data fields in input!"
<<
std
::
endl
;
if
(
pressureIndex
==
-
1
)
...
...
@@ -272,10 +266,6 @@ int main(int argc, char **argv)
std
::
cout
<<
" Missing pressure field (denoted by "
<<
pressureString
<<
")"
;
}
if
(
heightIndex
==
-
1
)
{
std
::
cout
<<
" Missing height field (denoted by "
<<
heightString
<<
")"
;
}
if
(
tempIndex
==
-
1
)
{
std
::
cout
<<
" Missing temperature field (denoted by "
<<
tempString
...
...
@@ -301,8 +291,8 @@ int main(int argc, char **argv)
}
// Read the data
std
::
vector
<
float
>
inputPressures
,
inputHeights
,
inputTemps
,
inputRelHums
,
inputWDirs
,
inputWSpds
;
std
::
vector
<
float
>
inputPressures
,
inputTemps
,
inputRelHums
,
inputWDirs
,
inputWSpds
;
std
::
cout
<<
"Data fields found - reading data..."
<<
std
::
endl
;
float
missingValue
=
-
9999.
f
;
for
(
int
row
=
4
;
row
<
inputData
.
size
();
++
row
)
...
...
@@ -314,8 +304,8 @@ int main(int argc, char **argv)
;
}
bool
foundPressure
=
false
,
found
Height
=
false
,
found
Temp
=
false
,
foundRelHum
=
false
,
foundWDir
=
false
,
foundWSpd
=
false
;
bool
foundPressure
=
false
,
found
Temp
=
false
,
found
RelHum
=
false
,
foundWDir
=
false
,
foundWSpd
=
false
;
for
(
int
entry
=
0
;
entry
<
inputData
[
row
].
size
();
++
entry
)
{
float
thisValue
=
from_string
(
inputData
[
row
][
entry
],
missingValue
);
...
...
@@ -325,11 +315,6 @@ int main(int argc, char **argv)
foundPressure
=
true
;
inputPressures
.
push_back
(
thisValue
);
}
else
if
(
entry
==
heightIndex
)
{
foundHeight
=
true
;
inputHeights
.
push_back
(
thisValue
);
}
else
if
(
entry
==
tempIndex
)
{
foundTemp
=
true
;
...
...
@@ -358,12 +343,6 @@ int main(int argc, char **argv)
<<
std
::
endl
;
inputPressures
.
push_back
(
missingValue
);
}
if
(
!
foundHeight
)
{
std
::
cout
<<
" Warning: couldn't find height in row "
<<
row
<<
std
::
endl
;
inputHeights
.
push_back
(
missingValue
);
}
if
(
!
foundTemp
)
{
std
::
cout
<<
" Warning: couldn't find temperature in row "
<<
row
...
...
@@ -394,8 +373,6 @@ int main(int argc, char **argv)
// Interpolate the data to remove missing values
std
::
cout
<<
"Interpolating values to remove missing data..."
<<
std
::
endl
;
std
::
cout
<<
"Height:"
<<
std
::
endl
;
interpolateValues
(
inputPressures
,
inputHeights
);
std
::
cout
<<
"Temperature:"
<<
std
::
endl
;
interpolateValues
(
inputPressures
,
inputTemps
);
std
::
cout
<<
"Relative humidity:"
<<
std
::
endl
;
...
...
@@ -472,19 +449,6 @@ int main(int argc, char **argv)
std
::
cout
<<
"written"
<<
std
::
endl
;
}
// Write height levels
{
thisRecordHeader
.
kvar
=
"HGTS"
;
thisRecordHeader
.
var1
=
inputHeights
[
level
];
std
::
vector
<
std
::
vector
<
float
>>
thisData
(
numberGridCells
,
std
::
vector
<
float
>
(
numberGridCells
,
inputHeights
[
level
]));
std
::
cout
<<
" height..."
;
outputStream
.
write_record_header
(
thisRecordHeader
);
outputStream
.
write_record
(
thisRecordHeader
,
thisIndexHeader
,
thisData
);
std
::
cout
<<
"written"
<<
std
::
endl
;
}
// Write temperature levels
{
thisRecordHeader
.
kvar
=
"TEMP"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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