ConnectTool
 All Classes Namespaces Files Functions Variables Pages
Classes | Functions | Variables
module_io Namespace Reference

Manage input and outputs of connect_sc and connect_all main scripts. More...

Classes

class  InoutError
 Error returned by module_io. More...
 
class  ErrorClass
 Error boolean associated with a message. More...
 

Functions

def choose_sc_ref
 Return the sc_ref need by ALL case. More...
 
def open_log
 Open log file logs/log_YYYYMMDD and write header log. More...
 
def exit_connect_tool
 Manage the database, write a message in log_id and get out. More...
 
def remove_scraft
 Remove a scraft from the connect tool list. More...
 
def check_scraft
 Check scraft: module_orbito.orbito_info.keys() without GEN. More...
 
def check_hmodel
 Check hmodel: interface_heliosphere.info['model']. More...
 
def check_cmodel
 Check cmodel: interface_corona.info['model']. More...
 
def check_magtype
 Check magtype: WSO, ADAPT, NSO, DUMFRIC. More...
 
def check_reftime
 Check reftime: SUNTIME or SCTIME. More...
 
def output_globaldir
 Get global directory path. More...
 
def output_localdir
 Get local directory path. More...
 
def output_globalname
 Get global filepath. More...
 
def output_localname
 Get local filename. More...
 
def output_videodir
 Get video directory path. More...
 
def unformat_basename
 Retrieve keyName from an output_basename From SC_MODE_HMODEL_CMODEL_REFTIME_MAGTYPE_DATE, returns keyName. More...
 
def unformat_imagename
 Retrieve keyName from an output_imagename From SC_MODE_HMODEL_CMODEL_REFTIME_MAGTYPE_DATE_PLOTTYPE, returns keyName. More...
 
def read_simu_magmap
 Read magnetogram used for a given case. More...
 
def read_simu_fp
 Read footpoint file written for a given case. More...
 
def read_simu_connectivity
 Read connectivity file written for a given case. More...
 

Variables

tuple connect_tool_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
 
 all_mode = False
 Compute all Sc/Planet separately and on the same output. More...
 
string hmodel = ''
 Model to find the footprint on the source surface of the connected magnetic field line in the heliosphere. More...
 
string cmodel = ''
 Type of magnetic data. More...
 
string magtype = ''
 
string reftime = ''
 Time referential for computing and mapping. More...
 
int year = 0
 
int month = 0
 
int day = 0
 
int hour = 0
 
dictionary all_mode_priority = {'EARTH': 0, 'STA': 1, 'PSP': 2, 'STB': 3, 'SOLO': 4}
 

Detailed Description

Manage input and outputs of connect_sc and connect_all main scripts.

In ALL case, sc_ref needed for:

Different modes:

Function Documentation

def module_io.check_cmodel (   cmodel)

Check cmodel: interface_corona.info['model'].

PFSS...

def module_io.check_hmodel (   hmodel)

Check hmodel: interface_heliosphere.info['model'].

PARKER...

def module_io.check_magtype (   magtype)

Check magtype: WSO, ADAPT, NSO, DUMFRIC.

def module_io.check_reftime (   reftime)

Check reftime: SUNTIME or SCTIME.

def module_io.check_scraft (   scraft)

Check scraft: module_orbito.orbito_info.keys() without GEN.

SOLO, PSP, STA, EARTH, ALL...

def module_io.choose_sc_ref (   scrafts,
  mode = 0 
)

Return the sc_ref need by ALL case.

Returns
InoutError if cannot find a sc_ref. In this case, can continue but ALL mode is desactivated.

Here is the caller graph for this function:

def module_io.exit_connect_tool (   fid,
  message_exit = '' 
)

Manage the database, write a message in log_id and get out.

Here is the caller graph for this function:

def module_io.open_log (   caller_name)

Open log file logs/log_YYYYMMDD and write header log.

YYYYMMDD is UTC date.

def module_io.output_globaldir (   hmodel,
  cmodel,
  reftime 
)

Get global directory path.

connect_tool_path/dir.output/HMODEL/CMODEL/REFTIME

Parameters
[in]hmodelstring PARKER
[in]cmodelstring PFSS
[in]reftimestring SCTIME or SUNTIME

Here is the caller graph for this function:

def module_io.output_globalname (   hmodel,
  cmodel,
  reftime,
  scraft,
  magtype 
)

Get global filepath.

HMODEL_CMODEL_REFTIME_SCRAFT_MAGTYPE

