gwgen.parse_eecra module

Functions

extract_data(ids, src_dir, target_dir[, ...]) Extract the data for the given EECRA stations
parse_file(ifile[, year]) Parse a raw data file from EECRA and as a pandas DataFrame
gwgen.parse_eecra.extract_data(ids, src_dir, target_dir, years=[1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009], imonths=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])[source]

Extract the data for the given EECRA stations

This function extracts the data for the given ids from the EECRA data base stored in src_dir into one file for each id in ids. The resulting filename will be like id.csv.

Parameters:
  • ids (np.ndarray of dtype int) – The numpy integer array with the station ids to extract
  • src_dir (str) – The path to the source directory containing the raw (uncompressed) EECRA database
  • target_dir (str) – The path to the output directory
  • years (np.ndarray of dtype int) – The numpy integer array with the years to extract (by default, all years between 1971 and 2010)
  • imonths (np.ndarray of dtype int) – The numpy integer array with the months to extract (by default, all from january to december)
Returns:

The paths of the filenames corresponding to ids

Return type:

numpy.ndarray

gwgen.parse_eecra.parse_file(ifile, year=None)[source]

Parse a raw data file from EECRA and as a pandas DataFrame

Parameters:
  • ifile (str) – The raw (uncompressed) data file
  • year (int) – The first year in the data file
Returns:

ifile parsed into a dataframe

Return type:

pandas.DataFrame