Exemplo n.º 1
0
def gpt2w(dset):
    """Calculates meteorological data and mapping function coefficients based on GPT2w model

    The GPT2w model is described in Boehm et al. :cite:`boehm2015`.

    Args:
        dset (Dataset):    Model data.

    Returns:
        tuple of Numpy Arrays: Includes the following elements, each with entries for each observation

    ============  ===========  =======================================================
     Element       Unit         Description
    ============  ===========  =======================================================
     pressure      hPa          Pressure value
     temperature   Celsius      Temperature values
     dt            degree/km    Temperature lapse rate
     tm            K            Mean temperature of the water vapor
     e             hPa          Water vapor pressure
     mh                         Hydrostatic mapping function coefficient ah
     mw                         Wet mapping function coefficient aw
     la                         Water vapor decrease factor
     geoid_undu    m            Geoid undulation (based on 9x9 EGM model)
    ============  ===========  =======================================================
    """
    press = np.empty(dset.num_obs)
    temp = np.empty(dset.num_obs)
    dt = np.empty(dset.num_obs)
    tm = np.empty(dset.num_obs)
    e = np.empty(dset.num_obs)
    ah = np.empty(dset.num_obs)
    aw = np.empty(dset.num_obs)
    mh = np.empty(dset.num_obs)
    mw = np.empty(dset.num_obs)
    la = np.empty(dset.num_obs)
    undu = np.empty(dset.num_obs)

    mjd = dset.time.utc.mjd
    lat, lon, height = dset.site_pos.pos.llh.T
    zd = dset.site_pos.zenith_distance

    # Determine GPT2W values for each observation by interpolating between two unique
    # daily solutions
    for obs in range(dset.num_obs):
        # Start 'gpt2.f' day-by-day in folder where 'gpt2_5.grd' is placed and carry out
        # linear interpolation
        (press[obs], temp[obs], dt[obs], tm[obs], e[obs], ah[obs], aw[obs],
         la[obs], undu[obs]) = gpt2w_wrapper(mjd[obs], [lat[obs]], [lon[obs]],
                                             [height[obs]])

        # Determine mapping function values based on coefficients 'ah' and 'aw'
        mh[obs], mw[obs] = iers.vmf1_ht(ah[obs], aw[obs], mjd[obs], lat[obs],
                                        height[obs], zd[obs])

    return press, temp, dt, tm, e, mh, mw, la, undu
Exemplo n.º 2
0
def vmf1_mapping_function(dset):
    """Calculates VMF1 hydrostatic and wet mapping functions

    This routine determines the VMF1 (Vienna Mapping Functions 1) described in Boehm et al. :cite:`boehm2006a` and
    Kouba :cite:`kouba2007` and uses the 'vmf1_ht.f' from the IERS software library :cite:`iers2010`. The mapping
    function coefficients 'ah' and 'aw' are taken from VMF1 gridded files.

    TODO: Multiplication with 1.e-8 should maybe be handled when reading gridded VMF1-files and not here.

    Args:
        dset (Dataset):    Model data.

    Returns:
        tuple of Numpy Arrays: Includes the following elements, each with entries for each observation

    ============  ===========  =======================================================
     Element       Unit         Description
    ============  ===========  =======================================================
     mh                         Hydrostatic mapping function coefficient ah
     mw                         Wet mapping function coefficient aw
    ============  ===========  =======================================================
    """
    # Get gridded VMF1 data
    vmf1 = apriori.get("vmf1", time=dset.time)

    mh = np.empty(dset.num_obs)
    mw = np.empty(dset.num_obs)

    lat, lon, height = dset.site_pos.pos.llh.T
    zd = dset.site_pos.zenith_distance

    for obs in range(dset.num_obs):

        # Interpolation in time and space in VMF1 grid
        # t = dset.time[obs]
        # TODO vlbi t_2
        # if dset._default_field_suffix == '_2':
        # baseline_gcrs = dset.site_pos_2.gcrs - dset.site_pos_1.gcrs
        # delta_t = (dset.src_dir.unit_vector[:, None, :] @ baseline_gcrs[:, :, None])[:, 0, 0] / constant.c

        # t -= timedelta(seconds=delta_t[obs])
        mh[obs], mw[obs] = iers.vmf1_ht(
            vmf1["ah"](dset.time[obs], lon[obs], lat[obs]) * 1e-8,
            vmf1["aw"](dset.time[obs], lon[obs], lat[obs]) * 1e-8,
            dset.time.utc.mjd_int[obs],
            lat[obs],
            height[obs],
            zd[obs],
        )

    return mh, mw
Exemplo n.º 3
0
def gpt2(dset):
    """Calculates meteorological data and mapping function coefficients based on GPT2 model

    The GPT2 model is described in Lagler et al. :cite:`lagler2013`.

    Args:
        dset (Dataset):    Model data.

    Returns:
        tuple of Numpy Arrays: Includes the following elements, each with entries for each observation

    ============  ===========  =======================================================
     Element       Unit         Description
    ============  ===========  =======================================================
     pressure      hPa          Pressure value
     temperature   Celsius      Temperature values
     dt            degree/km    Temperature lapse rate
     e             hPa          Water vapor pressure
     mh                         Hydrostatic mapping function coefficient ah
     mw                         Wet mapping function coefficient aw
     geoid_undu    m            Geoid undulation (based on 9x9 EGM model)
    ============  ===========  =======================================================
    """
    press = np.empty(dset.num_obs)
    temp = np.empty(dset.num_obs)
    dt = np.empty(dset.num_obs)
    e = np.empty(dset.num_obs)
    ah = np.empty(dset.num_obs)
    aw = np.empty(dset.num_obs)
    mh = np.empty(dset.num_obs)
    mw = np.empty(dset.num_obs)
    undu = np.empty(dset.num_obs)

    # Determine GPT2 values for each observation by interpolating between two unique
    # daily solutions
    for obs, _ in enumerate(dset.values()):
        mjd = dset.time.utc.mjd[obs]
        lat, lon, height = dset.site_pos.llh[obs]
        zd = dset.site_pos.zenith_distance[obs]

        # Start 'gpt2.f' day-by-day in folder where 'gpt2_5.grd' is placed and carry out
        # linear interpolation
        press[obs], temp[obs], dt[obs], e[obs], ah[obs], aw[obs], undu[
            obs] = gpt2_wrapper(mjd, [lat], [lon], [height])

        # Determine mapping function values based on coefficients 'ah' and 'aw'
        mh[obs], mw[obs] = iers.vmf1_ht(ah[obs], aw[obs], mjd, lat, height, zd)

    return press, temp, dt, e, mh, mw, undu