SWDatabase
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Variables
fetchevent.fetch_solarmonitor_noaaevent Namespace Reference

Variables

string help_message
 
tuple date_begin = module_common.utc_today-datetime.timedelta(days=31)
 
tuple date_end = datetime.datetime(module_common.utc_today.year+1,12,31)
 
 last_data = False
 
 first_data = False
 
 download = True
 
 verbose = False
 
string fetch_type = 'SOLARMONITOR_NOAAEVENT'
 
list local_dir = interface_fetch_event.fetch_info[fetch_type]
 
list table_name = interface_fetch_event.fetch_info[fetch_type]
 
tuple log_name = os.path.join('logs','fetch_event_solarmonitor_noaaevent_' + '%04d'%(module_common.utc_today.year) + '%02d'%(module_common.utc_today.month) + '%02d'%(module_common.utc_today.day))
 
tuple log_id = open(log_name,'a')
 
tuple itime = module_timespace.Time()
 
tuple logs = database_event.init_db(database_event.database_path,1)
 
string message = '... Connecting to and reading solarmonitor.org website...'
 
tuple server = interface_fetch_event.connect_remote_server(fetch_type)
 
tuple all_remote_files = interface_fetch_event.read_remote_server(fetch_type,server,date_min=date_begin,date_max=date_end)
 
list pattern = interface_fetch_event.fetch_info[fetch_type]
 
tuple metafile = interface_fetch_event.MetaFile()
 
list remote_files_fm1 = [ all_remote_files[-1] ]
 
tuple to_be_downloaded = interface_fetch_event.vn2vnp1(remote_files_fm1,fetch_type,-1)
 
list downloaded_files = []
 
list remote_files_f0 = []
 
tuple metafile_f0 = interface_fetch_event.MetaFile()
 
tuple to_be_f1_fetched = interface_fetch_event.vn2vnp1(remote_files_f0,fetch_type,0)
 
list f1_fetched_paths = []
 
tuple current_dir = os.getcwd()
 
 file_f0 = metafile.name
 
tuple file_f1 = interface_fetch_event.set_name_np1(fetch_type,file_f0,0)
 
string command = 'ln -sf '
 
list f1_fetched_files = []
 
 file_fx = metafile.name
 
tuple flevel = interface_fetch_event.find_fetch_level(fetch_type,file_fx)
 
tuple events = read_solarmonitor_event.read_v0(os.path.join(local_dir,file_fx))
 Get the date itime.datetime = interface_fetch_event.get_datetime(fetch_type,flevel,file_fx) itime.convert('datetime') Read the file to get event number, date_begin, date_end. More...
 
list str_date_begin = events[0]
 
list str_date_end = events[0]
 
tuple nevent = len(events)
 
tuple event_types = read_solarmonitor_event.regroup_event_by_attribute(events,attribute='event_id')
 
tuple result = database_event.find_element([table_name],conn,cur,filename = file_fx)
 
 n_event = nxflare,\
 
tuple fetch_level = metafile.mdate.strftime('%Y-%m-%d %H:%M:%S')
 
tuple row_id
 

Variable Documentation

list fetchevent.fetch_solarmonitor_noaaevent.all_remote_files = interface_fetch_event.read_remote_server(fetch_type,server,date_min=date_begin,date_max=date_end)
string fetchevent.fetch_solarmonitor_noaaevent.command = 'ln -sf '
tuple fetchevent.fetch_solarmonitor_noaaevent.current_dir = os.getcwd()
tuple fetchevent.fetch_solarmonitor_noaaevent.date_begin = module_common.utc_today-datetime.timedelta(days=31)
tuple fetchevent.fetch_solarmonitor_noaaevent.date_end = datetime.datetime(module_common.utc_today.year+1,12,31)
fetchevent.fetch_solarmonitor_noaaevent.download = True
list fetchevent.fetch_solarmonitor_noaaevent.downloaded_files = []
tuple fetchevent.fetch_solarmonitor_noaaevent.event_types = read_solarmonitor_event.regroup_event_by_attribute(events,attribute='event_id')
tuple fetchevent.fetch_solarmonitor_noaaevent.events = read_solarmonitor_event.read_v0(os.path.join(local_dir,file_fx))

Get the date itime.datetime = interface_fetch_event.get_datetime(fetch_type,flevel,file_fx) itime.convert('datetime') Read the file to get event number, date_begin, date_end.

