lrose-core

Core C/C++ code for LROSE.

This project is maintained by NCAR


/**********************************************************************
 * TDRP params for ./RadxPid
 **********************************************************************/

//======================================================================
//
// RadxPid reads moments from Radx-type files, computes PID (and 
//   optionally KDP) and writes out the results to CfRadial files.
//
// The NCAR PID method is based on a fuzzy logic approach. This is 
//   documented in the following reference: Cloud Microphysics Retrieval 
//   Using S-Band Dual-Polarization Radar Measurements: J. Vivekanandan, 
//   D. S. Zrnic, S. M. Ellis, R. Oye, A. V. Ryzhkov, and J. Straka. 
//   Bulletin of the American Meteorological Society, 1999.
//
//======================================================================
 
//======================================================================
//
// DEBUGGING.
//
//======================================================================
 
///////////// debug ///////////////////////////////////
//
// Debug option.
//
// If set, debug messages will be printed appropriately.
//
//
// Type: enum
// Options:
//     DEBUG_OFF
//     DEBUG_NORM
//     DEBUG_VERBOSE
//     DEBUG_EXTRA
//

debug = DEBUG_OFF;

//======================================================================
//
// THREADING FOR SPEED.
//
// Multiple threads are used to improve performance. The computations 
//   are carried out in parallel in separate threads. The read and write 
//   stages occur in the main thread, since netCDF is not thread safe.
//
//======================================================================
 
///////////// n_compute_threads ///////////////////////
//
// The number of compute threads.
//
// The moments computations are segmented in range, with each thread 
//   computing a fraction of the number of gates. For maximum performance, 
//   n_threads should be set to the number of processors multiplied by 4. 
//   For further tuning, use top to maximize CPU usage while varying the 
//   number of threads. For single-threaded operation set this to 1.
//
// Minimum val: 1
//
// Type: int
//

n_compute_threads = 4;

//======================================================================
//
// DATA INPUT.
//
//======================================================================
 
///////////// mode ////////////////////////////////////
//
// Operating mode.
//

//
// In REALTIME mode, the program waits for a new input file.\nIn ARCHIVE 
//   mode, it moves through the data between the start and end times set 
//   on the command line. 
//
// In FILELIST mode, it moves through the list of file names specified 
//   on the command line.
//
//
// Type: enum
// Options:
//     REALTIME
//     ARCHIVE
//     FILELIST
//

mode = FILELIST;

///////////// input_dir ///////////////////////////////
//
// Input directory for searching for files.
//
// Files will be searched for in this directory.
//
//
// Type: string
//

input_dir = "/tmp/cfradial/moments/";

///////////// input_file_search_ext ///////////////////
//
// File name extension.
//
// If set, only files with this extension will be processed.
//
//
// Type: string
//

input_file_search_ext = "nc";

///////////// input_file_search_substr ////////////////
//
// File name sub-string.
//
// If set, only files with names containing this sub-string will be 
//   processed.
//
//
// Type: string
//

input_file_search_substr = "cfrad";

///////////// start_time //////////////////////////////
//
// Set the start time for ARCHIVE mode analysis.
//
// Format is 'yyyy mm dd hh mm ss'.
//
//
// Type: string
//

start_time = "2015 06 26 00 00 00";

///////////// end_time ////////////////////////////////
//
// Set the end time for ARCHIVE mode analysis.
//
// Format is 'yyyy mm dd hh mm ss'.
//
//
// Type: string
//

end_time = "2015 06 26 01 00 00";

//======================================================================
//
// INPUT FIELD INFORMATION.
//
// Names of fields in the input file. The following fields are required: 
//   SNR, DBZ, ZDR, PHIDP and RHOHV. If SNR is not available, it is 
//   computed from DBZ.
//
//======================================================================
 
///////////// SNR_available ///////////////////////////
//
// Is SNR data available?.
//
// If not, SNR will be computed from the DBZ field. See 
//   'noise_dbz_at_100km'.
//
//
// Type: boolean
//

