SWDatabase
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Classes | Functions | Variables
fetchmap2D.interface_fetch_map2D Namespace Reference

Classes

class  FetchError
 
class  MetaFile
 Class representing metadata of a file. 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 fetch levels. More...
 
def find_fetch_types
 Return all fetch_type for a given table or for all table. More...
 
def get_cr
 Extract Carrington rotation from a filename, according to its fetch_type and fetch level. More...
 
def get_datetime
 Extract date from a synchronic filename, according to its fetch_type and fetch level. More...
 
def get_time
 Get Carrington or datetime.datetime object from the filename, according to its table name or a list of possible table names. More...
 
def set_cr
 Recompose the filename of the map for a Carrington rotation, according to fetch_type and fetch level. More...
 
def set_datetime
 Recompose the filename of the map for a datetime.datime, according to fetch_type and fetch level. More...
 
def set_name_np1
 For a given filename of fetch level n, build the corresponding name of fetch level 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 fetchmap2D.interface_fetch_map2D.close_remote_server (   fetch_type,
  server 
)

Close connection to the remote remote server.

def fetchmap2D.interface_fetch_map2D.connect_remote_server (   fetch_type)

Connect to the remote remote server.

  • For NSO_DATE, NSOZ_DATE: Ftp connection
  • For EUV2CARMAP_SDOSTA_***_DATE: Sftp connection
  • For EUV2CARMAP_SDO360_***_DATE: Sftp connection
  • For all others: Url connection
Returns
server Remote client
def fetchmap2D.interface_fetch_map2D.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 fetchmap2D.interface_fetch_map2D.find_fetch_types (   table_names = [],
  map2D_type = '' 
)

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.
[in]map2D_typeOptional, smap for synchronic fetch types, crmap for synoptic fetch types, fd for Full Disk fetch types. Default: empty string (all)

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.get_cr (   fetch_type,
  flevel,
  filename 
)

Extract Carrington rotation from a filename, according to its fetch_type and fetch level.

Returns
Carrington rotation of the map (int)

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.get_datetime (   fetch_type,
  flevel,
  filename 
)

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

Returns
Observation date of the map (datetime.datetime)

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.get_time (   tables,
  filename 
)

Get Carrington or datetime.datetime 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 fetchmap2D.interface_fetch_map2D.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 fetchmap2D.interface_fetch_map2D.read_remote_server (   fetch_type,
  server,
  date_min = None,
  date_max = None 
)

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

Parameters
[in]fetch_typeOne of interface_fetch_map2D_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 NSO_DATE, NSOZ_DATE and ADAPT*_DATE)
[in]date_maxDatetime.datetime object. Maximum date you want to get (only for NSO_DATE, NSOZ_DATE and ADAPT*_DATE)
Returns
List of MetaFile elements.

Here is the call graph for this function:

def fetchmap2D.interface_fetch_map2D.set_cr (   fetch_type,
  flevel,
  cr_in 
)

Recompose the filename of the map for a Carrington rotation, 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, should be fine.

Returns
filename

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.set_datetime (   fetch_type,
  flevel,
  date_in 
)

Recompose the filename of the map 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, should be fine.

Returns
filename

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.set_name_np1 (   fetch_type,
  name_n,
  flevel_n 
)

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.total_fetch_level (   fetch_type)

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

Here is the caller graph for this function:

def fetchmap2D.interface_fetch_map2D.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 fetchmap2D.interface_fetch_map2D.fetch_info = {}