This website contains a small collection of code I've written over the past months. I've put this primarily online, so students can check solutions they are currently working on themselves, but also to show them what might be possible and most of all encourage them to start writing their own little programs (trust me, Python is fun :)

Of course everyone else is happily invited to take a look at the code or even use it in parts or its entirety.


Disclaimer

However, I want to emphasize that I'm not a professional programmer. As such, many might see this code as being ugly, over-comlicated, redundant or cumbersome. I'll still give my best to follow the Zen of Python wherever it is possbile.

In parts I've used the work of people smarter than me. I've thoroughly tried to highlight wherever lines of code or thoughts have not originated from my own brain. If you still find passages that are clearly not my own, I'll immediatly change this and will add the proper references!


Info

On the right side I will publish a list of small programms when I have the time. On this mainpage I will additionally post a short summary what each of these scripts acutally does. This, and often more information, is also found in the header of each script. Important lines within the script feature further documentation and comments. I've tried to write these scripts entirely in english, though I cannot guarantee that some variables or expressions will still use some german. Each script should run as is, i.e some basic functions will appear identical in several scripts.

If not mentioned otherwise, all scripts have been created using Python 3.4 . Apart from the known limitations when these are run using Python 2.x, this also means, that I had to refrain from using arcpy. Parts of the code that handle geographic data data therefore employ GDAL bindings. I will possibly add some scripts using arcpy in due time, however I will highlight the use explicitely.


List of Scripts


  • CopyFiles.py actually 2 different scipts, used to copy data. One copies files from many subfolders to one main folder and the other from one main folder to many non-existing subfolders (rahter specific for monthly data)

  • HDFtoTIF.py converts rasters from HDF to GeoTiff format

  • extXLS.py short example how to read sinlge lines of data from Excel. This is to show you, how Python can easily be used to write Excel scripts/makros

  • Landsat.py Uses original *.tar.gz of earthexplorer as input. Then calculates radiation and TOA reflectance, if chosen calculates up to 7 different indices and automatically accounts for Landsat 5, 7 or 8

  • LinReg.py Calculates a linear correlation at each pixel location between two sets of rasters (e.g. precipitation and NDVI). This script ewas explicitely written to account for raster sets of different coordinate systems, extent and resolution

  • Mann_Kendall.py Calculates the p-Value of a Mann-Kendall trend analysis of a list of values

  • TSA.py Calculates at each pixel location in a raster set the linear trend coefficients for the raster values and continuous time steps as well as the Mann-Kendall p-Value

  • zipBILtoTIF.py converts raster from within a zip-File from BIL to GeoTIFF format





Last Updated:17-March-2016