|
int | ndays_past = 10 |
|
tuple | log_id = module_io.open_log(__file__) |
|
tuple | time_0 = datetime.datetime.today() |
|
string | help_message |
|
list | scrafts = [] |
|
string | background = 'mag' |
|
| perihelion = False |
|
| orbit = False |
|
int | n_perihelion = -1 |
|
int | n_orbit = -1 |
|
tuple | error_hmodel = module_io.check_hmodel(module_io.hmodel ) |
|
tuple | error_cmodel = module_io.check_cmodel(module_io.cmodel ) |
|
tuple | error_magtype = module_io.check_magtype(module_io.magtype) |
|
tuple | error_reftime = module_io.check_reftime(module_io.reftime) |
|
dictionary | error_scraft = {} |
|
dictionary | sc_ref = {} |
|
tuple | date_in = module_timespace.Time() |
|
tuple | video_dir = module_io.output_videodir() |
|
tuple | png2mp4_log_file = os.path.join(video_dir,'log_file') |
|
tuple | png2mp4_err_file = os.path.join(video_dir,'err_file') |
|
tuple | video_name = module_io.output_globalname(module_io.hmodel,module_io.cmodel,module_io.reftime,scraft,module_io.magtype) |
|
list | date_begin = module_orbito.perihelion[sc_ref[scraft]] |
|
list | date_end = module_orbito.perihelion[sc_ref[scraft]] |
|
| delta = date_end-date_begin |
|
| ndays = delta.days |
|
list | dates = [ date_begin + i*datetime.timedelta(days=1) for i in range(0,delta.days+1) ] |
|
dictionary | error_db = {} |
|
dictionary | error_background_mag = {} |
|
dictionary | error_background_euv171 = {} |
|
dictionary | error_background_euv193 = {} |
|
dictionary | error_layer_frame = {} |
|
dictionary | error_layer_connectivity = {} |
|
dictionary | error_layer_subpoint = {} |
|
dictionary | error_layer_hcs = {} |
|
dictionary | error_layer_visible_disk = {} |
|
dictionary | simu_db = {} |
|
dictionary | path_background_mag = {} |
|
dictionary | path_background_euv171 = {} |
|
dictionary | path_background_euv193 = {} |
|
dictionary | path_layer_frame = {} |
|
dictionary | path_layer_connectivity = {} |
|
dictionary | path_layer_subpoint = {} |
|
dictionary | path_layer_hcs = {} |
|
dictionary | path_layer_visible_disk = {} |
|
dictionary | path_image = {} |
|
tuple | results |
|
| present_folder = True |
|
string | command = '' |
| Remove date with errors for date in dates[:]: if error_db[date].error or error_layer_frame[date].error: dates.remove(date) log_id.write(' s from list'date) If errors and no more valid date, get out! if dates == []: log_id.write('No valid date for Sc/Planet s, skip it. More...
|
|
tuple | time_tmp = module_timespace.Time() |
|
list | layers = [] |
|
tuple | ifile = open(png2mp4_log_file,'r') |
|
tuple | lines = ifile.readlines() |
|
tuple | time_2 = datetime.datetime.today() |
|
Convert some connectivity images into a video.
Update database if not os.path.isfile(path_layer_polarity): log_id.write('Error: layer not created s
'%(path_layer_polarity)) continue else: module_db.update_element(module_db.database_table,connector,cursor,simu_db[date_in.datetime]['id'],layer_polarity=os.path.basename(path_layer_polarity)) log_id.write('Layer created and added to DB (ID=d).
- Standard mode: Only images from Today(UTC) - ndays_past days to Today(UTC) + 3 days?. Video name is unique for a given (sc,hmodel,cmodel,reftime,magtype,plottype). Overwrite the video on an older existing video.
- Perihelion mode: Images in [Nth perihelion - 10 days, Nth perihelion + 10 days] with dt = 1day
- Orbit mode: Images in [perihelion[i-1],perihelion[i]] with dt=10day
Input
Usage:
python make_video.py -hmodel heliospheric_model -cmodel coronal_model -magtype magnetic_type -reftime reference_time -sc sc_name -y year -m month -d day -H hour –mag –euv171 –euv193 –perihelion N –orbit M
where:
- -h : brief help
- sc_name : SC/Planet name. May have multiple names (-sc Name1 -sc Name2...). PSP,STA,EARTH,ALL. Default PSP
- heliospheric_model : Heliospheric model, one of interface_heliosphere.info. Default PARKER.
- coronal_model : Coronal model, one of interface_corona.info. Default PFSS.
- magnetic_type : Type of magnetic data. WSO,NSO,ADAPT for PFSS coronal model. Default WSO. DUMFRIC or QSLSQUASHER for MFM coronal model. Default DUMFRIC.
- reference_time : Referential time. SCTIME,SUNTIME. Default SCTIME.
- year : year in UTC. Default today UTC year.
- month : month in UTC. Default today UTC month.
- day : day in UTC. Default today UTC day.
- hour : hour in UTC. Default 0.
- –mag : background is magnetic data (default)
- –euv171 : background is euv171 map
- –euv193 : background is euv193 map
- –perihelion N : dates correspond to [Nth perihelion - 10 days, Nth perihelion + 10 days] with dt = 1day
- –orbit M : dates correspond to Mth orbit [perihelion[i-1],perihelion[i]] with dt=10day
Find output and create video.
For date in [date-Npast,date], find corresponding simulation in Output DB and merge all its images.
Build the video with all the merged images from different dates.
'%(simu_db[date_in.datetime]['id']))
Close
Close orbitography and log files.
string make_video.command = '' |
Remove date with errors for date in dates[:]: if error_db[date].error or error_layer_frame[date].error: dates.remove(date) log_id.write(' s from list'date) If errors and no more valid date, get out! if dates == []: log_id.write('No valid date for Sc/Planet s, skip it.
'scraft); continue If date_in is not valid, do not get out if error_db[date_in.datetime].error: log_id.write('Main date s is not a valid simulation for Sc/Planet s, skip it.
'%(date_in.datetime,scraft)); continue