A+ A A-

CHPC National meeting 2011

15 June 2011

Dear colleagues,

The Centre for High Performance Computing (CHPC) invites you to attend its 2011 National Conference themed: Better HPC and data-curation adoption, better research and industrial development.

CHPC 2011 will be held from 7–9 December 2011 at the CSIR International Convention Centre (ICC), in Pretoria.


The CHPC is one of the major pillars of the Department of Science and Technology’s cyberinfrastructure initiative and aims to increase South Africa’s competitiveness through promoting the adoption of high performance computing (HPC) and data technology tools across all sectors. With this vision in mind, the CHPC endeavours to promote a multi-array of vibrant and productive computational research communities alongside experientialists.

CHPC 2011 aims to explore the contributions and expectations of policy makers, research communities, information communications vendors, industry and academia through a series of contributed and invited papers, presentations and open discussion forums. Both local and international stakeholders and key players will have the opportunity to harness synergies in an effort to promote and appreciate the role of cyberinfrastructure in the advancement of science and engineering in South Africa.

The conference will contain numerous domain-specific breakaway sessions and will be followed by advanced tutorials in high-level HPC tools and applications.

IMPORTANT DATES:

Launch of conference website: 18 July 2011

Opening of registrations: 18 July 2011

Opening call for contributions: 18 July 2011

PLEASE NOTE: Contributions include papers, posters and exhibitions.

For more information, e-mail:

    Noxolo Moyake
    Communications Strategist, CHPC
  Nox contact email address

Last Updated on Tuesday, 24 July 2012 18:18

Hits: 163

Neil Hart

Below are links to the files used in this tutorial

Python scripts:


NetCDF files:

Last Updated on Tuesday, 31 July 2012 15:06

Hits: 138

Nicolas Fauchereau

Last Updated on Tuesday, 31 July 2012 14:49

Hits: 144

Plotting: Maps

This tutorial:

File I/O: Reading ASCII data

Plotting: time-series

File I/O: Reading binary data

Plotting: Maps

 

In this tutorial, we will plot the TMI / TRMM data we read in Tutorial 3. For all plotting purposes I use the matplotlib package. The matplotlib package is very easy to learn for matlab users. Most of the methods in matplotlib use the same syntax as those in Matlab. For example, contour plots can be done with the contour method. Filled contour can be plotted with contourf and vector plots can be drawn with the quiver function, just like in Matlab. I strongly encourage you to visit the matplotlib page. In particular the Gallery page from matplotlib is very useful. In there you will find example of pretty much all the plots you are ever going to need.

To plot maps, we will use the Basemap package. Basemap is a matplotlib addon toolkit which makes it easy to project and map 2-dimensional data. Once you have installed basemap, you can use the same functions as in matplotlib (plot, quiver, contour, contourf) to plot your data on maps.

Ok. So let'd get started by loading in the TMI/TRMM data using our previously defined readTmi1D function. Then we will plot the SST.

from courseFunctions import readTmi1D
pname = ""
fname="tmi_20100909v4"
# We read the sst collected during the ascending path
lon,lat,sst = readTmi1D(pname+fname,0,1)

Let's import the Basemap package:

from mpl_toolkits.basemap import Basemap

We now need to decide which map projection we would like to use. There is a long list of projections available on the Basemap package which can be seen in the Basemap help.

help(Basemap)

The default value for the projection is "Cylindrical Equidistant", which actually does not change your lat and lon at all. The first thing to do is to define the map projection. For this we need to specify the longitude and latitude boundaries of our map.

# Region definition (Agulhas) minLon = 16
maxLon = 35
maxLat = -20
minLat = -43
# Base Map set-up with Mercator projection

m = Basemap(llcrnrlon=minLon, \
llcrnrlat=minLat, \
urcrnrlon=maxLon, \
urcrnrlat = maxLat, \
resolution = 'h', \
projection = 'merc', \
lon_0 = minLon+(maxLon-minLon)/2, \
lat_0 = minLat+(maxLat-minLat)/2)

My data will be plotted on a Mercator grid. I have defined my map boundary using the region definition. The resolution for the Map data is set to high. This gives better defined coastline, countries etc.... Let us draw a contour of the coastlines and fill in a color for the continent and lakes.

m.drawcoastlines()
m.fillcontinents(color='beige',lake_color='aqua')

Let us add some rivers in a thin blue line.

m.drawrivers(linewidth=0.2,color='b')

Let's define parallels and meridian lines every 5 degrees and plot them on the map.

# Import all functionality of numpy package from numpy import *
# Define parallels anf meridians
parallels = arange(floor(minLat),ceil(maxLat),5.0)
meridians = arange(floor(minLon),ceil(maxLon),5.0)

Now that we have set-up the map, we want to plot the SST data we have read from before. I use the pcolormesh function of matplotlib to do that. It is like pcolor except much faster (equivalent to pcolor with shading flat option in Matlab). To plot on the map I have just laid out, I must project my longitude and latitude arrays to my map projection.

mlon, mlat = m(*meshgrid(lon,lat))

pcolormesh does not handle the NaNs in my data so I must mask my sst using the ma (Masked Array) module of numpy.

sst_masked = ma.masked_where(isnan(sst),sst)
m.pcolormesh(mlon,mlat,sst_masked,vmin=10,vmax=30)

vmin and vmax specify the SST range I want my color axis to span. We can check that by displaying a colorbar().

colorbar()

By default, the plot colormap will be set to the rainbow colormap. There are a lot more colormaps available from matplotlib and basemap. Here are links to images of the matplotlib and Basemap color tables. We are now going to use a colormap from the Basemap package called GMT_wysiwyg.

from mpl_toolkits.basemap import cm
colormap = cm.GMT_wysiwyg
# Make masked values white
colormap.set_bad('w', 1.0)
m.pcolormesh(mlon,mlat,sst_masked,cmap = colormap,vmin=10,vmax=30)
title('SST plot') colorbar()

You can download the example code from: plotTmi.py file

Go to top of page

Last Updated on Monday, 06 August 2012 17:21

Hits: 386

Documentation for users:

CHPC Student Cluster Competition 2013

Tsessebe Cluster Available

Graphical Processing Unit Cluster Available

CHPC SAGrid Cluster Available

Dirisa Storage Unit Available

Social Share

FacebookTwitterGoogle BookmarksLinkedin

Website developed by Multidimensions