GEMSMagTIP
Documentation for GEMSMagTIP.
GEMSMagTIP.expr_matchstatvarGEMSMagTIP.expr_matchstatvarrestGEMSMagTIP.file_bestmodelsGEMSMagTIP.file_fittingdegreeGEMSMagTIP.file_statindGEMSMagTIP.FreqBandDictGEMSMagTIP.NotSupportedGEMSMagTIP.PreprocessConfigGEMSMagTIP.StatIndGEMSMagTIP.core_readGEMSMagTIP.process_before_deserGEMSMagTIP.read_dataGEMSMagTIP.read_dataGEMSMagTIP.standardize_var_suffixGEMSMagTIP.tomatchvarGEMSMagTIP.tomatchvarcoreGEMSMagTIP.varstr2nt
GEMSMagTIP.expr_matchstatvar — Constant
Matches "varSEEW".
GEMSMagTIP.expr_matchstatvarrest — Constant
Matches "SEEW" for "varSE_EW".
GEMSMagTIP.file_bestmodels — Constant
This file name is shared with GEMS-MagTIP-insider data processing.
If this constant has been modified, in matlab scripts which use statind_summary.m and jointstation_summary.m the output file names have also be modified.
GEMSMagTIP.file_fittingdegree — Constant
This file name is shared with GEMS-MagTIP-insider data processing.
If this constant has been modified, in matlab scripts which use statind_summary.m and jointstation_summary.m the output file names have also be modified.
GEMSMagTIP.file_statind — Constant
This file name is shared with GEMS-MagTIP-insider data processing.
If this constant has been modified, in matlab scripts which use statind_summary.m and jointstation_summary.m the output file names have also be modified.
GEMSMagTIP.FreqBandDict — Type
Example
julia> GEMSMagTIP.FreqBandDict()["ULF-C"]
(0.001, 0.1)GEMSMagTIP.NotSupported — Method
How to use: throw(NotSupported("CSV serialization")). How to test: @test_throws GEMSMagTIP.NotSupported ...
GEMSMagTIP.PreprocessConfig — Type
Configuration for process_before_deser. pc = PreprocessConfig(datatype, config) can be used to pass keyword arguments to preprocessing function before deserialization, i.e., process_before_deser(T::datatype, file; config...).
GEMSMagTIP.StatInd — Type
struct StatInd
DateTime::Date
stn::String
prp::String
var::NamedTuple
enddf = GEMSMagTIP.read_data(file, DataFrame).
To revert df the same columns as the csv file:
@chain df begin
transform(:var => AsTable)
select(Not(:var))
transform(:DateTime => ByRow(t -> Dates.format(t, GEMSMagTIP.info_date_format)); renamecols=false)
endGEMSMagTIP.core_read — Function
core_read(path) attempts to infer T for Serde.to_deser(Vector{T}, ...) for CSV deserialization based on the file name in path. See GEMSMagTIP.file_ + [tab] for the supported file names.
This means core_read is designed to be dispatched over the Val of specific file name (e.g., file_fitting degree) that is associated to a specific concrete struct (e.g., FittingDegree), rather than dispatched by a concrete struct.
GEMSMagTIP.process_before_deser — Method
Internally called _vec_deser, and returns CSV.rowtable whose columns match fields in T.
GEMSMagTIP.read_data — Method
read_data(T::Union{Type{<:CSVRow},PreprocessConfig}, path, sink) deserialize data to type T for arbitrary file name, and finally returned as data of type sink.
Example
using GEMSMagTIP
GEMSMagTIP.read_data(StatInd, "data.csv", DataFrame)GEMSMagTIP.read_data — Method
read_data(path, DataFrame) dispatch deserialization by file name. For example, if basename(path) is StatInd.csv, it returns the DataFrame with each row being StatInd.
In this case, it is equivalent as calling read_data(StatInd, path, DataFrame).
GEMSMagTIP.standardize_var_suffix — Method
standardize_var_suffix standardize the direction suffix of a variable name.
For example,
julia> GEMSMagTIP.standardize_var_suffix("S")
"S_Full"
julia> GEMSMagTIP.standardize_var_suffix("S_x")
"S_North"
julia> GEMSMagTIP.standardize_var_suffix("S_y")
"S_East"
julia> GEMSMagTIP.standardize_var_suffix("S_z")
"S_Down"
julia> GEMSMagTIP.standardize_var_suffix("S_EW")
"S_EW"
julia> GEMSMagTIP.standardize_var_suffix("S_NS")
"S_NS"Additional prefix of "var_" will be preserved:
julia> GEMSMagTIP.standardize_var_suffix("var_S")
"var_S_Full"
julia> GEMSMagTIP.standardize_var_suffix("var_S_EW")
"var_S_EW"GEMSMagTIP.tomatchvar — Method
A function that generates Regex for matching variable name with var prefix but without suffix.
Example
julia> match(GEMSMagTIP.tomatchvar("FI"), "var_FI_EW").match
"var_FI"
julia> match(GEMSMagTIP.tomatchvar("FI"), "var_FI").match
"var_FI"
julia> match(GEMSMagTIP.tomatchvar("FI"), "var_FIX") # should return nothing
julia> match(GEMSMagTIP.tomatchvar("FI"), "Nevar_FI") # should return nothing
GEMSMagTIP.tomatchvarcore — Method
A function that generates Regex for matching variable name without var prefix and suffix.
Example
julia> match(GEMSMagTIP.tomatchvarcore("SE"), "var_SE_EW").match
"SE"
julia> match(GEMSMagTIP.tomatchvarcore("SE"), "var_SE").match
"SE"
julia> match(GEMSMagTIP.tomatchvarcore("SE"), "var_SEX")
julia> match(GEMSMagTIP.tomatchvarcore("SE"), "var_LOSE")
The matched target is always in the first captured group:
julia> match(GEMSMagTIP.tomatchvarcore("FI"), "var_FI_EW")
RegexMatch("FI", 1="FI")
julia> replace("var_FI_EW", GEMSMagTIP.tomatchvarcore("FI") => s"log(\1)")
"var_log(FI)_EW"
GEMSMagTIP.varstr2nt — Method
For transforming :variable to :var_type and :var_comp.
Example
transform(:variable => ByRow(v -> varstr2nt) => AsTable)