add a test to compare result_table.csv to an expected result table for the regression model. #BITBUCKET-3815.

This commit is contained in:
David Fisher 2018-11-16 16:02:51 -08:00
parent e385d1bb77
commit 15211b5e67
2 changed files with 18 additions and 2 deletions

View File

@ -2,6 +2,10 @@
Unreleased Changes
------------------
* Fixing an issue with Crop Production Regression's result_table.csv where the
'production_modeled' and '<nutrient>_modeled' values calculated for each crop
were done so using the same crop raster (e.g. wheat, soybean, and barley values
were all based on soybean data).
* Reimplementing the Carbon model using taskgraph.
* Fixing an issue with Coastal Blue Carbon validation to allow column names to
ignore case.

View File

@ -115,6 +115,7 @@ class CropProductionTests(unittest.TestCase):
'nitrogen_fertilization_rate': 29.6,
'phosphorous_fertilization_rate': 8.4,
'potassium_fertilization_rate': 14.2,
'n_workers': '-1'
}
with open(args['landcover_to_crop_table_path'],
@ -148,10 +149,21 @@ class CropProductionTests(unittest.TestCase):
}
crop_production_regression.execute(args)
result_table_path = os.path.join(
agg_result_table_path = os.path.join(
args['workspace_dir'], 'aggregate_results.csv')
expected_result_table_path = os.path.join(
expected_agg_result_table_path = os.path.join(
TEST_DATA_PATH, 'expected_regression_aggregate_results.csv')
expected_agg_result_table = pandas.read_csv(
expected_agg_result_table_path)
agg_result_table = pandas.read_csv(
agg_result_table_path)
pandas.testing.assert_frame_equal(
expected_agg_result_table, agg_result_table, check_dtype=False)
result_table_path = os.path.join(
args['workspace_dir'], 'result_table.csv')
expected_result_table_path = os.path.join(
TEST_DATA_PATH, 'expected_regression_result_table.csv')
expected_result_table = pandas.read_csv(
expected_result_table_path)
result_table = pandas.read_csv(