SWDatabase
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Classes | Functions | Variables
fetchtimeserie.interface_fetch_timeserie Namespace Reference

Classes

class  FetchTimeserieError
 
class  MetaFile
 AMDA_EARTH info_amda_earth = { 'website': 'forecast.irap.omp.eu', 'user' : 'connecttool', 'port' : 22, 'src' : '/net/rosina1/ROSINA_B1/PROPTOOL/Speedinsitu/EARTH', EARTH_20160701_20161231.asc 'refile' : 'EARTH_[0-9]{8}_[0-9]{8}.asc', 'datadir': os.path.join(path_obs,'Insitu/EARTH'), 'obs' : 'amda', 'instr' : 'earth', 'ext' : 'txt', }. More...
 

Functions

def print_metafiles
 From a MetaFile list, print file metadata in a readable way. More...
 
def find_fetch_level
 For a given fetch type, return the fetch level of the filename. More...
 
def total_fetch_level
 For a given fetch type, return the number of available flevel. More...
 
def find_fetch_types
 Return all fetch_type for a given table or for all table. More...
 
def get_datetime
 Extract date from a timeserie filename, according to its fetch_type and fetch level. More...
 
def get_time
 Get module_timespace.Time object from the filename, according to its table name or a list of possible table names. More...
 
def set_datetime
 Recompose the filename of a timeserie file for a datetime.datime, according to fetch_type and fetch level. More...
 
def set_name_np1
 For a given filename of flevel n, build the corresponding name of flevel n+1. More...
 
def connect_remote_server
 Connect to the remote remote server. More...
 
def close_remote_server
 Close connection to the remote remote server. More...
 
def read_remote_server
 Find all files listed on the remote server associated with the given fetch_type. More...
 
def vn2vnp1
 For some Nth fetch level files, select which files need to be created in the N+1th fetch level. More...
 

Variables

dictionary fetch_info = {}
 

Function Documentation

def fetchtimeserie.interface_fetch_timeserie.close_remote_server (   fetch_type,
  server 
)

Close connection to the remote remote server.

def fetchtimeserie.interface_fetch_timeserie.connect_remote_server (   fetch_type)

Connect to the remote remote server.

  • DISCOVER: Url connection
Returns
server Remote client
def fetchtimeserie.interface_fetch_timeserie.find_fetch_level (   fetch_type,
  filename 
)

For a given fetch type, return the fetch level of the filename.

Here is the caller graph for this function:

def fetchtimeserie.interface_fetch_timeserie.find_fetch_types (   table_names = [])

Return all fetch_type for a given table or for all table.

If table_name is given, search fetch_types for this table.
If table_name is not given, search fetch_types for all tables.

Parameters
[in]table_namesOptional, list of table name. Default: all tables.

Here is the caller graph for this function:

def fetchtimeserie.interface_fetch_timeserie.get_datetime (   fetch_type,
  flevel,
  filename 
)

Extract date from a timeserie filename, according to its fetch_type and fetch level.

Returns
Beginning date of the file (datetime.datetime)

Here is the caller graph for this function:

def fetchtimeserie.interface_fetch_timeserie.get_time (   tables,
  filename 
)

Get module_timespace.Time object from the filename, according to its table name or a list of possible table names.

Here is the call graph for this function:

def fetchtimeserie.interface_fetch_timeserie.print_metafiles (   metafiles)

From a MetaFile list, print file metadata in a readable way.

If Metafile[0].date is an integer, suppose it is a Carrington rotation number and concatenate list by year: Year: CR1 CR2 ... CRn
If Metafile[0].date is a datetime object, concatenate list by day of year: Doy: map1 map2 ... mapn

def fetchtimeserie.interface_fetch_timeserie.read_remote_server (   fetch_type,
  server,
  date_min = module_timespace.today_midnight-datetime.timedelta(days=2) 
)

Find all files listed on the remote server associated with the given fetch_type.

Parameters
[in]fetch_typeOne of interface_fetch_timeserie_fetch_types
[in]serverObject returned by connect_remote_server. FTP/SFTP/URL client.
[in]date_minDatetime.datetime object. Minimum date you want to get. Only for DISCOVER_MAG,DISCOVER_VELOCITY,STEREOA_MAG,STEREOA_VELOCITY
Returns
List of MetaFile elements.

Here is the call graph for this function:

def fetchtimeserie.interface_fetch_timeserie.set_datetime (   fetch_type,
  flevel,
  date_in 
)

Recompose the filename of a timeserie file for a datetime.datime, according to fetch_type and fetch level.

For flevel == 0, recomposed filename may be miswritten because original name has some additionnal information. For flevel > 0 or 1, should be fine.

Returns
filename

Here is the caller graph for this function:

def fetchtimeserie.interface_fetch_timeserie.set_name_np1 (   fetch_type,
  name_n,
  flevel_n 
)

For a given filename of flevel n, build the corresponding name of flevel n+1.

Parameters
[in]fetch_type
[in]name_nname in flevel n
[in]flevel_nFetch level number n
[out]name_np1name in flevel n+1

Here is the call graph for this function:

Here is the caller graph for this function:

def fetchtimeserie.interface_fetch_timeserie.total_fetch_level (   fetch_type)

For a given fetch type, return the number of available flevel.

Here is the caller graph for this function:

def fetchtimeserie.interface_fetch_timeserie.vn2vnp1 (   metafiles,
  fetch_type,
  flevel_origin,
  force = False,
  local_dir = None 
)

For some Nth fetch level files, select which files need to be created in the N+1th fetch level.

Select Nth file if:

  • the corresponding N+1th file is not present or
  • the corresponding N+1th file is present but older than the Nth file or
  • Force option is set to True

Then add the Nth file to the to_be_formatted list.
Else skip the Nth file.
Fetch type = -1: file on the remote server.

Parameters
[in]metafilesNth fetch level files
[in]fetch_type
[in]flevel_originN value
[in]local_dirDefault fetch_info[fetch_type][dirname]. Only for testing purpose.
[out]to_be_formattedmetafile list

Here is the call graph for this function:

Variable Documentation

dictionary fetchtimeserie.interface_fetch_timeserie.fetch_info = {}