kaylai / PetroPy

Python lessons for petrologists

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PetroPy

Python lessons for petrologists

Hi there,

I’m so glad there has been interest in learning Python! There is a steep learning curve, but it pays off. Once you learn a few key tricks, you’ll be well on your way.

For me, I was unable to learn code until I had a task I wanted to complete. In that vein, I’ve created a first lesson in python for absolute beginners aimed at petrologists. The lesson will show you how to code up Gordon’s 1998 H2O solubility model. Future lessons will expand on this. This is something I imagine you could all envision doing… taking equations and coding them up to add functionality. For example, if there is interest, future lessons will teach you how to throw a spreadsheet full of data at your code and have it calculate something for all of the samples at once.

INSTRUCTIONS

In addition to below instructions, I made a getting started video! You can find it in the github repository or on YouTube at https://youtu.be/KsD324sHPmM

The lessons are in the form of jupyter notebooks, which is just a fancy way of sharing code. So that you don’t have to install anything, I’ve set up a jupyter notebook server! Here’s what to do:

  1. Navigate to the github repository for this project

  2. Clone the repository or download the lessons you want

  3. IF you have jupyter notebook installed on your computer:

    a. Ensure you have python3 and numpy installed

    b. Open the jupyter notebook file (e.g., "Lesson1.ipynb")

  4. IF you don't have jupyter notebook installed on your computer:

    a. Email the developer at kaylaiacovino@gmail.com to request a login to the PetroPy server

    b. Once you have your user name, open a browser and go to http://142.93.195.231/

    c. Log into the server, and create a password. The password can be whatever you want! I won’t be able to see what it is, and I don’t know how to reset it if you forget it, so write it down somewhere.

    d. Drag and drop your files into the jupyter hub. Click the UPLOAD button that appears next to each file name.

    e. Open the Lesson 1 file.

  5. Learn python!

USING JUPYTER NOTEBOOKS

Notebooks are easy to use. I’ve written instructions at the top of the Lesson 1 file. Simply click on any cell you want to interact with, or just press Shift+Enter on your keyboard to move through cells. Shift+Enter executes any cell you’re on. There are two kinds of cells: text and code. The text that appears there (and images), was written in markdown but shows to you as text. If you double click a text cell, it will display the markdown. Don’t panic. Just press Shift+Enter to execute that cell and display it once again as formatted text.

About

Python lessons for petrologists

License:GNU General Public License v3.0


Languages

Language:Jupyter Notebook 100.0%