/**C*
 *
 * Vaisala software source code file
 *
 * Copyright (c) Vaisala Oyj 2012.
 * All rights reserved.
 *
 **C*/

/** @file
 *
 * Dual-pol QPE header file
 *
 * $URL: https://subversion.vaisala.com/svn/repos/sigmet/wr_iris_rda/tags/release8.13.6/base/dualpol_lib/dp_qpe.h $
 *
 * $Id: dp_qpe.h 28495 2012-09-24 22:19:54Z jho $
 *
 */

#ifndef __DP_QPE_H
#define __DP_QPE_H

#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif

struct dp_qpe_data;

/** Add default QPE algorithms settings to the presumably empty config */
void dp_qpe_set_defaults(struct conf_par * conf_hdl);

/** Initialize QPE context. */
struct dp_qpe_data * dp_qpe_init(struct conf_par * hdl,
                                 const char * section);

/** Free/release QPE context */
void dp_qpe_uninit(struct dp_qpe_data * qpe);

/** Get name of the classifier, the "CLASS_" prefix is mandatory and
 * is not stripped */
const char * dp_qpe_get_classifier(struct dp_qpe_data * qpe);

/** Get req. data mask[MSK_MAX].
    If mask[i] is 1, then corresponding moment from the
    list {z, kdp, zdr, ...} is needed */
int dp_qpe_get_mask(const struct dp_qpe_data * qpe, int * mask,
                    size_t mask_len);

/** Check if ZC is prefered to Z */
int dp_qpe_need_zc(const struct dp_qpe_data * qpe);

/** Check if T is prefered to Z */
int dp_qpe_need_zt(const struct dp_qpe_data * qpe);

/** Check if ZDRC is prefered to ZDR */
int dp_qpe_need_zdrc(const struct dp_qpe_data * qpe);

/** Check if ZR relationship can be adjusted at runtime */
int dp_qpe_is_zr_adj(const struct dp_qpe_data * qpe);

/** Adjust ZR relationship constants (R=A*Z^B , where Z is linear, not dBZ) */
int dp_qpe_adj_zr(const struct dp_qpe_data * qpe, double A, double B);

/** Get ZR relationship constants, if available (R=A*Z^B , where Z is
 * linear, not dBZ). If algorithm is not ZR, returns error value 1 */
int dp_qpe_get_zr(const struct dp_qpe_data * qpe, double * A, double * B);

/** Compute rain intensity */
float dp_qpe_get_r(const struct dp_qpe_data * qpe,
                   int rain_type, float z, float kdp, float zdr);

#if 0
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* __DP_QPE_H */