list fetchevent.fetch_solarmonitor_noaaevent.f1_fetched_files = []
list fetchevent.fetch_solarmonitor_noaaevent.f1_fetched_paths = []
tuple fetchevent.fetch_solarmonitor_noaaevent.fetch_level = metafile.mdate.strftime('%Y-%m-%d %H:%M:%S')
string fetchevent.fetch_solarmonitor_noaaevent.fetch_type = 'SOLARMONITOR_NOAAEVENT'
fetchevent.fetch_solarmonitor_noaaevent.file_f0 = metafile.name
tuple fetchevent.fetch_solarmonitor_noaaevent.file_f1 = interface_fetch_event.set_name_np1(fetch_type,file_f0,0)
fetchevent.fetch_solarmonitor_noaaevent.file_fx = metafile.name
fetchevent.fetch_solarmonitor_noaaevent.first_data = False
tuple fetchevent.fetch_solarmonitor_noaaevent.flevel = interface_fetch_event.find_fetch_level(fetch_type,file_fx)
string fetchevent.fetch_solarmonitor_noaaevent.help_message
Initial value:
1 = """
2 Download and reformat NOAA event file from fetch type FILE_SOLARMONITOR_NOAAEVENT.\n
3 Usage :\n
4 python fetchevent/fetch_solarmonitor_noaaevent.py
5 [-h] : brief help
6 [-b YYYMMDD] : begin date from which it fetched data. Default Today's date - 31 days.
7 [-e YYYMMDD] : end date from which it fetched data. Default is last day of next year.
8 [--last-map] : only the last available map will be fetch. Look into [today-5days,max forecast[
9 [--first-map] : only the first available map will be fetch. Download only the map right after begin date.
10 [--format-vx] : format existing V0 file into Vn (n>0) format only, do not connect to server. Default: False.
11 [-v] : verbose mode. Default None.
12 """
tuple fetchevent.fetch_solarmonitor_noaaevent.itime = module_timespace.Time()
fetchevent.fetch_solarmonitor_noaaevent.last_data = False
list fetchevent.fetch_solarmonitor_noaaevent.local_dir = interface_fetch_event.fetch_info[fetch_type]
tuple fetchevent.fetch_solarmonitor_noaaevent.log_id = open(log_name,'a')
tuple fetchevent.fetch_solarmonitor_noaaevent.log_name = os.path.join('logs','fetch_event_solarmonitor_noaaevent_' + '%04d'%(module_common.utc_today.year) + '%02d'%(module_common.utc_today.month) + '%02d'%(module_common.utc_today.day))
list fetchevent.fetch_solarmonitor_noaaevent.logs = database_event.init_db(database_event.database_path,1)
string fetchevent.fetch_solarmonitor_noaaevent.message = '... Connecting to and reading solarmonitor.org website...'
tuple fetchevent.fetch_solarmonitor_noaaevent.metafile = interface_fetch_event.MetaFile()
tuple fetchevent.fetch_solarmonitor_noaaevent.metafile_f0 = interface_fetch_event.MetaFile()
fetchevent.fetch_solarmonitor_noaaevent.n_event = nxflare,\
tuple fetchevent.fetch_solarmonitor_noaaevent.nevent = len(events)
list fetchevent.fetch_solarmonitor_noaaevent.pattern = interface_fetch_event.fetch_info[fetch_type]
list fetchevent.fetch_solarmonitor_noaaevent.remote_files_f0 = []
list fetchevent.fetch_solarmonitor_noaaevent.remote_files_fm1 = [ all_remote_files[-1] ]
tuple fetchevent.fetch_solarmonitor_noaaevent.result = database_event.find_element([table_name],conn,cur,filename = file_fx)
tuple fetchevent.fetch_solarmonitor_noaaevent.row_id
Initial value:
1 = database_event.add_element(table_name,conn,cur,dirname=local_dir,filename=file_fx,fetch_type=fetch_type.upper(),\
2  n_event=nevent,n_flare=nflare,n_xflare=nxflare,\
3  date_begin=str_date_begin,date_end=str_date_end,\
4  fetch_level=flevel,modification_date=metafile.mdate.strftime('%Y-%m-%d %H:%M:%S'))
tuple fetchevent.fetch_solarmonitor_noaaevent.server = interface_fetch_event.connect_remote_server(fetch_type)
list fetchevent.fetch_solarmonitor_noaaevent.str_date_begin = events[0]
list fetchevent.fetch_solarmonitor_noaaevent.str_date_end = events[0]
list fetchevent.fetch_solarmonitor_noaaevent.table_name = interface_fetch_event.fetch_info[fetch_type]
tuple fetchevent.fetch_solarmonitor_noaaevent.to_be_downloaded = interface_fetch_event.vn2vnp1(remote_files_fm1,fetch_type,-1)
tuple fetchevent.fetch_solarmonitor_noaaevent.to_be_f1_fetched = interface_fetch_event.vn2vnp1(remote_files_f0,fetch_type,0)
fetchevent.fetch_solarmonitor_noaaevent.verbose = False