planetwater

ground- water, engineering, science, geo- statistics

Archive for 2012

Spaghetti Plots with LineSegments in Matplotlib

without comments

I recently found out about “LineSegments” in Matplotlib. They allow you to plot “Spaghetti-Plots” fairly easily, without looping in the figure and with comfortable assignment of properties such as color or line thickness.

Beispiel Spaghetti Plot

def plot_LineSegements(x, ys, ylim=[0.0,1.0], label_str='', linewidth=2.0, linestyle='solid', cm='copper' outOS=None):

# set the plot limits, they will not autoscale
ax = plt.axes()
ax.set_xlim((x.min(),x.max()))
ax.set_ylim(ylim)

# colors is sequence of rgba tuples
# linestyle is a string or dash tuple. Legal string values are
#          solid|dashed|dashdot|dotted.  The dash tuple is (offset, onoffseq)
#          where onoffseq is an even length tuple of on and off ink in points.
#          If linestyle is omitted, 'solid' is used
# See matplotlib.collections.LineCollection for more information
line_segments = LineCollection([zip(x,y) for y in ys], # Make a sequence of x,y pairs
                                linewidths    = linewidth,
                                linestyles = linestyle,
                                cmap=plt.get_cmap(cm))
line_segments.set_array(np.arange(np.array(ys).shape[0]))
ax.add_collection(line_segments)
fig = plt.gcf()
axcb = fig.colorbar(line_segments)
axcb.set_label(label_str)
ax.yaxis.grid(color='gray', linestyle='dashed')
ax.xaxis.grid(color='gray', linestyle='dashed')
ax.set_axisbelow(True)
plt.sci(line_segments) # This allows interactive changing of the colormap.
if outOS == None:
    plt.show()
else:
    plt.savefig(outOS)
    plt.clf()

Written by Claus

May 16th, 2012 at 2:49 pm

Posted in

Interesting Bits from ESRI / GIS

without comments

I just came across two interesting pieces related to GIS (from ESRI). The one shows how to use a National Geographic style representation of a somewhat combined political and geographical representation. The other one is a case study of a web-based tool (including some numerical groundwater modelling) for authorizing well permits.

 

- National Geographic style basemap: http://bit.ly/HAn3vb

Representation in National Geographic style of countries in Europe

-  Web-based Automated Well Permitting: http://bit.ly/HAndCM

- ESRI seems to have released some elevation data, and hydrology related data, mostly in the US, and I haven’t checked (just read the blog entry) – http://bit.ly/HzXSJu

 

 

Along similar lines, Microsoft seems to have created a space/time visualization tool called “layerscape” – http://bit.ly/HzXmLE

 

Written by Claus

April 11th, 2012 at 3:59 pm

Posted in

AGU Fall Meeting 2012

without comments

December 3, 2012toDecember 7, 2012

as usual in San Francisco, Moscone Center

Written by Claus

March 24th, 2012 at 10:42 am

Posted in pwtermine

GeoENV IX

without comments

September 19, 2012toSeptember 21, 2012

Conference on Geostatistics for environmental applications

homepage

Written by Claus

March 5th, 2012 at 1:57 pm

Posted in pwtermine

End of Abundance

without comments

“The End of Abundance: economic solutions to water scarcity” is another book about water, particularly drinking water, its shortages and associated problems. Do we need yet another book on that topic?

After I finally got around to read it, I think yes, because it offers some (to me) novel thoughts, that incorporate some basic economic thinking.

Water exists on earth in a constant amount. This amount cycles through the water-cycle at various rates. At some places the amount of available drinking water has been or is shrinking. David Zetland’s book tries to tackle this problem from an economic perspective.

… the real solution to the end of abundance requires that people abandon hard-won traditions that embody decades of distilled experience in exchange for novel ideas and unknown future benefits. A stable institution from one perspective may be rigid from another perspective, but institutions need to evolve with circumstances. In the case of water, good institutions prevent shortage, allowing valuable uses today while saving for tomorrow. Bad institutions make shortage more likely; they can turn abundance into scarcity faster than you can say empty reservoir. What forces a water manager to change the way his organization manages its water? Not much. In most parts of the world, water service is provided by a monopoly, which means each organization chooses how to serve its local customers without fear of competition. [...] The end of abundance means water managers [...] need to either increase supply or reduce demand. Although additional supply can be expensive, the bigger headache comes from allocating the cost of new supply among customers who claim others should pay more. Reducing demand is even harder, since it requires rationing.

End of Abundacne

Photo by VinothChandar – http://flic.kr/p/7Jcr9c

 

Changing a current situation, or changing a current behaviour is difficult. The situation regarding availability of drinking water might be comparable to the problem of climate warming. Some people say capitalism is not useful to lead to necessary change or else the effects of climate change are too detrimental. David Zetland’s book offers some useful thoughts of how thinking along some economic principles might lead to change. I do think that it is not along “big” economic concepts such as free trade or financial speculation. Zetland’s thoughts are more along the lines of local economics.  I would even go as far as saying that his economic thoughts are as simple as thinking through scenarios of what could happen if I paid that amount or an extra amount on the good x at time t , and not a different amount on a different good. This approach gets interesting, when you’re trying to think about the effects on other goods or the same good at different times, at different locations.

David Zetland even writes that such a locally-based approach

[...] reflects water’s local origins and the difficulty of transporting water over long distances. Good water management requires that one understand local customs and solutions while looking for outside ideas that can  be modified and implemented with a creativity that drives at the goal while bending to social, economic and political realities.

