gnssrefl.advanced_vegetation_correction module
Advanced vegetation correction model for VWC estimation.
Reference: DOI 10.1007/s10291-015-0462-4
Ported to gnssrefl from original MATLAB in October 2025.
- gnssrefl.advanced_vegetation_correction.advanced_vegetation_filter(station, vxyz, extension='', bin_hours=24, bin_offset=0, pltit=True, fr=20, minvalperbin=10, save_tracks=False)
Advanced vegetation model (model 2)
This function applies the advanced vegetation correction filter to a vxyz array input.
- Parameters:
station (str) – 4-char GNSS station name
vxyz (numpy array) – Full track-level data from vwc (16 columns)
extension (str) – Extension used in the analysis json (default: ‘’)
bin_hours (int) – Time bin size for future subdaily support (default: 24)
bin_offset (int) – Bin timing offset for future subdaily support (default: 0)
pltit (bool) – Whether plots come to the screen
fr (int) – Frequency code (1=L1, 5=L5, 20=L2C, default: 20)
minvalperbin (int) – Minimum values required per time bin (default: 10)
save_tracks (bool) – Save individual track VWC data to files (default: False)
- Returns:
Dictionary containing: - ‘mjd’: list of Modified Julian Day values - ‘vwc’: list of VWC values (percentage units, not leveled) - ‘datetime’: list of datetime objects for plotting - ‘bin_starts’: list of bin start hours (subdaily only) or empty list
- Return type:
dict
- gnssrefl.advanced_vegetation_correction.apply_vegetation_model(station, vxyz, normmet, sgolnum, sgolply, padlen, pltit, fr, bin_hours, bin_offset, extension, minvalperbin, save_tracks=False)
Apply Clara’s vegetation filter to compute soil moisture
- Parameters:
station (str) – Station name
vxyz (numpy array) – Original vwc data
normmet (numpy array) – Normalized metrics from norm_zero_vxyz
sgolnum (int) – Savgol filter length
sgolply (int) – Savgol polynomial order
padlen (int) – Padding length
pltit (bool) – Show plots
fr (int) – Frequency code
bin_hours (int) – Time bin size in hours
bin_offset (int) – Bin timing offset in hours
extension (str) – Extension used in the analysis json
minvalperbin (int) – Minimum values required per time bin
save_tracks (bool) – Save individual track VWC data to files
- Returns:
final_mjd (list) – MJD values for time-binned averages
final_vwc (list) – VWC values for time-binned averages (percentage units, not leveled)
final_binstarts (list) – Bin start hours for subdaily data (empty for daily)
- gnssrefl.advanced_vegetation_correction.load_clara_model()
Load Clara’s model from the organized model_data directory
- Returns:
amp_lsp (numpy array) – LSP amplitude features
amp_dsnr (numpy array) – DSNR amplitude features
delta_heff (numpy array) – Change in effective reflector height
veg_correction (numpy array) – Vegetation phase corrections
slope_correction (numpy array) – Slope sensitivity corrections
- gnssrefl.advanced_vegetation_correction.norm_zero_vxyz(station, vxyz, remoutli, acc_rhdrift, baseperc, zphival, ampvarday, ampvarlimit)
Normalize metrics and remove outliers from vxyz data
This processes the full track-level data from vwc to prepare it for the KNN lookup.
- Parameters:
station (str) – Station name
vxyz (numpy array) – Full track data (18 columns; see column list inside the function)
remoutli (int) – Remove outliers flag
acc_rhdrift (int) – Apply RH drift correction
baseperc (float) – Percentage for amplitude normalization
zphival (float) – Fraction for phase zeroing
ampvarday (int) – Days for variance calculation
ampvarlimit (float) – Amplitude variance threshold
- Returns:
metrics_all (numpy array) – Normalized metrics [D_amplsp, D_amp, D_phi, D_RH]
vegmast (numpy array) – Vegetation mask
- gnssrefl.advanced_vegetation_correction.padClara(obs, Ntrack, men, padlen)
Pad arrays before smoothing (Clara’s method)
- Parameters:
obs (numpy array) – Observations to pad
Ntrack (int) – Number of values in array
men (int) – Number of values to use for calculating mean at each end
padlen (int) – Padding length on each end
- Returns:
padded_obs – Padded version of obs
- Return type:
numpy array
- gnssrefl.advanced_vegetation_correction.rolling_window(a, window)
Create rolling window view of array for variance calculation
From: https://stackoverflow.com/questions/6811183/rolling-window-for-1d-arrays-in-numpy