Parameters
[in]hmodelstring PARKER
[in]cmodelstring PFSS
[in]reftimestring SCTIME or SUNTIME
[in]scraftstring PSP or EARTH or STA
[in]magtypestring WSO or NSO or ADAPT or DUMFRIC

Here is the caller graph for this function:

def module_io.output_localdir (   hmodel,
  cmodel,
  reftime,
  operation_mode,
  scraft,
  magtype,
  date_in 
)

Get local directory path.

connect_tool_path/dir.output/HMODEL/CMODEL/REFTIME/OPERATIONMODE/SCRAFT_MAGTYPE_DATE Date formatted this way: YYYYmmddTHHMMSS

Parameters
[in]hmodelstring PARKER
[in]cmodelstring PFSS
[in]reftimestring SCTIME or SUNTIME
[in]operation_modestring SCIENCE or FORECAST or EXTENDED
[in]scraftstring PSP or EARTH or STA
[in]magtypestring WSO or NSO or ADAPT or DUMFRIC
[in]date_indatetime.datetime object

Here is the call graph for this function:

def module_io.output_localname (   hmodel,
  cmodel,
  reftime,
  scraft,
  magtype,
  operation_mode,
  date_in 
)

Get local filename.

HMODEL_CMODEL_REFTIME_SCRAFT_MAGTYPE_OPERATIONMODE_DATE

Parameters
[in]hmodelstring PARKER
[in]cmodelstring PFSS
[in]reftimestring SCTIME or SUNTIME
[in]scraftstring PSP or EARTH or STA
[in]magtypestring WSO or NSO or ADAPT or DUMFRIC
[in]operation_modestring SCIENCE or FORECAST or EXTENDED
[in]date_indatetime.datetime object

Here is the call graph for this function:

def module_io.output_videodir ( )

Get video directory path.

connect_tool_path/dir.output/VIDEO

def module_io.read_simu_connectivity (   scraft,
  mode,
  hmodel,
  cmodel,
  magtype,
  reftime,
  time 
)

Read connectivity file written for a given case.

Look into the good folder. Read yaml file first.
Output:

  • param: dictionnary
  • connect_dict: dictionnary {ssw: ConnectivityPoint list, fsw: ConnectivityPoint list, insitu: ConnectivityPoint list}

Here is the call graph for this function:

def module_io.read_simu_fp (   scraft,
  mode,
  hmodel,
  cmodel,
  magtype,
  reftime,
  time 
)

Read footpoint file written for a given case.

Look into the good folder. Read yaml file first.
Output:

  • param: dictionnary
  • fp_dict: dictionnary {ssw: Coordinate list, fsw: Coordinate list, insitu: Coordinate list}

Here is the call graph for this function:

def module_io.read_simu_magmap (   scraft,
  mode,
  hmodel,
  cmodel,
  magtype,
  reftime,
  time 
)

Read magnetogram used for a given case.

Look into the good folder. Read yaml file first.
Output:

  • param: dictionnary
  • map2D_data: Map2D object
    Todo:
    magnetogram Smap or CRmap in yaml.
def module_io.remove_scraft (   scraft,
  scrafts,
  fid,
  message_remove = '' 
)

Remove a scraft from the connect tool list.

In ALL case, set all_mode to False

Here is the call graph for this function:

def module_io.unformat_basename (   basename,
  keyName 
)

Retrieve keyName from an output_basename From SC_MODE_HMODEL_CMODEL_REFTIME_MAGTYPE_DATE, returns keyName.


Todo:

Check keyName

Check basename is a basename

Check basename has good format

Here is the caller graph for this function:

def module_io.unformat_imagename (   basename,
  keyName 
)

Retrieve keyName from an output_imagename From SC_MODE_HMODEL_CMODEL_REFTIME_MAGTYPE_DATE_PLOTTYPE, returns keyName.


Todo:

Check keyName

Check imagename is an imagename

Check imagename has good format

Here is the caller graph for this function:

Variable Documentation

module_io.all_mode = False

Compute all Sc/Planet separately and on the same output.

dictionary module_io.all_mode_priority = {'EARTH': 0, 'STA': 1, 'PSP': 2, 'STB': 3, 'SOLO': 4}
module_io.cmodel = ''

Type of magnetic data.

tuple module_io.connect_tool_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
int module_io.day = 0
module_io.hmodel = ''

Model to find the footprint on the source surface of the connected magnetic field line in the heliosphere.

Must be one of module_heliosphere.info.

int module_io.hour = 0
string module_io.magtype = ''
int module_io.month = 0
module_io.reftime = ''

Time referential for computing and mapping.

int module_io.year = 0