;docformat='rst' ;+ ; Set the system variables to be used for AIM CIPS processing ; ; :Author: ; last modified by Chris Jeppesen ; last updated to sync with production code by Bill Barrett ; ; :Params: ; sc_number: in, optional, type=long ; a space craft number. If none is specified this will default ; to 31304, the AIM spacecraft number ; data_rel_path: in, optional, type=string ; a legacy item that has no current function ; ; :Keywords: ; force_run: in, optional, type=boolean ; force reset of all the system variables ; :Examples: ; set_cips_production_vars ;- pro set_cips_production_vars, sc_number=sc_number, force_run=force_run, data_rel_path=data_rel_path COMMON CIPS_VARS, cips_vars_set if n_elements(cips_vars_set) ne 0 and ~keyword_set(force_run) then return ; If the environment variable 'aimsds' has not been set, then this means that ; that the shell script './sds/common/scripts/setup_science_data_system.sh' ; has not been run, and hence the configuration is unlikely to be correct. ; So if 'aimsds' is set, then set the rest of the variables. Otherwise print an ; error message and bail. env_var_aimsds = getenv('aimsds') if ~keyword_set(env_var_aimsds) then begin cips_vars_set = 0 print, 'The environment variable "aimsds" is not set.' + $ ' Please run ./sds/common/scripts/setup_science_data_system.sh' return endif ; !SDS_ROOT should always end with '/sds' which is four (4) characters long ; !AIM_ROOT is !SDS_ROOT less the four characters in '/sds' DEFSYSV, '!SDS_ROOT', env_var_aimsds DEFSYSV, '!AIM_ROOT', !SDS_ROOT.Remove(-4) ; The file with the credentials for writing to a database must be in the current path. spawn, 'find ' + !SDS_ROOT + ' -name "get_database_login_write\.pro"', db_login_write if ~keyword_set(db_login_write) then begin print, 'No path found to get_database_login_write.pro => ' + $ 'no credentials for writing to the database' return endif ; Set the space craft number and related dates set_aim_vars, sc_number=sc_number ; Set the version numbers DEFSYSV, '!CIPS_VERSION', '5.20' DEFSYSV, '!VERSION_1A', '5.20' DEFSYSV, '!VERSION_1B', '4.20' DEFSYSV, '!VERSION_2', '5.20' DEFSYSV, '!VERSION_3', '5.20' DEFSYSV, '!REVISION_1A', '01' DEFSYSV, '!REVISION_1B', '03' DEFSYSV, '!REVISION_2', '05' DEFSYSV, '!REVISION_3', '05' ; All of the paths below are defined relative to either SDS_ROOT or AIM_ROOT DEFSYSV, '!COMMON_ROOT', normalize_path(!SDS_ROOT + '/common') DEFSYSV, '!CIPS_ROOT', normalize_path(!SDS_ROOT + '/cips') DEFSYSV, '!ANALYSIS_CIPS_ROOT',normalize_path(!AIM_ROOT+'/analysis') DEFSYSV, '!PDC_ROOT', normalize_path(!COMMON_ROOT + '/pdc_interface') DEFSYSV, '!COMMON_INPUT_DATA', normalize_path(!COMMON_ROOT + '/input_data'),1 DEFSYSV, '!TLE_PATH', normalize_path(!COMMON_INPUT_DATA + '/tle') DEFSYSV, '!IWC_REGRESSION_PATH', normalize_path(!CIPS_ROOT+'/data_production/level_2A/input/IWC_regression_study/') DEFSYSV, '!CIPS_NETCDF_ATT_PATH', normalize_path(!CIPS_ROOT+'/data_production/netcdf_att') DEFSYSV, '!CIPS_TEMP', normalize_path(!CIPS_ROOT+'/temp') DEFSYSV, '!CIPS_CAL', normalize_path(!CIPS_ROOT+'/calibration_data') DEFSYSV, '!CIPS_CAL_DATA', normalize_path(!CIPS_ROOT+'/calibration_data/calibration_data_files') DEFSYSV, '!USER_DATA_PATH', normalize_path(!AIM_ROOT+'/user_data') DEFSYSV, '!CIPS_FLATFIELDS', normalize_path(!CIPS_CAL +'/flat_fields') DEFSYSV, '!LOGS_PATH', normalize_path(!AIM_ROOT+'/logs/cips') mbits = ((!version.release ge 5.4) ? !version.memory_bits : 32) DEFSYSV, '!ASTRON_LIB_PATH', normalize_path(string(!COMMON_ROOT,mbits,format="(%'%s/astronomy/astron%02d.so')")) DEFSYSV, '!COAST_GRID_PATH', normalize_path(!CIPS_ROOT+'/data_production/level_2CI/proc/raa_ret/orbit_strip_plotter') ; !7Z_PATH is the path to standalone command line version of 7-Zip, which is ; an open source file archiver with high compression ratio resolve_routine, 'unpack_file' , /EITHER, /COMPILE_FULL_FILE DEFSYSV, '!7Z_PATH', normalize_path(FILE_DIRNAME((ROUTINE_INFO('unpack_file', /SOURCE)).path)+'\7za432') ; The will determine what database is written to DEFSYSV, '!USER', (!AIM_ROOT EQ '/aim' ? 'production' : 'test') ; Set up the output directory path DEFSYSV, '!DATA_PRODUCT_PATH', normalize_path(!AIM_ROOT+'/data/cips') ; Initial default is to anomalous directory. This will be reset elsewhere to something ; more appropriate like 'south_2014' or 'north_2009' etc. DEFSYSV, '!ANOMALOUS', normalize_path('/anomalous') DEFSYSV, '!DATA_1A_PATH', normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_1a') DEFSYSV, '!DATA_1A_PX_PATH', normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_1a/px') DEFSYSV, '!DATA_1A_MX_PATH', normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_1a/mx') DEFSYSV, '!DATA_1A_PY_PATH', normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_1a/py') DEFSYSV, '!DATA_1A_MY_PATH', normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_1a/my') DEFSYSV, '!DATA_1A_SPECIAL_PATH', normalize_path(!AIM_ROOT + '/data/cips/special_1a') DEFSYSV, '!DATA_1B_PATH', normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_1b') DEFSYSV, '!DATA_2_PATH' , normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_2') DEFSYSV, '!DATA_3_PATH' , normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_3') DEFSYSV, '!DATA_3B_PATH' , normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_3b') DEFSYSV, '!DATA_3C_PATH' , normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_3c') DEFSYSV, '!DATA_3D_PATH' , normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_3d') DEFSYSV, '!DATA_3E_PATH' , normalize_path(!DATA_PRODUCT_PATH + !ANOMALOUS + '/level_3e') DEFSYSV, '!CAL_DIAGNOSTICS_PATH', normalize_path(!DATA_PRODUCT_PATH + '/cal_diagnostics') DEFSYSV, '!DEBUG_OUTPUT_PATH',normalize_path(!DATA_PRODUCT_PATH + '/debug') ; DEFINE PRODUCTION FLAGS aim_flags_str = { aim_flags_str, $ optimal_est:0B, $ ; 1 - Use Jerry's optimization code debug:0B } DEFSYSV, '!aim_flags', aim_flags_str ; Observation id for science data changed when AIM CIPS went into the continuous imaging mode ; last old science image time = 3214.7635491746 11-Feb-2016 18:19:30.65 1139249990525000.00 2016042.763549 ; last old dark image time = 3214.7493825080 11-Feb-2016 17:59:06.65 1139248766525000.00 2016042.749383 ; last flat image time = 3214.7496139891 11-Feb-2016 17:59:26.65 1139248786525000.00 2016042.749614 ; first new science image time = 3214.8030977855 11-Feb-2016 19:16:27.65 1139253407525000.00 2016042.803098 ; first new dark image time = 3214.8343477855 11-Feb-2016 20:01:27.65 1139256107525000.00 2016042.834348 DEFSYSV, '!last_timestamp_before_continuous_imaging', 1139248786525000.00 DEFSYSV, '!first_continuous_imaging_timestamp', 1139253407525000.00 ; The first of the sixty and seventy minute sequences began at 08-Oct-2018 15:29:14.11 ; which in gps microseconds is 1223047772110848 1.223047996525E15 ; Re a Friday 9/28/2018 4:24 PM email from Dave Welch with a ; 9/28/2018 4:34 PM u[date from David Gathright: ; In the TDI mode the following are also possible: ; obs_id 0070 hex is Science Image Flying forward with TDI ; obs_id 5070 hex is Science Image in Snapshot mode ; obs_id 1070 hex is Science Image Flying backwards with TDI ; obs_id 0060 hex is Science Image Flying forward with TDI ; obs_id 5060 hex is Science Image Flying backwards with TDI ; obs_id 5566 hex is Science Image Flying forward with TDI at the beginning of an orbit ; obs_id 1066 hex is Science Image Flying backward ; obs_id AA66 hex is Science Image at the end of 66 minute sequence ; Re a Friday 11/2/2018 1:54 email from Dave Welch and the follow ; through emails ; In the seventy minute snap shot mode ; obs_id 5570 is 70 minute sequence with all images in snapshot mode ; Re a Mon 10/14/2019 3:18 PM email from Dave Welch ; obs_id 5560 is 60 minute sequence with all images in snapshot mode ; ; The date below was verified by by the following query to the AIM_CIPS_L1S database ; 'select min(image_tlm_timestamp) from CipsScienceTlmMX ; where image_tlm_timestamp >= 1222442972110000 ; and obs_id in (0x5570, 0x0070, 0x5070, 0x1070, 0x0060, 0x5060)' ; where 1222442972110000 is '01-Oct-2018 15:29:14.11' DEFSYSV, '!start_of_seventy_minute_sequences', 1223047772110848.00 ; There was a spacecraft anomaly that caused the CIPS instrument to be turned ; off from partway through 2019-198 (July 17) until partway through 2019-209 (July 28). ; When the instrument was first re-enabled the images were taken only in ; the southern hemisphere. Continuous imaging in the seventy minute mode ; was re-activated at approximately '01-Aug-2019 21:00:00' ; The date below was verified by by the following query to the AIM_CIPS_L1S database ; 'select min(image_tlm_timestamp) from CipsScienceTlmMX ; where image_tlm_timestamp >= 1248307218000000' ; where 1248307218000000 is '28-Jul-2019' DEFSYSV, '!start_of_Jul_Aug_2019_anomaly', 1248307218000000LL ; The date below was verified by by the following query to the AIM_CIPS_L1S database ; 'select min(image_tlm_timestamp) from CipsScienceTlmMX ; where image_tlm_timestamp >= 1248307218000000 ; and obs_id in (0x5570, 0x0070, 0x5070, 0x1070, 0x0060, 0x5060)' ; where 1248307218000000 is '28-Jul-2019' DEFSYSV, '!end_of_Jul_Aug_2019_anomaly', 1248728418000000LL ; add CI_CODE_ROOT to IDL path !path = !path + ":" + expand_path("+" + getenv('CI_CODE_ROOT')) ; add extra idl_libraries needed for RAA L2c/3a to the path !path = !path + ':' + expand_path('+/home/aimpro/idl_libraries', /all_dirs) ; At this point all of the AIM CIPS variables have been set cips_vars_set = 1 ; Print the following when in production mode IF !AIM_ROOT EQ '/aim' THEN BEGIN print, 'Running in production mode' print, 'User ', !USER print, 'top directory: ', !SDS_ROOT print, 'common library root: ', !COMMON_ROOT print, 'CIPS root: ', !CIPS_ROOT print, 'Log Path: ', !LOGS_PATH print, 'common input data: ', !COMMON_INPUT_DATA print, 'TLE data: ', !TLE_PATH print, 'CIPS netCDF attr path: ', !CIPS_NETCDF_ATT_PATH print, 'CIPS temp path: ', !CIPS_TEMP print, 'CIPS calibration dir: ', !CIPS_CAL print, 'CIPS calibration data: ', !CIPS_CAL_DATA print, 'CIPS flatfields ', !CIPS_FLATFIELDS print, 'Data product path: ', !DATA_PRODUCT_PATH print, 'Cal Diagnostics path: ', !CAL_DIAGNOSTICS_PATH print, 'Debug output path: ', !DEBUG_OUTPUT_PATH print, 'Path to 7Z program: ', !7Z_path print, 'Path to astronomy lib: ', !astron_lib_path print, 'IWC regression study: ', !IWC_REGRESSION_PATH ENDIF end