SNR_available = FALSE;

///////////// SNR_field_name //////////////////////////
//
// Field name for SNR.
//
// Signal-to-noise ratio (dB).
//
//
// Type: string
//

SNR_field_name = "SNR";

///////////// noise_dbz_at_100km //////////////////////
//
// The noise value, represented as dBZ at a range of 100km.
//
// This is used for computing the SNR from the DBZ field. It is only 
//   used if SNR_available is FALSE. The SNR will be computed by 
//   range-correcting this value and using it as the noise value.
//
//
// Type: double
//

noise_dbz_at_100km = 0;

///////////// DBZ_field_name //////////////////////////
//
// Field name for DBZ.
//
// Horizontally-polarized reflectivity factor.
//
//
// Type: string
//

DBZ_field_name = "DBZ";

///////////// ZDR_field_name //////////////////////////
//
// Field name for ZDR.
//
//
// Type: string
//

ZDR_field_name = "ZDR";

///////////// PHIDP_field_name ////////////////////////
//
// Field name for PHIDP.
//
//
// Type: string
//

PHIDP_field_name = "PHIDP";

///////////// RHOHV_field_name ////////////////////////
//
// Field name for RHOHV.
//
//
// Type: string
//

RHOHV_field_name = "RHOHV";

///////////// LDR_available ///////////////////////////
//
// Is LDR data available?.
//
//
// Type: boolean
//

LDR_available = FALSE;

///////////// LDR_field_name //////////////////////////
//
// Field name for LDR.
//
//
// Type: string
//

LDR_field_name = "LDR";

//======================================================================
//
// COMPUTING KDP.
//
//======================================================================
 
///////////// KDP_params_file_path ////////////////////
//
// Path for parameters for computing KDP.
//
// If set to use-defaults, no parameter file will be read in, and the 
//   default parameters will be used.
//
//
// Type: string
//

KDP_params_file_path = "./KdpParams.test";

//======================================================================
//
// COMPUTING PID.
//
//======================================================================
 
///////////// PID_params_file_path ////////////////////
//
// Path for parameters for computing PID.
//
// If set to use-defaults, no parameter file will be read in, and the 
//   default parameters will be used.
//
//
// Type: string
//

PID_params_file_path = "PidParams.test";

///////////// PID_use_KDP_self_consistency ////////////
//
// When computing PID, using KDP conditioned for self-consistency.
//
// When KDP is computed, we compute both a standard result, and a 
//   conditioned result based on the self-consistency method. If this 
//   parameter is set to TRUE, the self-consistency result will be used 
//   instead of the standard result.
//
//
// Type: boolean
//

PID_use_KDP_self_consistency = FALSE;

///////////// PID_use_attenuation_corrected_fields ////
//
// Option to use Z and ZDR fields that are corrected for attenuation.
//
// If TRUE, the attenuation-corrected Z and ZDR fields will be used for 
//   computing PID.
//
//
// Type: boolean
//

PID_use_attenuation_corrected_fields = FALSE;

//======================================================================
//
// SPECIFYING OUTPUT FIELDS.
//
//======================================================================
 
