diff --git a/controllers/gddAccumulatedController.js b/controllers/gddAccumulatedController.js index e00ef0c12513b4d4ecfaf54fd384b41bdd5bcff5..420b8cbd6844314c626d30131fae3efdfe2e5481 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 f0d9bd02567fdafbe022a5298147988fcf0f920b..98433b4a4b1c047baec35ea954e53c5b1a551809 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 349dba5eefd471650efcc80feeb3b1ff6cf04e36..a2fe041be30d54eef299d8b2e6abc783a70ac5f4 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 08cbb5ed32218439da46fd943832780fef6b9c90..4ceb3a2cc6ee9d60a7de072be2b2adf4f8935d04 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 71b8d7d6f15037338639ad14ed7d4060d49f8ed9..158814de462507dd3c041cdda83890a0e03a55ca 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: