These are some notebooks and the material used by the Python for Engineers course.
One of the questions that came up was what the preferred way is to install python on OSX. This was related to some recent problems that people had with the latest version of OSX. Some of the issues that you can run into while installing extra packages are a missing png library issue and missing compilers .
Some of the options you have under OSX are, in my personal order of preference:
- Install macports. Then install matplotlib sudo port install py27-matplotlib.
- Install homebrew. Then install python, then matplotlib using pip pip install matplotlib.
- Get the enthought python distribution (now called Canopy).
- Get the continuum distribution.
You probably don't want to use the python version that comes preinstalled with OSX. Using one of the other options keeps your python environment separate from your system environment and you'll have a more recent python version.
You can also use virtualenv to use multiple different python environments.
This is an example of how to use the sealevel R package. This package is part of OpenEarth and available through r-forge for the convenience of R users. See Trends in Sea-Level Trend Analysis for a discussion on sea-level trend analysis.
This example generates an overview of tide gauges near Jakarta and generates a plot of the measurements of the nearby stations.
I just made the sealevel R package, which we used for the sea-level rise articles, available. It provides some functions to quickly download, read and analyse the global tide gauges and satellite data.
All suggestions, patches, comments are welcome. This package is part of OpenEarth but available through r-forge for the convenience of R users.
- Trends in Sea-Level Trend Analysis
- The Effect of the 18.6-Year Lunar Nodal Cycle on Regional Sea-Level Rise Estimates
The code below generates the plot of the Dutch tide gauges.
Notice that after the last 6 years of (average) sea-level decline we are about to see a rising sea level at the Dutch coast again for the next 12 years.
This presentation was given at the Deltares statistics community lunch lecture. It discusses some best and worst practices in estimating sea-level rise. The presentation is based on two articles:
Please find the EGU Aeolian transport presentation in the attachments.
If you want to compile the coupled version of Dune and XBeach under windows you need the following.
- Cygwin (including gfortran, gcc, libtool, automake, libfftw3-devel, libfftw3)
- MPICH2 source code release
- netcdf>=4.1 source code
- The following XBeach branches:
You can follow these steps:
- Install cygwin
- Compile MPICH2 using gfortran and make install (check if mpif90 is available)
- Compile netCDF using gfortran and make install (check if nc-config is available)
- Compile XBeach (--with-netcdf --without-mpi, mpi is not supported yet ), should generate a file called libxbeach.la
- Compile dune in branches/dune/Muller (should generate a file called libdune.la)
- Compile esmf (use settings like in settings under condition wl01485) (should generate a file called esmf.mod)
- Compile XD_XB_Coupling (double check the Makefile.am, to see if it uses the correct locations for the libraries that were made in the previous steps). (should generate a file called xdunexbeach)
Setting up a simulation:
- Create a directory with both dune and xbeach input (default.par, data/, params.txt)
- Create a coupler setup file (see examples in coupler directory)
- run xdunexbeach from the current directory.
Run the command path/to/xdunexbeachdir/libtool --mode=execute gdb path/to/xdunexbeachdir/xdunexbeach.
If you want to give your plots a bit of a high tech look you can use a green phosphor style.
Let's try and create some illuminated storm tracks. The basic technique is to draw a line with a glow around it. This can be done by plotting transparent lines on top of each other. Below you see the basic glow effect. It is a bit exaggerated but it still looks ok.
Now make the lines a bit smaller.
When you create more than about 1000 lines there's no need to add the background lines anymore.
I got the dataset from NOAA
Calling fortran from the outside world. Using iso_c_bindings this is a bit easier. Here you can find some fortran examples and see how you can call these functions from python using ctypes and numpy.
The fortran code.
The corresponding python code.
The following paper was just published in NHESS. It was a cooperation between TUD, Deltares and TNO.
Abstract: For the design of cost-effective coastal defence a precise estimate is needed of the 1/10 000 per year storm surge. A more precise estimate requires more observations. Therefore, the three greatest storm surges that hit the northern part of the Holland Coast in the 18th century are reconstructed. The reconstructions are based on paintings, drawings, written records and shell deposits that have recently appeared. The storm-surge levels of these storms have been estimated using numerical modelling of the coastal processes. Here we show how these reconstructions can be used in combination with extreme value statistics to give a more confident estimate of low probability events.
This is the presentation I gave at the mini symposium. I discussed the trends in sea-level trend analysis.
I'm currently working on the XDune XBeach coupling.
The test case, which Jaap set up, is located at https://repos.deltares.nl/repos/XBeach/branches/XD_XB_coupling/tests.
The following tasks can be separated:
- Create an XBeach library https://repos.deltares.nl/repos/XBeach/branches/fedortmp
I plan to merge this into the trunk, but it would be convenient for maintenance if we'd merge the libxbeach.F90 and xbeach.F90 and apply the library by default approach (xbeach.F90 depends on libxbeach.F90).
- Create an XDune library https://repos.deltares.nl/repos/XBeach/branches/dune
We still have to merge back changes to the main dune line, for better cooperation with the dune people. I have to check the revision and what Martijn Muller checked in.
- Create a fortran and c compatible interface for XBeach. The libxbeach wrapper exposes all functions using iso_c_binding. The most incovenient of this is that you have to pass the string length to character functions, not sure how to prevent this.
- Create a fortran and c compatible interface for XDune (https://repos.deltares.nl/repos/XBeach/branches/dune). I first created a simple c compatible library (wrapper.cc) but found that the trick I used for exposing pointers to c++ classes (as part of a c structure) was not compatible with fortran. I switched to a version with a global model and global parameters. This is ugly but I have not figured out a better way yet.
- Create an ESMF wrapper for XBeach (gridded component) https://repos.deltares.nl/repos/XBeach/branches/XD_XB_coupling/esmf_xd_xb_coupler I created a gridded component earlier. It seems to work fine. I moved it from the xbeach directory to the xd_xb coupling directory to keep all esmf specific code together and out of the XBeach trunk.
- Create an ESMF wrapper for XDune (gridded component) https://repos.deltares.nl/repos/XBeach/branches/XD_XB_coupling/esmf_xd_xb_coupler. I have implemented most of the code. The only part that is missing is the grid. I have to look into how the grid is defined and map that to the ESMF types.
- Create a coupler https://repos.deltares.nl/repos/XBeach/branches/XD_XB_coupling/esmf_xd_xb_coupler The coupler and app are running. Features that are missing are configurable time, output and timestep definitions
- Test data exchange. I'm still missing the grid of dune so I can't match the grids. I'm discussing with ESMF user mailling list on how to best implement the rotating grid.
- Test timestep. Timesteps of both Dune and XBeach align (tested for cases where dune has timesteps >= esmf timestep)
- Test on h4 (not done)
There was no latex style file available for the Journal of Coastal Research. Below you can find a .bst file that you can use to format your bibliography in the style of JCR.
You can use the file like this:
The file is made using the jcr.dbj file that is also attached. If you want to make some changes, change the jcr.dbj file and call:
This will result in a new jcr.bst file.
For formatting the rest of the latex file you'll also need the following macros:
After using this your paper is pretty much well formatted, except from some details in section header formatting. I didn't know how to fix these so I did those by hand.
This is the presentation that I gave at the FOSS4G 2011 conference.
- http://www.openearth.eu the tools
- http://www.xbeach.org the XBeach model
- http://oss.deltares.nl the Delft3D model
- http://geoserver.org WCS server
- http://geoservices.knmi.nl/adaguc_portal/index.html Adaguc (WCS server + more)
- https://bitbucket.org/SiggyF/html5overlay the html5 overlays used.
- http://opendap.org/ opendap protocol + hyrax opendap server
- http://www.unidata.ucar.edu/projects/THREDDS/ thredds opendap server
- http://pydap.org/ pydap opendap server