valentineap / ComputationalGeoscienceCourse

Materials for an introductory course in Python programming for geoscientists
7 stars 1 forks source link

Exercise 9 for review - exceptions #14

Closed valentineap closed 6 years ago

valentineap commented 6 years ago

https://github.com/valentineap/ComputationalGeoscienceCourse/tree/master/Practicals/Exercise%2009%20-%20Exception%20handling

A relatively brief exercise, with more reading than doing. If anyone has any suggestions for additional 'doing' parts, feel free to add them -- but I don't think it's too bad as it stands.

charlesll commented 6 years ago

I added a bit of "doing" parts.

Reading a file, raising an exception if the sum of columns does not sum to 100.

They can also apply that using the information at the end.

oscarbranson commented 6 years ago

Perhaps also include warnings for notifying of non-critical errors (e.g. "chosen option doesn't work, reverting back to default option"?)

valentineap commented 6 years ago

@charlesll Good addition; I modified slightly to remove reference to Numpy. @oscarbranson we can maybe cover warnings once modules are introduced, but I suspect this is a bit advanced for current purposes.

Ready for @rmcgirr94

valentineap commented 6 years ago

I thought I’d modified this to make it clearer, but it seems not to have made it into git… will check and push my changes…

On 19 Sep 2018, at 14:50, rmcgirr94 notifications@github.com wrote:

I'm a bit confused about what the last exercise is asking:

➤ Try to use this to adapt the code you just implemented in order to start a new calculation on a new array np.array([[1.,99.],[2.,98.],[3.,97.]]) if loading the file fails.

Could someone please explain this to me a little further. Also, we are referencing numpy before introducing it to the course.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/valentineap/ComputationalGeoscienceCourse/issues/14#issuecomment-422651693, or mute the thread https://github.com/notifications/unsubscribe-auth/AEY7u_eh8U85mFvo-6OjJwOyQXUYZruxks5ucc0vgaJpZM4WQcLX.

-- Dr Andrew Valentine Fellow, Seismology & Mathematical Geophysics

Research School of Earth Sciences The Australian National University 142 Mills Road, Acton ACT 2601

+61 (0)2 612 53424 Office: Jaeger 2, 147a

http://rses.anu.edu.au/~andrewv

valentineap commented 6 years ago

OK, now updated. Hopefully clearer; let me know if not.

A

On 19 Sep 2018, at 16:40, Andrew Valentine andrew.valentine@anu.edu.au wrote:

I thought I’d modified this to make it clearer, but it seems not to have made it into git… will check and push my changes…

On 19 Sep 2018, at 14:50, rmcgirr94 notifications@github.com wrote:

I'm a bit confused about what the last exercise is asking:

➤ Try to use this to adapt the code you just implemented in order to start a new calculation on a new array np.array([[1.,99.],[2.,98.],[3.,97.]]) if loading the file fails.

Could someone please explain this to me a little further. Also, we are referencing numpy before introducing it to the course.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

-- Dr Andrew Valentine Fellow, Seismology & Mathematical Geophysics

Research School of Earth Sciences The Australian National University 142 Mills Road, Acton ACT 2601

+61 (0)2 612 53424 Office: Jaeger 2, 147a

http://rses.anu.edu.au/~andrewv

-- Dr Andrew Valentine Fellow, Seismology & Mathematical Geophysics

Research School of Earth Sciences The Australian National University 142 Mills Road, Acton ACT 2601

+61 (0)2 612 53424 Office: Jaeger 2, 147a

http://rses.anu.edu.au/~andrewv

rebecca-mcgirr commented 6 years ago

Thanks @valentineap, much clearer now.

Tested, fixed a typo, closing issue.