This might be the reason why these economic principles are explained with fairly simple graphs. Still, this type of thinking helps to think into different directions that might be useful in the attempt to avoid shortages. When do such shortages occur? David Zetland defines the end of abundance multiple times:

  • The end of abundance is the same as the beginning of scarcity, but scarcity (falling supply and increasing demand) need not lead to shortage.
  • The end of abundance for freshwater means we have to pay more attention to protecting our drinking water and the environment. Our definition of dirty is changing, our rules for discharge are changing, and our perspectives on local and distant are changing. Europeans try to reduce dirty water with regulations. Americans put more emphasis on market solutions (cap and trade of emissions) while also relying heavily on regulations. The end of abundance has a stronger impact on people in developing countries because they have less money and worse institutions
  • The end of abundance (and rise of nasty chemicals) means sludge remaining after primary and secondary treatment is more of a liability than an asset.
  • The end of abundance means prices based on cost need to be upgraded to include scarcity charges. Scarcity-based prices may not keep people from wasting water on lifestyle habits, but they will prevent shortages and ensure that people pay the full cost of their choices.
  • The end of abundance means the supply side/cost recovery model of water management no longer delivers the results we want, but that model still dominates the business — from California to China, Florida to Fiji — and it will cause trouble until we change the way we manage
  • Perhaps the greatest irony in the water business is that the solution to shortage — more supply — often comes from somewhere else at someone else’s expense. The end of abundance results when somewhere else runs out of water.

 

There are many beautiful thoughts in this book that are well worth a discussion. I am going to list three concepts related to water pricing that have been new to me and that I found very interesting:

  • zero net tax (ZNT): consider, for example, an industry whose lobbyists argue against a tax on pollution — claiming that it will destroy jobs, kill babies, open the borders to invasion, and so on. Their lobbying can be overcome by replacing a tax per unit of pollutant with a “zero net tax” (ZNT) that works by measuring average pollution per unit of output, taxing companies that issue above-average pollution, and rebating those tax revenues to below-average polluters (taxes and rebates rise with distance from the average).
  • “Some for Free”. The idea is based on four steps. First, every household pays a service charge equal to the fixed cost of the water connection. Second, the number of people in the household determines how many units of cheap (or free) water the house receives. Third, the price of additional units is set high enough to reduce demand and prevent shortages, not cover costs. Fourth, excess revenue is rebated per capita.
  • Smart Meters: After installing meters, it’s important to think about how often customers see their bills. It’s hard to change behavior when water bills and usage statistics arrive quarterly or annually. Monthly billing is good, but real-time statistics on consumption and volumetric charges give the strongest signals to conserve. Smart meters that measure and display real-time consumption are more expensive to install and operate because they require wireless communications networks to relay data and replace older, simpler meters that last for 30–50 years

For this review I picked three examples that were interesting to me. The book is full of examples, that are worth reading, and would be worth discussing! The combination with the real-world water-related examples and some basic economic theory accomplishes the goal of  how to gain and maintain that balance [between supply and demand] using economic tools to allocate scarce water in a way that minimizes costs, maximizes value and reflects local values. If I had a wish, than it would be to deepen the economic concepts a little more.

Details on the book:

The End of Abundance: economic solutions to water scarcity

by David Zetland

homepage of the book

 


Written by Claus

February 27th, 2012 at 8:45 am

Posted in

EuroSciPy 2012

without comments

August 23, 2012toAugust 27, 2012

Brussles

http://www.euroscipy.org/blogentry/6551

Written by Claus

February 23rd, 2012 at 5:14 pm

Posted in pwtermine

Discussion Sites – Where to Find Answers

without comments

It seems not so long ago that I learned the basics of latex on comp.text.tex (btw. Unison is an awesome newsreader). Then came google.groups, and then came just google.

However, recently, I found that a certain category of “search sites” has surfaced. Which seem to be more attractive than the good old usenet. Not sure why. Maybe it’s because you can collect “points”. There are two sites which I started to find interesting:
mathoverflow and stackExchange.

There are really interesting questions being asked and answered:

– What are the examples of situations where “randomizing” a problem (or some part of it) and analyzing it using probabilistic techniques yields some insight into its deterministic version? – see here

or

– What are the big problems in probability theory? – see here

At stackExchange there are even groups:

stats “Cross Validated”

scicomp “Computational Science” (Beta – that’s why it looks “sketchy”)

apple

tex (but don’t forget comp.text.tex!)

 

update Saturday; January 14, 2012:

Just shortly after I wrote this, I found out that there’s a little discussion taking place on math overflow about “the Gaussian”

 

update Sunday; February 12, 2012:

PyDev forums switched to StackOverflow

Written by Claus

January 11th, 2012 at 12:39 pm

Posted in

Identi.ca Weekly Updates for 2012-01-11

without comments

Written by Claus

January 11th, 2012 at 11:11 am

Posted in identi.ca

geoEnv 2012

without comments

September 19, 2012toSeptember 21, 2012

geoEnv 2012 Valencia

homepage

Written by Claus

January 6th, 2012 at 10:17 am

Posted in ,pwtermine

EGU Meeting Vienna

without comments

April 22, 2012toApril 27, 2012

European Geosciences Union General Assembly 2012 Vienna | Austria | 22 – 27 April 2012

homepage

The EGU General Assembly 2012 will bring together geoscientists from all over the world into one meeting covering all disciplines of the Earth, Planetary and Space Sciences. Especially for young scientists, it is the aim of the EGU to provide a forum where they can present their work and discuss their ideas with experts in all fields of geosciences. The EGU is looking forward to cordially welcoming you in Vienna.

Written by Claus

January 6th, 2012 at 10:15 am

Posted in pwtermine