Skip to content

Commit 1387e4c

Browse files
Fixed order of imports
1 parent 035c8b9 commit 1387e4c

8 files changed

+29
-21
lines changed

tests/test_model_exceptions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
Test exeptions in the model.
33
"""
44
import unittest
5+
import os
6+
os.environ['DEVELOPMENT'] = 'True'
57

68
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
79
from aquacrop.utils import prepare_weather, get_filepath
810

9-
import os
10-
os.environ['DEVELOPMENT'] = 'True'
11+
1112

1213

1314
class TestModelExceptions(unittest.TestCase):

tests/test_model_not_running.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import unittest
2+
import os
3+
os.environ['DEVELOPMENT'] = 'True'
24

35
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
46
from aquacrop.utils import prepare_weather, get_filepath
57

6-
import os
7-
os.environ['DEVELOPMENT'] = 'True'
8+
89

910
class TestModelByStepNotFinished(unittest.TestCase):
1011
"""

tests/test_model_step_finished.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import unittest
2+
import os
3+
os.environ['DEVELOPMENT'] = 'True'
24

35
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
46
from aquacrop.utils import prepare_weather, get_filepath
57

6-
import os
7-
os.environ['DEVELOPMENT'] = 'True'
8+
89

910

1011
class TestModelByStepNotFinished(unittest.TestCase):

tests/test_model_step_less_than_1.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import unittest
2+
import os
3+
os.environ['DEVELOPMENT'] = 'True'
24

35
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
46
from aquacrop.utils import prepare_weather, get_filepath
57

6-
import os
7-
os.environ['DEVELOPMENT'] = 'True'
8+
89

910

1011
class TestModelStepLessThan1(unittest.TestCase):

tests/test_model_step_not_finished.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import unittest
2+
import os
3+
os.environ['DEVELOPMENT'] = 'True'
24

35
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
46
from aquacrop.utils import prepare_weather, get_filepath
57

6-
import os
7-
os.environ['DEVELOPMENT'] = 'True'
8+
89

910

1011
class TestModelByStepNotFinished(unittest.TestCase):

tests/test_model_till_termination.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import unittest
2+
import os
3+
os.environ['DEVELOPMENT'] = 'True'
24

35
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
46
from aquacrop.utils import prepare_weather, get_filepath
57

6-
import os
7-
os.environ['DEVELOPMENT'] = 'True'
8+
89

910

1011
class TestModelTillTermination(unittest.TestCase):

tests/test_speed.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import unittest
22
import time
3+
import os
4+
os.environ['DEVELOPMENT'] = 'True'
35

46
from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent
57
from aquacrop.utils import prepare_weather, get_filepath
68

7-
import os
8-
os.environ['DEVELOPMENT'] = 'True'
9+
910

1011

1112
class TestAquacropOs(unittest.TestCase):

tests/test_v7.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
os.environ['DEVELOPMENT'] = 'True'
3+
34
import pandas as pd
45
import matplotlib.pyplot as plt
56
import seaborn as sns
@@ -32,19 +33,19 @@
3233
)
3334
model.run_model(till_termination=True)
3435

35-
fig,ax=plt.subplots(2,1,figsize=(12,14))
36+
# fig,ax=plt.subplots(2,1,figsize=(12,14))
3637

3738

3839
# YIELD POTENTIAL TESTS
3940
model._outputs.final_stats=model._outputs.final_stats.set_index('Harvest Date (YYYY/MM/DD)')
40-
final_stats_m=model._outputs.final_stats.melt(value_name='yield', value_vars=['Yield potential (tonne/ha)', 'Dry yield (tonne/ha)'], var_name='yield type', ignore_index=False).reset_index()
41+
# final_stats_m=model._outputs.final_stats.melt(value_name='yield', value_vars=['Yield potential (tonne/ha)', 'Dry yield (tonne/ha)'], var_name='yield type', ignore_index=False).reset_index()
4142

42-
sns.barplot(data=final_stats_m, x='Harvest Date (YYYY/MM/DD)', y='yield',hue='yield type', ax=ax[0])
43+
# sns.barplot(data=final_stats_m, x='Harvest Date (YYYY/MM/DD)', y='yield',hue='yield type', ax=ax[0])
4344

44-
model._outputs.crop_growth=model._outputs.crop_growth.set_index('time_step_counter')
45-
crop_growth_m=model._outputs.crop_growth.melt(value_name='yield', value_vars=['YieldPot', 'DryYield'], var_name='yield type', ignore_index=False).reset_index()
45+
# model._outputs.crop_growth=model._outputs.crop_growth.set_index('time_step_counter')
46+
# crop_growth_m=model._outputs.crop_growth.melt(value_name='yield', value_vars=['YieldPot', 'DryYield'], var_name='yield type', ignore_index=False).reset_index()
4647

47-
sns.scatterplot(data=crop_growth_m, x='time_step_counter', y='yield',hue='yield type', ax=ax[1])
48+
# sns.scatterplot(data=crop_growth_m, x='time_step_counter', y='yield',hue='yield type', ax=ax[1])
4849

4950
# FRESH/DRY YIELD TESTS
5051
# model._outputs.final_stats=model._outputs.final_stats.set_index('Harvest Date (YYYY/MM/DD)')
@@ -57,4 +58,4 @@
5758

5859
# sns.lineplot(data=crop_growth_m, x='time_step_counter', y='yield',hue='yield type', ax=ax[1])
5960

60-
plt.show()
61+
# plt.show()

0 commit comments

Comments
 (0)