///////////// output_fields ///////////////////////////
//
// Indicate which fields should be written to the output file.
//
// Choose the ID from the list.
//
// The name and units can be set however the user prefers.
//
// The output_encoding apply to CfRadial output only. 
//
// 	PID: NCAR Particle ID
// 	PID_INTEREST: final interest map for NCAR Particle ID values
// 	TEMP_FOR_PID: temperature field for PID (C)
// 	KDP: KDP from filtering PHIDP and computing slope (deg/km)
// 	KDP_SC: KDP conditioned using ZZDR self-consistency (deg/km)
// 	DBZ_ATTEN_CORRECTION: DBZ attenuation correction (dB)
// 	ZDR_ATTEN_CORRECTION: ZDR attenuation correction (dB)
// 	DBZ_ATTEN_CORRECTED: DBZ corrected for attenuation (dBZ)
// 	ZDR_ATTEN_CORRECTED: ZDR corrected for attenuation (dB).
//
//
// Type: struct
//   typedef struct {
//      output_field_id_t id;
//        Options:
//          PID
//          PID_INTEREST
//          TEMP_FOR_PID
//          KDP
//          KDP_SC
//          DBZ_ATTEN_CORRECTION
//          ZDR_ATTEN_CORRECTION
//          DBZ_ATTEN_CORRECTED
//          ZDR_ATTEN_CORRECTED
//      string name;
//      string long_name;
//      string standard_name;
//      string units;
//      boolean do_write;
//   }
//
// 1D array - variable length.
//

output_fields = {
  {
    id = PID,
    name = "PID",
    long_name = "particle_id",
    standard_name = "hydrometeor_type",
    units = "",
    do_write = TRUE
  }
  ,
  {
    id = PID_INTEREST,
    name = "PID_INTEREST",
    long_name = "final_interest_value_for_pid_decision",
    standard_name = "final_interest_value_for_pid_decision",
    units = "",
    do_write = FALSE
  }
  ,
  {
    id = TEMP_FOR_PID,
    name = "TEMP_FOR_PID",
    long_name = "temperature_for_computing_pid",
    standard_name = "temperature",
    units = "C",
    do_write = FALSE
  }
  ,
  {
    id = KDP,
    name = "KDP",
    long_name = "specific_differential_phase",
    standard_name = "specific_differential_phase_hv",
    units = "deg/km",
    do_write = TRUE
  }
  ,
  {
    id = KDP_SC,
    name = "KDP_SC",
    long_name = "kdp_conditioned_using_ZZDR_self_consistency",
    standard_name = "specific_differential_phase_hv",
    units = "deg/km",
    do_write = FALSE
  }
};

///////////// output_encoding /////////////////////////
//
// Set the encoding for fields in the output files.
//
// INT16 provides better compression. FL32 writes 32-bit floats.
//
//
// Type: enum
// Options:
//     OUTPUT_ENCODING_FL32
//     OUTPUT_ENCODING_INT16
//

output_encoding = OUTPUT_ENCODING_INT16;

//======================================================================
//
// SPECIFY COPY-THROUGH FIELDS.
//
// These fields are copied unchanged from the input file to the output 
//   file. This allows the user to consolidate the input and output data 
//   set in a single file.
//
//======================================================================
 
///////////// copy_selected_input_fields_to_output ////
//
// Option to copy input fields unchanged to the output file.
//
//
// Type: boolean
//

copy_selected_input_fields_to_output = TRUE;

///////////// copy_fields /////////////////////////////
//
// These fields are copied through unchanged to the output file.
//
// You can change the name of the field on output. Optionally you can 
//   censor the non-weather echoes, based on the PID.
//
//
// Type: struct
//   typedef struct {
//      string input_name;
//      string output_name;
//      boolean censor_non_weather;
//   }
//
// 1D array - variable length.
//

copy_fields = {
  {
    input_name = "DBZ",
    output_name = "DBZ",
    censor_non_weather = FALSE
  }
  ,
  {
    input_name = "VEL",
    output_name = "VEL",
    censor_non_weather = FALSE
  }
  ,
  {
    input_name = "WIDTH",
    output_name = "WIDTH",
    censor_non_weather = FALSE
  }
  ,
  {
    input_name = "ZDR",
    output_name = "ZDR",
    censor_non_weather = FALSE
  }
  ,
  {
    input_name = "PHIDP",
    output_name = "PHIDP",
    censor_non_weather = FALSE
  }
  ,
  {
    input_name = "RHOHV",
    output_name = "RHOHV",
    censor_non_weather = FALSE
  }
};

