Here scripts are provided to partially evaluate the salt tracer experiments. After running these you will get a CSV-file with the output for each tracer experiment:
- discharge at all detection points
- time of peak concentration at all detection points
The provided scripts you can run either as plain Julia scripts, i.e. text-files (ending in .jl
in the folder scripts/
) or
as a Jupyter notebook (files ending in .ipynb
in the folder notebooks/
).
The following scripts/notebooks are provided and should be looked-at and run in this order (or the .ipynb
files if using notebooks):
1_intro
this file2_calibration.jl
to input and process your calibrations3_traces.jl
read CTD sensor data and partition into individual tracer experiments4_process_traces.jl
process the traces to produce discharges and peak-times5_further_work.jl
gives some hints on what else to do with the rest of your time...
Additionally there are the following files
quick_data_visualisation.jl
allows to plot sensor datahelper_functions.jl
various helper functions used in the scripts- (not needed by you:
export_to_md_ipynb.jl
creates the notebooks and web-markdown files from the julia scripts)
# Technical instructions
You can run the code
The notebook is a Jupyter notebook (formerly iPython notebook) which allows combining notes (in markdown), codes and plots. For documentation see here, but you should be able to get by with the documentation I provide below.
To get the notebook running (what you're looking at right now is probably the non-inteactive html-rendered version of the notebook) do:
- log into the practicum account on a linux machine
- open a terminal and type:
cd fieldcourse/surface-hydrology/
+ enter,julia
+ enter - once started type
using IJulia
+ enter andnotebook()
+ enter (this will take a few seconds). - this should open a file-browser dialog in your internet-browser (if it doesn't open a browser and navigate to localhost:8888, by clicking the link). Click on
Salt-dilution.ipynb
which should open a new tab. The tab should look like the html-version of the notebook you looked at so far but is now fully functional, i.e. you can edit it and exectue code.
If you want to run this on your own computer you'll have to install Julia and install the packages IJulia
, NBInclude
, PyPlot
, LsqFit
, CSV
by running at the Julia prompt: using Pkg; [Pkg.add(s) for s in ["IJulia", "NBInclude", "PyPlot", "LsqFit", "CSV"]]
.
The important notebook commands are:
- clicking or double-clicking into a cell allows you to edit it.
- pressing shift+enter evaluates it: for a cell like the one you are reading now it renders the markdown, for code cells it evaluates the code and prints/displays the output of the last line of code. Use a
;
to supress the output. - variables and functions defined in one cell will be available for use in cells evaluated afterwards (irrespective of whether the cell is above or below).
- if you change a code-cell and re-evaluate it, the cells depending on its variables are not evaluated again automatically.
- somtimes it is good to re-start the computation and re-evaluated all cells. Go to drop down menu
Kernel -> Restart and run all
- there is undo with Ctrl-z.
- To insert a new, empty cell got to the menu
Insert
- To change the type of the cell use the drop-down menu which displays
Code
by default. - To export the notebook as a pdf, html, etc. got to drop-down menu
File -> Download as
. (Note, to save single figures, you can use the commandsavefig("example.png")
.)
Plots: to export plots it may be easiest if you right-click on it and choose "Save image as".
This notebook uses the Julia programming language, which is a new technical programming language. Its syntax is fairly close to Matlab and not far off Python, at least for easy stuff, to which I'll stick to here.
Notable differences to Matlab are:
- indexing is done with
[]
, e.g.a[3]
. - functions can be defined in-line and don't need their own m-file
Differences to python:
- indexing starts at 1
- indentation does not matter, instead blocks/functions, etc are closed with
end
.
Documentation for Julia can be found here. If you're interested to get started with Julia (which I can reccommend) have a look at these video tutorials, or above docs.
This page was generated using Literate.jl.