;+ ; ; Laboratory for Atmospheric and Space Physics ; University of Colorado, Boulder, Colorado, USA ; ; FILENAME: ; index_level3_files ; ; AUTHOR: ; Lon Riesberg ; Brian Templeman ; ; DATE: March 12, 2012 ; ; PURPOSE: ; Over a provided time range, reads existing Level 3A files, inserts ; metadata into the CIPS Observation Catalog, and creates a file of ; PANs for all the read files. This procedure is helpful for ; public releasing lots of level 3 files. ; ; USAGE EXAMPLE: ; set_production_flag, flag=1 ; level_3A_daisy_indexer = OBJ_NEW('level_3a_daisy_indexer', self) ; level_3A_daisy_indexer->index_files, start_day, end_day, level_2_version, asc=asc, dsc=dsc ; level_3A_daisy_indexer->index_files, 170, 299, '03.20', /update_catalog, /create_pan, /scp_files ;- ; ---------------------------------------------------------------------- ; index_files ; ---------------------------------------------------------------------- ; INPUT PARAMETERS: ; start_day: starting AIM mission day number ; end_day: ending AIM mission day number ; level_2_version: dependant level 2 version ; ; OUTPUT PARAMETERS: ; NONE ; ; KEYWORD ARGUMENTS: ; asc: if set, indicates to read files marked as ascending node ; dsc: if set, indicates to read files marked as descending node ; pro level_3c_summary_indexer, current_day, YD=YD set_cips_production_vars catch, error_status if error_status ne 0 then begin catch, /cancel handle_error, error_status endif IF KEYWORD_SET( YD ) THEN current_day = YD2AD( current_day ) ; get file name gps_start_time = ad2usec(current_day) gps_end_time = ad2usec(current_day + 1) season = get_season(usec2la(gps_start_time), /expected) hemisphere = STRMID( season, 0, 5 ) year = STRMID( season, 6, 4 ) orbit_info = create_struct('start_time', gps_start_time, $ 'stop_time', gps_end_time, $ 'mission_day', current_day, $ 'orbit_number', 0, $ 'preliminary', 0) ; ================================================================= ; This function constructs the summary (3c) file name given the ; following input: ; ; hem hemisphere ('north' or 'south') string ; year year (e.g. '2009') string ; ver CIPS data version # (e.g., '4.20') string ; revision CIPS data revision # (e.g., '04') string ; alb_thresh Albedo threshold 1, 2, 5 float ; type 3c file type (e.g., 'cld') all, cld, nocld string ; ----------------------------------------------------------------- path = string(format='(%"%s/ver_%05.2f/rev_%02d")', !DATA_3C_PATH, !VERSION_3, !REVISION_3 ) filename = summary_filename( hemisphere, year, !VERSION_3, !REVISION_3, 1.0, 'all' ) text_filename = PATH+'/'+filename strreplace, text_filename, 'anomalous', season ; read file if file_test(text_filename) then begin fileinfo = FILE_INFO( text_filename ) generationDate = SYSTIME(0, fileinfo.MTIME, /UTC ) filename = FILE_BASENAME( text_filename ) data_directory = FILE_DIRNAME( text_filename ) url = 'http://lasp.colorado.edu/aim/cips/data/repository/summary_files/cips_3c_north_07_v04.20_r05_01G_all.txt' pan_args = prep_pan(filename, '3C', gps_start_time, gps_end_time, data_directory=data_directory, url=url) if ptr_valid(pan_args) gt 0 then begin cmd = '/home/aimsds/utils/perl64/bin/perl ' + !PDC_ROOT + '/add_cips_pan_to_file.pl ' + *pan_args spawn, cmd endif endif else begin print, 'FILE DOES NOT EXIST: ', filename endelse ; clean up and go to next day heap_gc help, /mem return end