//======================================================================
//
// WRITE DEBUG FIELDS.
//
//======================================================================
 
///////////// KDP_write_debug_fields //////////////////
//
// Write extra fields to assist with KDP debugging.
//
// These are the intermediate fields used in computing KDP and 
//   attenuation.
//
//
// Type: boolean
//

KDP_write_debug_fields = FALSE;

///////////// PID_write_debug_fields //////////////////
//
// Write extra fields to assist with PID debugging.
//
// These are the intermediate fields used in computing PID.
//
//
// Type: boolean
//

PID_write_debug_fields = TRUE;

//======================================================================
//
// WRITING THE OUTPUT FILES.
//
//======================================================================
 
///////////// output_dir //////////////////////////////
//
// Output directory path.
//
// Files will be written to this directory.
//
//
// Type: string
//

output_dir = "/tmp/cfradial/pid/test";

///////////// output_filename_mode ////////////////////
//
// Mode for computing output file name.
//
// START_AND_END_TIMES: include both start and end times in file name. 
//   START_TIME_ONLY: include only start time in file name. END_TIME_ONLY: 
//   include only end time in file name.
//
//
// Type: enum
// Options:
//     START_AND_END_TIMES
//     START_TIME_ONLY
//     END_TIME_ONLY
//

output_filename_mode = START_AND_END_TIMES;

///////////// append_day_dir_to_output_dir ////////////
//
// Add the day directory to the output directory.
//
// Path will be output_dir/yyyymmdd/filename.
//
//
// Type: boolean
//

append_day_dir_to_output_dir = TRUE;

///////////// append_year_dir_to_output_dir ///////////
//
// Add the year directory to the output directory.
//
// Path will be output_dir/yyyy/yyyymmdd/filename.
//
//
// Type: boolean
//

append_year_dir_to_output_dir = FALSE;

///////////// output_format ///////////////////////////
//
// Format for the output files.
//
//
// Type: enum
// Options:
//     OUTPUT_FORMAT_CFRADIAL
//     OUTPUT_FORMAT_DORADE
//     OUTPUT_FORMAT_UF
//

output_format = OUTPUT_FORMAT_CFRADIAL;

//======================================================================
//
// SETTING PSEUDO EARTH RADIUS RATIO FOR HEIGHT COMPUTATIONS.
//
//======================================================================
 
///////////// override_standard_pseudo_earth_radius ///
//
// Option to override the standard 4/3 earth radius model for 
//   refraction.
//
// If true, the standard 4/3 earth radius will be overridden. The US NWS 
//   NEXRAD system uses 1.21 instead of 1.333.
//
//
// Type: boolean
//

override_standard_pseudo_earth_radius = FALSE;

///////////// pseudo_earth_radius_ratio ///////////////
//
// Ratio for computing the pseudo earth radius for beam height 
//   computations.
//
// For standard refraction this is 4/3. For super refraction it will be 
//   less than 4.3, and for sub-refraction it will be greater. NEXRAD uses 
//   1.21.
//
//
// Type: double
//

pseudo_earth_radius_ratio = 1.33333;

//======================================================================
//
// REALTIME OPERATIONS.
//
//======================================================================
 
///////////// instance ////////////////////////////////
//
// Program instance for process registration.
//
// This application registers with procmap. This is the instance used 
//   for registration.
//
//
// Type: string
//

instance = "test";

///////////// procmap_register_interval ///////////////
//
// Interval for registering with procmap (secs).
//
// REALTIME mode only. The app will register with procmap at this 
//   interval, to update its status. If it does not register within twice 
//   this interval, the auto_restart script will restart the app.
//
//
// Type: int
//

procmap_register_interval = 60;

///////////// max_realtime_data_age_secs //////////////
//
// Maximum age of realtime data (secs).
//
// Only data less old than this will be used.
//
//
// Type: int
//

max_realtime_data_age_secs = 300;