Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug where surface wind wasn't having units converted #1158

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions apps/landuse/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,14 @@ const doCurveParams = function () {

const vgtyps = rows[i].vgtyp;
vgtypsModelOptionsMap[model] = vgtyps
.replace(/'|\[|\]/g, "")
.split(",")
.map(Function.prototype.call, String.prototype.trim)
.filter(function (vgtyp) {
return vgtyp !== "0";
})
.map(function (vgtyp) {
return allVgtypValuesMap[vgtyp.replace(/'|\[|\]/g, "")];
return allVgtypValuesMap[vgtyp];
});
}
} catch (err) {
Expand Down Expand Up @@ -549,31 +553,31 @@ const doCurveParams = function () {
// 3: sum of model values
// 4: sum of obs values
// 5: sum of absolute obs-model difference (|bias_0| + |bias_1| + |bias_2| + ... + |bias_n|)
"2m temperature": [
"Temperature at 2m (°C)": [
"m0.sum2_dt",
"m0.N_dt",
"m0.sum_dt",
"-1 * (m0.sum_dt-m0.sum_ob_t)",
"m0.sum_ob_t",
"(if(m0.sum_adt is not null,m0.sum_adt,0))",
],
"2m RH": [
"Relative Humidity at 2m (%)": [
"m0.sum2_drh",
"m0.N_drh",
"m0.sum_drh",
"-1 * (m0.sum_drh-m0.sum_ob_rh)",
"m0.sum_ob_rh",
"0",
],
"2m dewpoint": [
"Dewpoint at 2m (°C)": [
"m0.sum2_dtd",
"m0.N_dtd",
"m0.sum_dtd",
"-1 * (m0.sum_dtd-m0.sum_ob_td)",
"m0.sum_ob_td",
"(if(m0.sum_adtd is not null,m0.sum_adtd,0))",
],
"10m wind": [
"Wind Speed at 10m (m/s)": [
"m0.sum2_dw",
"m0.N_dw",
"m0.sum_ob_ws-m0.sum_model_ws",
Expand All @@ -585,46 +589,46 @@ const doCurveParams = function () {

const statVarUnitMap = {
RMSE: {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"Bias (Model - Obs)": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
N: {
"2m temperature": "Number",
"2m RH": "Number",
"2m dewpoint": "Number",
"10m wind": "Number",
"Temperature at 2m (°C)": "Number",
"Relative Humidity at 2m (%)": "Number",
"Dewpoint at 2m (°C)": "Number",
"Wind Speed at 10m (m/s)": "Number",
},
"Model average": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"Obs average": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"Std deviation": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"MAE (temp and dewpoint only)": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
};

Expand Down
70 changes: 35 additions & 35 deletions apps/surface/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,31 +648,31 @@ const doCurveParams = function () {
// 4: sum of obs values
// 5: sum of absolute obs-model difference (|bias_0| + |bias_1| + |bias_2| + ... + |bias_n|)
"Predefined region": {
"2m temperature": [
"Temperature at 2m (°C)": [
"m0.sum2_dt",
"m0.N_dt",
"m0.sum_dt",
"-1 * (m0.sum_dt-m0.sum_ob_t)",
"m0.sum_ob_t",
"(if(m0.sum_adt is not null,m0.sum_adt,0))",
],
"2m RH": [
"Relative Humidity at 2m (%)": [
"m0.sum2_drh",
"m0.N_drh",
"m0.sum_drh",
"-1 * (m0.sum_drh-m0.sum_ob_rh)",
"m0.sum_ob_rh",
"0",
],
"2m dewpoint": [
"Dewpoint at 2m (°C)": [
"m0.sum2_dtd",
"m0.N_dtd",
"m0.sum_dtd",
"-1 * (m0.sum_dtd-m0.sum_ob_td)",
"m0.sum_ob_td",
"(if(m0.sum_adtd is not null,m0.sum_adtd,0))",
],
"10m wind": [
"Wind Speed at 10m (m/s)": [
"m0.sum2_dw",
"m0.N_dw",
"m0.sum_ob_ws-m0.sum_model_ws",
Expand All @@ -682,23 +682,23 @@ const doCurveParams = function () {
],
},
"Select stations": {
"2m temperature": [
"Temperature at 2m (°C)": [
"pow(o.temp - m0.temp,2)/100",
"(o.temp - m0.temp)",
"(o.temp - m0.temp)/10",
"(if(o.temp is not null,m0.temp,null))/10",
"(if(m0.temp is not null,o.temp,null))/10",
"(abs(o.temp - m0.temp))/10",
],
"2m dewpoint": [
"Dewpoint at 2m (°C)": [
"(pow(o.dp - m0.dp,2))/100",
"(o.dp - m0.dp)",
"(o.dp - m0.dp)/10",
"(if(o.dp is not null,m0.dp,null))/10",
"(if(m0.dp is not null,o.dp,null))/10",
"(abs(o.dp - m0.dp))/10",
],
"10m wind": [
"Wind Speed at 10m (m/s)": [
"(pow(o.ws,2)+pow(m0.ws,2)-2*o.ws*m0.ws*cos((o.wd-m0.wd)/57.2958))",
"(o.ws + m0.ws)",
"(o.ws - m0.ws)",
Expand All @@ -711,46 +711,46 @@ const doCurveParams = function () {

const statVarUnitMap = {
RMSE: {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"Bias (Model - Obs)": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
N: {
"2m temperature": "Number",
"2m RH": "Number",
"2m dewpoint": "Number",
"10m wind": "Number",
"Temperature at 2m (°C)": "Number",
"Relative Humidity at 2m (%)": "Number",
"Dewpoint at 2m (°C)": "Number",
"Wind Speed at 10m (m/s)": "Number",
},
"Model average": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"Obs average": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"Std deviation": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
"MAE (temp and dewpoint only)": {
"2m temperature": "°C",
"2m RH": "RH (%)",
"2m dewpoint": "°C",
"10m wind": "m/s",
"Temperature at 2m (°C)": "°C",
"Relative Humidity at 2m (%)": "RH (%)",
"Dewpoint at 2m (°C)": "°C",
"Wind Speed at 10m (m/s)": "m/s",
},
};

Expand Down
8 changes: 4 additions & 4 deletions tests/src/features/landuse/basic/addRemoveScatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Feature: Add Remove Scatter
Then the "data-source" parameter value matches "RAP_GSL"
When I change the "x-statistic" parameter to "Bias (Model - Obs)"
Then the "x-statistic" parameter value matches "Bias (Model - Obs)"
When I change the "x-variable" parameter to "2m temperature"
Then the "x-variable" parameter value matches "2m temperature"
When I change the "x-variable" parameter to "Temperature at 2m (°C)"
Then the "x-variable" parameter value matches "Temperature at 2m (°C)"
When I change the "y-statistic" parameter to "Obs average"
Then the "y-statistic" parameter value matches "Obs average"
When I change the "y-variable" parameter to "2m temperature"
Then the "y-variable" parameter value matches "2m temperature"
When I change the "y-variable" parameter to "Temperature at 2m (°C)"
Then the "y-variable" parameter value matches "Temperature at 2m (°C)"
When I set the curve-dates to "03/02/2021 00:00 - 03/03/2021 00:00"
Then the curve-dates value is "03/02/2021 00:00 - 03/03/2021 00:00"
Then I click the "Add Curve" button
Expand Down
8 changes: 4 additions & 4 deletions tests/src/features/landuse/basic/addRemoveTwoScatters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Feature: Add Remove Two Scatters
Then the "data-source" parameter value matches "RAP_GSL"
When I change the "x-statistic" parameter to "Bias (Model - Obs)"
Then the "x-statistic" parameter value matches "Bias (Model - Obs)"
When I change the "x-variable" parameter to "2m temperature"
Then the "x-variable" parameter value matches "2m temperature"
When I change the "x-variable" parameter to "Temperature at 2m (°C)"
Then the "x-variable" parameter value matches "Temperature at 2m (°C)"
When I change the "y-statistic" parameter to "Obs average"
Then the "y-statistic" parameter value matches "Obs average"
When I change the "y-variable" parameter to "2m temperature"
Then the "y-variable" parameter value matches "2m temperature"
When I change the "y-variable" parameter to "Temperature at 2m (°C)"
Then the "y-variable" parameter value matches "Temperature at 2m (°C)"
When I set the curve-dates to "03/02/2021 00:00 - 03/03/2021 00:00"
Then the curve-dates value is "03/02/2021 00:00 - 03/03/2021 00:00"
Then I click the "Add Curve" button
Expand Down
8 changes: 4 additions & 4 deletions tests/src/features/surface/basic/addRemoveScatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Feature: Add Remove Scatter
Then the "data-source" parameter value matches "RAP_GSL"
When I change the "x-statistic" parameter to "Bias (Model - Obs)"
Then the "x-statistic" parameter value matches "Bias (Model - Obs)"
When I change the "x-variable" parameter to "2m temperature"
Then the "x-variable" parameter value matches "2m temperature"
When I change the "x-variable" parameter to "Temperature at 2m (°C)"
Then the "x-variable" parameter value matches "Temperature at 2m (°C)"
When I change the "y-statistic" parameter to "Obs average"
Then the "y-statistic" parameter value matches "Obs average"
When I change the "y-variable" parameter to "2m temperature"
Then the "y-variable" parameter value matches "2m temperature"
When I change the "y-variable" parameter to "Temperature at 2m (°C)"
Then the "y-variable" parameter value matches "Temperature at 2m (°C)"
When I set the curve-dates to "09/21/2019 00:00 - 09/24/2019 00:00"
Then the curve-dates value is "09/21/2019 00:00 - 09/24/2019 00:00"
Then I click the "Add Curve" button
Expand Down
8 changes: 4 additions & 4 deletions tests/src/features/surface/basic/addRemoveTwoScatters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Feature: Add Remove Two Scatters
Then the "data-source" parameter value matches "RAP_GSL"
When I change the "x-statistic" parameter to "Bias (Model - Obs)"
Then the "x-statistic" parameter value matches "Bias (Model - Obs)"
When I change the "x-variable" parameter to "2m temperature"
Then the "x-variable" parameter value matches "2m temperature"
When I change the "x-variable" parameter to "Temperature at 2m (°C)"
Then the "x-variable" parameter value matches "Temperature at 2m (°C)"
When I change the "y-statistic" parameter to "Obs average"
Then the "y-statistic" parameter value matches "Obs average"
When I change the "y-variable" parameter to "2m temperature"
Then the "y-variable" parameter value matches "2m temperature"
When I change the "y-variable" parameter to "Temperature at 2m (°C)"
Then the "y-variable" parameter value matches "Temperature at 2m (°C)"
When I set the curve-dates to "09/21/2019 00:00 - 09/24/2019 00:00"
Then the curve-dates value is "09/21/2019 00:00 - 09/24/2019 00:00"
Then I click the "Add Curve" button
Expand Down
Loading