Python#

Installing packages (Windows)#

Ok, we are presuming some previous knowledge, but to help you get past some hurdles experienced, see tips below:

  • If you try to run some code with an “import” line, and you get an error, this is likely because you don’t have the package installed (on your computer) and python is trying to load it.

Some packages you will need:

  • Gibbs Seawater Toolbox (GSW) - see installation instructions here

  • xarray - see installation for xarray and necessary other packages (dask, netCDF4, bottleneck). This is a very useful data format/package for netcdf files (many ocean/climate datasets).

  • pycnv - for importing Seabird format *.cnv datafiles

You may also need:

  • pandas - simpler than xarray. Avoid, but may be needed.

  • numpy - multi-dimensional arrays

  • matplotlib - plotting tools, similar to Matlab style

Potentially of interest:

  • ocean data parser - but only has pip install instructions here. If you’ve been using conda and you’d like to use pip instead, you can use conda to install pip. See some info here

Installing packages (Mac)#

Use pip install.

Environments#

More advanced: It’s best to work inside an environment. This controls the version of each of the packages that you have installed, so that the code is more likely to run smoothly on another person’s computer. Some background on conda environments.