ItsLive.jl
Documentation for ItsLive.jl
ItsLive.catalog
— Functioncatalog([catalog_geojson::String])
return a DataFrame (catalogdf
) of the catalog for all of the ITSLIVE zarr datacubes. User can optionally provide the path to `cataloggeojson`
using ArchGDAL, DataFrames
Example no inputs
julia> catalog()
julia> catalog(catalog_geojson = "path/to/catalog.json")
Arguments
catalog_geojson::String
: path to geojson catalog of ITS_LIVE datacubes
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.getvar
— FunctionC = getvar(lat,lon, varnames, catalogdf])
return a named m x n matrix of vectors (C
) with m = length(lat
) rows and n = length(varnames
)+2(for lat
and lon
) columns for the points nearest the lat
/lon
location from ITS_LIVE Zarr datacubes
use catalog.jl
to generate the DataFrame catalog (catalogdf
) of the ITS_LIVE zarr datacubes
using DataFrames Dates NamedArrays
Example
julia> getvar(69.1,-49.4, ["mid_date", "v"], catalogdf)
Arguments
lat::Union{Vector,Number}
: latitude between -90 and 90 degreeslon::Union{Vector,Number}
: latitude between -180 and 180 degreesvarnames::Unions{String, Vector{String}}
: name of variables to extract from Zarr DataFramecatalogdf::DataFrame
: DataFrame catalog of the ITS_LIVE zarr datacubes
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.plotvar
— Functionp = plotvar(C::Named Matrix{Any}, varname::String)
plot its_live data (`C`) variable (`varname`) for multiple points
Example no inputs
julia> p = plotvar(C, varname)
Arguments
C::Named Matrix{Any}
: ITS_LIVE named matrixvarname::String
: variable name to plot
Keyword Arguments
- `dtmax::Number`: maximum time seperation between image pairs [days] to plot
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.plotbysensor
— Functionp = plotbysensor(C, varname; dtmax::Number = Inf))
plot its_live data (`C`) variable (`varname`) by sensor type
Example no inputs
julia> p = plotbysensor(x,y,sensor)
Arguments
C::Named Matrix{Any}
: ITS_LIVE named matrix [size(C,2) must = 1]varname::String
: variable name to plot
Keyword Arguments
- `dtmax::Number`: maximum time seperation between image pairs [days] to plot
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.sensorfilter
— Functionid_exclude = sensorfilter(vx, vy, mid_date, dt, sensor; binedges, mincount, dtmax, id_refsensor, plotflag)
identify sensors that produce velocities that are sginificanlty slower
Example no inputs
julia> id_exclude = sensorfilter(C[1,"vx"], C[1,"vy"], C[1,"mid_date"], C[1,"date_dt"], C[1,"satellite_img1"])
Arguments
- `vx::Vector{Any}`: x component velocity
- `vy::Vector{Any}`: y component velocity
- `mid_date::Vector{DateTime}`: center date of image-pair []
- `dt::Vector{Any}`: time seperation between image pairs [days]
- `sensor::Vector{Any}`: list of image sensors for image-pairs... used to group results
- `id_exclude`: sesnor ids that should be excluded [none should be excluded if empty]
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.vxvyfilter
— Functionoutlier, dtmax, sensorgroups = vxvyfilter(vx,vy,dt; sensor)
identify 'outlier's for which the vx
or vy
distibution changes for longer dt
. 'dtmax' identified for each 'sensorgroups'
This filter is needed to identify longer dts that exhibit "skipping" or "locking" behavior in feature tracking estimates of surface flow. This happens when the surface texture provides a lesser match than to stationary features, due to long time separation between repeat images, such as ice falls and curved medial moraines.
using Statistics
Example
julia> outlier, dtmax, sensorgroups = vxvyfilter(vx,vy,dt,sensor)
Arguments
vx::Vector{Any}
: x component velocityvy::Vector{Any}
: y component velocitydt::Vector{Any}
: time seperation between image pairs [days]sensor::Vector{Any}
: list of image sensors for image-pairs... used to group results
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.lsqfit_annual
— Functiont_fit, v_fit, amp_fit, phase_fit, v_fit_err, amp_fit_err, fit_count, image_pair_count, outlier =
lsqfit_annual(v,v_err,mid_date,date_dt; mad_thresh[optional], iterations[optional], model[optional])
annual error wighted model fit to discrete interval data
using Statistics
Example
julia> t_fit, v_fit, amp_fit, phase_fit, v_fit_err, amp_fit_err, fit_count, image_pair_count, outlier =
lsqfit_annual(v, v_err, mid_date, date_dt; mad_thresh, iterations, model)
Arguments
v::Vector{Any}
: image-pair (discrete interval) velocityv_err::Vector{Any}
: image-pair (discrete interval) velocity errormid_date::Vector{DateTime}
: center date of image-pair []date_dt::Vector{Any}
: time seperation between image pairs [days]mad_thresh::Number
: optional key word argument for MAD treshold for outlier rejectioniterations::Number
: optional key word argument for number of iterations for lsqfit_annual outlier rejectionmodel::String
: optional key word argument giving name of lsq model. Valid options are "sinusoidal_interannual", "sinusoidal", "interannual".t_fit
: DateTime center of annual fitv_fit
: annual values determined from lsq fitamp_fit
: seasonal amplitudephase_fit
: seasonal amplitude [DateTime of maximum flow]v_fit_err
: error of v_fitamp_fit_err
: error of amp_fitfit_count
: data count for each year, after any outlier rejectionimage_pair_count
: total number of image pairs included in lsq fitoutlier
: BitVector of length ofv
indicating identified outliers
Author
Alex S. Gardner and Chad A. Greene, JPL, Caltech.
ItsLive.lsqfit_interp
— Functionvi, vierr = lsqfitinterp(tfit, vfit, ampfit, phasefit, vfiterr, ampfiterr, t_i)
create a continuous time series of velocity from the outputs of ItsLive.lsqfit
.
Example
julia> v_i, v_i_err = lsqfit_interp(t_fit, v_fit, amp_fit, phase_fit, v_fit_err, amp_fit_err, t_i)
Arguments
t_fit:::Vector{DateTime}
: date of v_fitv_fit::Vector{Any}
: mean annual vamp_fit::Vector{Any}
: amplitude of seasonal cyclephase_fit::Vector{Any}
: phase of seasonal cyclev_fit_err::Vector{Any}
: error in mean annual vamp_fit_err::Vector{Any}
: error in amplitude of seasonal cyclet_i:::Vector{DateTime}
: dates to interpolate to
Author
Alex S. Gardner and Chad A. Greene, JPL, Caltech.
ItsLive.binstats
— Functionyb, ybstd, countb, bincenters = binstats(x, y; binedges = [0.0], dx = 0, method = "mean")
return the central value (`yb`) and spread (`ybstd`) in `x` according to `method` ["mean" = default]
argument on values binned by `y`.
Example no inputs
julia> yb, ybstd, countb, bincenters = binstats(x, y; dx = 1)
Arguments
x::Vector{Float64}
: x data [typically DateTime]y::Vector{Float64}
: data to be binneddt::Number
: width of x bins [dt or binedges must be provided]binedges::Vector{Float64}
: x bin edges [dt or binedges must be provided]method::String
: method for deterskipspread::Bool
: flag for skipping spread calculations
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.running_mean
— Functionrunmean = running_mean(v, w)
return the running mean (runmean
) of v
using kernel width w
ItsLive.decimalyear
— Functiondecyear = decimalyear(datetime)
return the decimal year (decyear
) of a DateTime type vector
Example
julia> decyear = ItsLive.decimalyear(Dates.DateTime(1970,1,1))
1970.0
Arguments
datetime::Union{DateTime, Vector{DateTime}}
: date and time of type DateTime
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.intersect
— Functionrownumber = intersect(lat,lon, catalogdf])
return the rownumber
of the the DataFrame catalog (catalogdf
) of the ITS_LIVE zarr datacubes that intersects the provided lat
itude and lon
gituded [decimal degrees].
use catalog.jl to generate the DataFrame catalog of the ITS_LIVE zarr datacubes
using ArchGDAL, DataFrames
Example
julia> intersect(69.1,-49.4, catalogdf)
Arguments
lat::Number
: latitude between -90 and 90 degreeslon::Number
: latitude between -180 and 180 degreescatalogdf::DataFrame
: DataFrame catalog of the ITS_LIVE zarr datacubes
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.nearestxy
— Functionxind, yind = nearestxy(lat,lon,dc)
return the xind
/yind
indices into a ZarrGroup (dc
) for the points nearest the provided lat
, lon
locations
using Proj
Example
julia> nearestxy(lat,lon,dc)
Arguments
lat::::Union{Vector,Number}
: latitude between -90 and 90 degreeslon::::Union{Vector,Number}
: latitude between -180 and 180 degreesdc:::ZGroup{Zarr.ConsolidatedStore{Zarr.HTTPStore}}
: ITS_LIVE data cube:: Zarr DataArray
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.dtfilter
— Functiondtmax = dtfilter(x,dt,binedges)
return the maximum dt
(dtmax
) for which the distribution of x
shows no statistical difference from the distribution of x
in the minimum dt
bin
This filter is needed to identify longer dts that exhibit "skipping" or "locking" behavior in feature tracking estimates of surface flow. This happens when the surface texture provides a lesser match than to stationary features, due to long time separation between repeat images, such as ice falls and curved medial moraines.
using Statistics
Example
julia> dtfilter(vx,dt,binedge)
Arguments
x::Vector{Any}
: value to be filtered as a function of dt (typically velocity)dt::Vector{Any}
: time seperation between image pairs [days]binedges::Vector{Float64}
: optional edges of dt bins into which vx and vy will be grouped and compareddtbin_mad_thresh::Number
: used to determine in dt means are significantly different
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.design_matrix
— FunctionD, tD, M = design_matrix(t1,t2, model [optional])
create a design matrix (D
) for discrete interval data
Example
julia> D, tD, M = design_matrix(t1,t2, model [optional])
Arguments
t1::Vector{DateTime}
: start DateTime of descrete intervalt2::Vector{DateTime}
: end DateTime of descrete intervalmodel::String = "sinusoidal_interannual"
:D
: Design matrixtD
: DateTime centers used inD
M
= Annual weighting matrix`:
Author
Alex S. Gardner and Chad A. Greene, JPL, Caltech.
ItsLive.annual_matrix
— Functionannual_matrix(t1,t2)
create an annual weighting matrix for discrete intervals
Example
julia> M, tM = annual_matrix(t1,t2)
Arguments
t1::Vector{DateTime}
: start DateTime of descrete intervalt2::Vector{DateTime}
: end DateTime of descrete interval
Author
Alex S. Gardner and Chad A. Greene, JPL, Caltech.
ItsLive.wlinearfit
— Functionoffset, slope, error = wliearfit(t, v, v_err, datetime0)
return the offset
, slope
, and error
for a weighted linear fit to v
with an intercept of datetime0
Example no inputs
julia> offset, slope, error = wliearfit(t, v, v_err, datetime0)
Arguments
t::Vector{DateTime}
: date of input estimatesv::Vector{Float64}
: estimatesv_err::Vector{Float64}
: estimate errorsdatetime0::DateTime)
: model intercept
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.annual_magnitude
— Functionv_fit, v_fit_err, v_fit_count, v_fit_outlier_frac = annual_magnitude(vx_fit, vy_fit, vx_fit_err, vy_fit_err, vx_fit_count, vy_fit_count, vx_fit_outlier_frac, vy_fit_outlier_frac)
return the annual mean, error, count, and outlier fraction from component values projected on the unit flow vector defined by vx0 and vy0
Example no inputs
julia> annual_magnitude(vx_fit, vy_fit, vx_fit_err, vy_fit_err, vx_fit_count, vx_fit_count, vx_fit_outlier_frac, vy_fit_outlier_frac)
Arguments
- `vx_fit::Vector`: annual mean flow in x direction
- `vy_fit::Vector`: annual mean flow in y direction
- `vx_fit_err::Vector`: error in annual mean flow in x direction
- `vy_fit_err::Vector`: error in annual mean flow in y direction
- `vx_fit_count::Vector`: number of values used to determine annual mean flow in x direction
- `vy_fit_count::Vector`: number of values used to determine annual mean flow in y direction
- `vx_fit_outlier_frac::Vector`: fraction of data identified as outliers and removed when calculating annual mean flow in x direction
- `vy_fit_outlier_frac::Vector`: fraction of data identified as outliers and removed when calculating annual mean flow in y direction
Author
Alex S. Gardner and Chad A. Greene, JPL, Caltech.
ItsLive.climatology_magnitude
— Functionclimatology_magnitude(vx0, vy0, vx0_err, vy0_err, dvx_dt, dvy_dt, vx_amp, vy_amp, vx_amp_err, vy_amp_err, vx_phase, vy_phase)
return the mean, trend, seasonal amplitude, error in seasonal amplitude, and seasonal phase from component values projected on the unit flow vector defined by vx0 and vy0
Example no inputs
julia> v, v_err, dv_dt, v_amp, v_amp_err, v_phase = climatology_magnitude(vx0, vy0, vx0_err, vy0_err, dvx_dt, dvy_dt, vx_amp, vy_amp, vx_amp_err, vy_amp_err, vx_phase, vy_phase)
Arguments
vx0::Number
: mean flow in x directionvy0::Number
: mean flow in y directionvx0_err::Number
: error in mean flow in x directionvy0_err::Number
: error in mean flow in y directiondvx_dt::Number
: trend in flow in x directiondvy_dt::Number
: trend in flow in y directionvx_amp::Number
: seasonal amplitude in x directionvy_amp::Number
: seasonal amplitude in y directionvx_amp_err::Number
: error in seasonal amplitude in x directionvy_amp_err::Number
: error in seasonal amplitude in y directionvx_phase::Number
: seasonal phase in x direction [day of maximum flow]vy_phase::Number
: seasonal phase in y direction [day of maximum flow]
Author
Alex S. Gardner, JPL, Caltech.
ItsLive.sensorgroup
— Functionid, sensorgroups= sensorgroup(sensor)
return the sensor
group id
and the corresponding sensorgroups
using Statistics
Example
julia> id, sensorgroups = sensorgroup(sensor)
Arguments
sensor::Vector{Any}
: sensor list
Author
Alex S. Gardner, JPL, Caltech.