Closed AnnAnnFryingPan closed 4 months ago
First step, I think, is to have our model run at the end of 12-virtual-environment
.
The program is setup to read in the rain data only - so we can show it doing this, and replace our error message (and lead into why we want to do the rest of the work), with the error message from trying to run the code with a river_data file.
E.g.:
python3 catchment-analysis.py
usage: catchment-analysis.py [-h] infiles [infiles ...]
catchment-analysis.py: error: the following arguments are required: infiles
python3 catchment-analysis.py data/rain_data_2015-12.csv
(creates data plot - include at this point)
python3 catchment-analysis.py data/river_data_2015-12.csv
Traceback (most recent call last):
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment-template/catchment-analysis.py", line 39, in <module>
main(args)
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment-template/catchment-analysis.py", line 22, in main
measurement_data = models.read_variable_from_csv(filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment-template/catchment/models.py", line 22, in read_variable_from_csv
dataset = pd.read_csv(filename, usecols=['Date', 'Site', 'Rainfall (mm)'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment/venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 948, in read_csv
return _read(filepath_or_buffer, kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment/venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 611, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment/venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1448, in __init__
self._engine = self._make_engine(f, self.engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment/venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1723, in _make_engine
return mapping[engine](f, **self.options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment/venv/lib/python3.12/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 140, in __init__
self._validate_usecols_names(usecols, self.orig_names)
File "/Users/user/work/manchester/Course_Material/Intermediate_Programming_Skills/python-intermediate-rivercatchment/venv/lib/python3.12/site-packages/pandas/io/parsers/base_parser.py", line 969, in _validate_usecols_names
raise ValueError(
ValueError: Usecols do not match columns, columns expected but not found: ['Rainfall (mm)']
(highlight the last line of this error message to them)
The same should be done for end of the 13-ides
lesson.
Then we create a new lesson just after linting
- taking the first stages of 36-architecture-revisited
lesson. Stopping before Adding a new View
.
This will introduce the controller file structure, and talk more about MVC.
Possibly we don't rebadge this as 'refactoring'? I need to review the new material, to see what we could keep in lesson 36 to replace this material.
I've reigned in my ambitions for this issue - given the changes which could be coming across later from https://github.com/carpentries-incubator/python-intermediate-development/pull/234, and the lack of my time, it makes more sense to just make sure we introduce the project program a little better.
So I've simply adapted the venv and ide lessons to show how we can plot the rain data, but not the river data.
Also check https://github.com/carpentries-incubator/python-intermediate-development/pull/234 to seer if relevant here