Exporting data from STASKAT


One method for getting STASKAT (Station Catalogue) data off the HIS (Hydrological Information System) is to use the HydroGIS project developed in ArcView 3.0a by J. Duvenhage at DWAF Head Office.
The Hydrology Directorate is the custodian of HydroGIS. Please contact J. Wentzel in Hydrology for more information.
Other ODBC applications, e.g. in Delphi, may exist to extract STASKAT data.

In the main View of HydroGIS, select the STASKAT stations theme.
Open the attributes table of this theme (Theme Table).
In Tables, go into the table properties and remove the check marks so that only the following are selected:


Export the theme as a comma-delimited (csv or txt) type of file, e.g. staskat.txt.
Using awk, convert the comma-delimited file to something that makes sense to the WaterMarque import routine. Below is an example:
BEGIN{FS=",";OFS=",";First=1;OFMT="%.8g";}
{
 if ( First == 1 )
 {
  First = 0;
 }
 else
 {
  lon = (substr($4,1,2)*1)+(substr($4,3,2)/60)+(substr($4,5,2)/3600)
  lat = -1*((substr($5,1,2)*1)+(substr($5,3,2)/60)+(substr($5,5,2)/3600))
  line = $1","$7" "$8" "$2" "$3","$9" "$10","lon","lat","$6","$11;
  a = gsub( " *,", ",", line );
  a = gsub( "  ", " ", line );
  print line;
 }
}
# Example of input data:
# ---------------------
#"Station/Gauging Point Number","Most Recent Description 1","Most Recent Description 2","Longitude","Latitude","Drainage Region","Measurements In/At 1","Measurements In/At 2","Place Name","Common Name","Province"
#A1H001,GAUGING WEIR,,255114,252721,A10,UPPER EYE DINOKANA,,DINOKANA,AT PUMP STATION,NW

Use this awk file as follows (assuming that the file is named staskat.awk):

awk -f staskat.awk staskat.txt > staskat.all

Select the water quality stations
STASKAT stores the data for all stations, including quality monitoring, flow gauging and evaporation measurements. Use the grep command to write only the water quality stations to a file:

grep QUALITY staskat.all | sort > staskat.dat