planetwater

ground- water, geo- statistics, environmental- engineering, earth- science

Archive for October, 2012

Water Levels in New York City

with 3 comments

update Monday; October 29, 2012 3:18pm (CDT) Eric Holthaus at the Wall Street Journal has a more in-depth analysis for the coming hours


I’ve been following the unfolding Sandy in the last couple of days. I’ve been relying of many online sources. Since I don’t have anything original to say, I decided to wait with a post here until things have settled down a bit.

However, I wanted to share this one chart of the water levels at “The Battery NY” (original available here. It shows observed (red dots) vs. modelled (pink and green) water levels. Note that the current water level is (slightly) higher than predicted. This has been true for the last couple of high tides, but those had smaller peaks.

Water Levels in New York City

The coming hours will be critical! There is a high tide coming up, coinciding with the landfall of Sandy. Additionally there’s a mid-latitude trough just east of the Great Lakes that pulls Sandy onto the North American continent. Additionally, as if that wasn’t enough, the North Atlantic Oscillation is in a negative phase, pulling Sandy towards the North-East. Decent summaries can be found here and here.

Written by Claus

October 29th, 2012 at 9:09 pm

Posted in

Update on planetwater Calendar

with 2 comments

update Thursday; October 25, 2012 thanks to @wpworx I do have now a solution that works:

I resorted to a google calendar, which I will use to maintain planetwater.org relevant dates. Here are the advantages:

  • you can subscribe to the ics calendar using this url
  • It syncs to a dedicated Calendar page on planetwater.org, so readers on the blog should see what events are happening in the future (with some sync delay)
  • I have it setup in my Calendar so I can directly enter events there

Recently, the calendar plugin (“Event Calendar“) that I used to use within WordPress (WP), and that has worked reasonably well over the past few years has decided to not work anymore. This might be the reason why some posts were not visible in the last couple of days.

My requirements seem simple:

  • add/modify/delete posts
  • subscribe to the “posts” / “events” in iCal (or any other calendar app)
  • maybe, have access to a WP widget

The following list shows some of the solutions I played with:

Neither of these satisfied me. Some of are bloated, some don’t allow for the deletion of “posts”/”events”.

To me, of course, it seems like I don’t need or want anything fancy. But I just could not find online an existing possibility for WP. Can anyone help?

Right now, I have a version of “The Events Calendar” running, but there is not much there. For now, the old posts are stored, but not visible.

Written by Claus

October 24th, 2012 at 8:36 pm

Posted in

Python: How to start and how to make python(x,y) work with ArcGIS 10

without comments

In the end, it comes down to finding a little project and you have to figure stuff for yourself on the way. My hope is that this write-up saves you some time with technicalities.

My python setups are different between my mac and my windows machine — on windows I am largely limited by the python version that ESRI imposes with Arc10. On my mac, there is no such thing. The link between ArcGIS and me is still existent from my M.Sc. work. A side project back then was to build a calibration tool that is not only based on point measurements. Instead, the goal was to get the general hydraulic head surface in the two main aquifers reasonably right. Back then I delved into VBA, and it worked. Back then we were using Arc 8.0, and the inclusion of python in Arc was just starting (and numpy either didn’t exist or I didn’t know about it). I am still not very happy with the implementation of python in ArcGIS, but it is one of the reason, why I keep 2.x versions around. A current ESRI view is expressed here and in these pdf slides

Python

There are several python versions out there. The big distinction is between versions 2.x and 3.x. Obviously, 3.x is newer, but a lot of packages (“modules”) are compatible to 3.x yet. Hence, I would suggest, for now, to stick with 2.x — currently, I use 2.7.3. on the mac and 2.6.x on windows

Where do I get the installer from?

Python is open source, and basically, you can get an installer right from the python homepage. Probably, this is a smart way to do. Even smarter it would probably be to download the source and compile it directly on your machine. But, we are no computer scientists. Plus you will need a few more packages (“modules”), despite the fact that python comes with “batteries included“, i.e. a lot of powerful possibilities within the standard library (the “pure” version that you can install from python.org).

To facilitate, there are a few people/organisations who provide packaged “python distributions”, which are updated in certain intervals. However, if you always want the bleeding edge version of a module, you can’t go that path.

I use the “Enthought Python Distribution” (EPD) on the mac, which is free for educational use. On windows, a good way to go is probably pythonxy. Other options on the mac include the Scipy Superpack or a combination of homebrew and pypi installs.

Installation with ESRI Arc10

I found that this hack works for me. It is based on information that I collected on various webpages (sorry for lack of reference here). I am sure there are other/better solutions. Please let me know! 😉

  • install ArcGIS 10 WITHOUT python (unfortunately, this could mean to de-install it first completely)
  • install python(xy) 2.6.6.1 in C:\python26 (download)
  • create a file that is called Desktop10.pth, and put the following three lines (ASCII) into that file:
    C:\Program Files (x86)\ArcGIS\Desktop10.0\bin
    C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy
    C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Script

  • copy that file into the directory C:\python26

Where to write code (IDEs)

For windows, this is a no-brainer, because it is so awesome: pyscripter. On other OSes, I use eclipse, with the pydev plugin.

Packages (“Modules”)

  • Numpy: numerical library (“numerical python”): read from files directly into arrays, matrix algebra, basic stats — this is so awesome and so much fun! This page will be your best friend!
  • Scipy: the sister of numpy — “scientific python”: all kinds of goodness: optimizers, fft, all kinds of statistics, image processing
  • matplotlib: make awesome plots straight out of python (similar to matlab); somewhat limited still to 2D, even if 3D is possible
  • pandas: if you ever have to deal with data that has time stamps – use pandas!
  • basemap: In the last little while I have dealt mostly with rasters, and it is quite easily possible to display them in matplotlib using the command “imshow”. For more advanced mapping related stuff, basemap might be an option (check out their gallery)

There are many, many more. And you can write your own packages (such as copyla)

Where to start

I think the best starting point is the python tutorial. After this I would go to the scipy/numpy/matplotlib “lecture notes“. Andy Terrel has put together a good resource page, but I think it is a bit advanced.

Books

There are many books. Generally, I read through parts of I think all the o’reilly ones, and I can recommend them, even if I don’t own any. I do own the one by John Zelle, which I enjoy, but it covers general computer science concepts, using python, but it is not really ideal to learn python. Geoff has one of the Langtangen books, which are all very good. Generally, there is so much information available online, that I find books become more and more obsolete.

Written by Claus

October 24th, 2012 at 5:21 am

Posted in