gme.ind.kp

Module: gme.ind.kp

Classes:
Functions:
class gme.ind.kp.kpDay(ftpLine=None, year=None, dbDict=None)[source]

a class to represent a day of kp data. Extends gme.base.gmeBase.gmeData Insight on the class members can be obtained from the NOAA FTP site

Members:
  • time (datetime): an object identifying which day these data are for
  • kp (list): a list of the 8 3-hour kp values fora single day. The values are in string form, e.g. ‘3-‘, ‘7+’, etc.
  • kpSum (int): the sum of the 8 3-hour kp averages
  • ap (list): a list of the 8 3-hour ap values fora single day.
  • apMean (int): the mean of the 8 3-hour ap averages
  • sunspot (int): the international sunspot number
  • info (str): information about where the data come from. Please be courteous and give credit to data providers when credit is due.

Note

If any of the members have a value of None, this means that they could not be read for that specific date

Methods:
  • parseDb()
  • toDbDict()
  • parseFtp()
Example:
emptyKpObj = gme.ind.kpDay()

written by AJ, 20130123

parseFtp(line, yr)[source]

This method is used to convert a line of kp data read from the GFZ-Potsdam FTP site into a kpDay object. In general, users will not need to worry about this.

Belongs to: gme.ind.kp.kpDay

Args:
  • line (str): the ASCII line from the FTP server
  • yr: (int) the year which the data are from. this is needed because the FTP server uses only 2 digits for their year. y2k much?
Returns:
  • Nothing.
Example:
myKpDayObj.parseFtp(ftpLine,2009)

written by AJ, 20130123

gme.ind.kp.mapKpMongo(sYear, eYear=None)[source]

This function reads kp data from the GFZ Potsdam FTP server via anonymous FTP connection and maps it to the mongodb.

Warning

In general, nobody except the database admins will need to use this function

Args:
  • sYear (int): the year to begin mapping data
  • [eYear] (int or None): the end year for mapping data. if this is None, eYear will be sYear. default=None
Returns:
  • Nothing.
Example:
gme.ind.mapKpMongo(1985,eTime=1986)

written by AJ, 20130123

gme.ind.kp.readKp(sTime=None, eTime=None, kpMin=None, apMin=None, kpSum=None, apMean=None, sunspot=None)[source]

This function reads kp data. First, it will try to get it from the mongodb, and if it can’t find it, it will look on the GFZ ftp server using gme.ind.kp.readKpFtp()

Args:
  • [sTime] (datetime or None): the earliest time you want data for. if this is None, start time will be the earliest record found. default=None
  • [eTime] (datetime or None): the latest time you want data for. if this is None, end Time will be latest record found. default=None
  • [kpMin] (int or None): specify this to only return data from dates with a 3-hour kp value of minimum kpMin. if this is none, it will be ignored. default=None
  • [apMin] (int or None): specify this to only return data from dates with a 3-hour ap value of minimum apMin. if this is none, it will be ignored. default=None
  • [kpSum] (list or None): this must be a 2 element list of integers. if this is specified, only dates with kpSum values in the range [a,b] will be returned. if this is None, it will be ignored. default=None
  • [apMean] (list or None): this must be a 2 element list of integers. if this is specified, only dates with apMean values in the range [a,b] will be returned. if this is None, it will be ignored. default=None
  • [sunspot] (list or None): this must be a 2 element list of integers. if this is specified, only dates with sunspot values in the range [a,b] will be returned. if this is None, it will be ignored. default=None
Returns:
  • kpList (list or None): if data is found, a list of gme.ind.kp.kpDay objects matching the input parameters is returned. If not data is found, None is returned.
Example:
import datetime as dt
kpList = gme.ind.readKp(sTime=dt.datetime(2011,1,1),eTime=dt.datetime(2011,6,1),kpMin=2,apMin=1,kpSum=[0,10],apMean=[0,50],sunspot=[6,100])

written by AJ, 20130123

gme.ind.kp.readKpFtp(sTime, eTime=None)[source]

This function reads kp data from the GFZ Potsdam FTP server via anonymous FTP connection. This cannot read across year boundaries.

Warning

You should not be using this function. use readKp instead.

Args:
  • sTime (datetime): the earliest time you want data for
  • [eTime] (datetime or None): the latest time you want data for. if this is None, eTime will be the end of the year of sTime. default=None
Returns:
  • kpList (list or None): if data is found, a list of gme.ind.kp.kpDay objects matching the input parameters is returned. If not data is found, None is returned. default=None
Example:
import datetime as dt
kpList = gme.ind.readKpFtp(sTime=dt.datetime(2011,1,1),eTime=dt.datetime(2011,6,1))

written by AJ, 20130123

gme.ind.kp

alias of gme.ind.kp

Previous topic

gme.ind.ae

Next topic

gme.ind.omni

This Page