From 041f78639aca32396304bd960dc251cfaad34f5c Mon Sep 17 00:00:00 2001 From: tuckersiegel <siegel.tucker@gmail.com> Date: Tue, 9 Mar 2021 10:44:49 -0500 Subject: [PATCH] remove t_base parameter --- controllers/gddAccumulatedController.js | 33 ++++++++----------------- controllers/gddController.js | 18 +++++--------- controllers/gddNormalController.js | 15 +++-------- pull_data.py | 2 ++ swagger_definition.yaml | 16 ------------ 5 files changed, 22 insertions(+), 62 deletions(-) diff --git a/controllers/gddAccumulatedController.js b/controllers/gddAccumulatedController.js index e00ef0c..420b8cb 100644 --- a/controllers/gddAccumulatedController.js +++ b/controllers/gddAccumulatedController.js @@ -79,19 +79,11 @@ exports.accumulated_gdd = function (req, res) { }); } - if (req.body.hasOwnProperty("t_base")) { - t_base = parseFloat(req.body.t_base); - if (t_base < t_min) { - t_min = t_base; - } - } else { - out = utils.product_base_switch(product, errors, t_base, t_min); - t_base = out.t_base; - t_min = out.t_min; - errors = out.errors; - } + out = utils.product_base_switch(product, errors, t_base, t_min); + t_base = out.t_base; + t_min = out.t_min; + errors = out.errors; - if (longitude < -125 || longitude > -66.5) { errors.push({ parameter_error: "longitude", @@ -157,17 +149,12 @@ exports.accumulated_normal_gdd = function (req, res) { }); } - if (req.body.hasOwnProperty("t_base")) { - t_base = parseFloat(req.body.t_base); - if (t_base < t_min) { - t_min = t_base; - } - } else { - out = utils.product_base_switch(product, errors, t_base, t_min); - t_base = out.t_base; - t_min = out.t_min; - errors = out.errors; - } + + out = utils.product_base_switch(product, errors, t_base, t_min); + t_base = out.t_base; + t_min = out.t_min; + errors = out.errors; + if (longitude < -125 || longitude > -66.5) { diff --git a/controllers/gddController.js b/controllers/gddController.js index f0d9bd0..98433b4 100644 --- a/controllers/gddController.js +++ b/controllers/gddController.js @@ -77,18 +77,12 @@ exports.year_gdd = function (req, res) { }); } - if (req.body.hasOwnProperty("t_base")) { - t_base = parseFloat(req.body.t_base); - if (t_base < t_min) { - t_min = t_base; - } - } else { - out = utils.product_base_switch(product, errors, t_base, t_min); - t_base = out.t_base; - t_min = out.t_min; - errors = out.errors; - } - + + out = utils.product_base_switch(product, errors, t_base, t_min); + t_base = out.t_base; + t_min = out.t_min; + errors = out.errors; + if (longitude < -125 || longitude > -66.5) { errors.push({ diff --git a/controllers/gddNormalController.js b/controllers/gddNormalController.js index 349dba5..a2fe041 100644 --- a/controllers/gddNormalController.js +++ b/controllers/gddNormalController.js @@ -67,17 +67,10 @@ exports.normal = function (req, res) { }); } - if (req.body.hasOwnProperty("t_base")) { - t_base = parseFloat(req.body.t_base); - if (t_base < t_min) { - t_min = t_base; - } - } else { - out = utils.product_base_switch(product, errors, t_base, t_min); - t_base = out.t_base; - t_min = out.t_min; - errors = out.errors; - } + out = utils.product_base_switch(product, errors, t_base, t_min); + t_base = out.t_base; + t_min = out.t_min; + errors = out.errors; if (longitude < -125 || longitude > -66.5) { errors.push({ diff --git a/pull_data.py b/pull_data.py index 08cbb5e..4ceb3a2 100644 --- a/pull_data.py +++ b/pull_data.py @@ -7,6 +7,8 @@ from multiprocessing.pool import ThreadPool from multiprocessing import Lock from pymongo import MongoClient +## FOR CURRENT YEAR DATA + def to_freedom_units(data): return (data * 9/5) + 32 diff --git a/swagger_definition.yaml b/swagger_definition.yaml index 71b8d7d..158814d 100644 --- a/swagger_definition.yaml +++ b/swagger_definition.yaml @@ -43,10 +43,6 @@ paths: minimum: -125.0 maximum: -66.5 example: -76.94 - t_base: - description: Base temperature to calculate gdd on, in fahrenheit. NOT REQUIRED - type: number - example: 50 responses: 200: @@ -129,10 +125,6 @@ paths: minimum: -125.0 maximum: -66.5 example: -76.94 - t_base: - description: Base temperature to calculate gdd on, in fahrenheit. NOT REQUIRED - type: number - example: 50 responses: 200: @@ -210,10 +202,6 @@ paths: minimum: -125.0 maximum: -66.5 example: -76.94 - t_base: - description: Base temperature to calculate gdd on, in fahrenheit. NOT REQUIRED - type: number - example: 50 responses: 200: @@ -302,10 +290,6 @@ paths: minimum: -125.0 maximum: -66.5 example: -76.94 - t_base: - description: Base temperature to calculate gdd on, in fahrenheit. NOT REQUIRED - type: number - example: 50 responses: 200: -- GitLab