GEMSMagTIP

Documentation for GEMSMagTIP.

GEMSMagTIP.file_bestmodelsConstant

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.

source
GEMSMagTIP.file_statindConstant

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.

source
GEMSMagTIP.NotSupportedMethod

How to use: throw(NotSupported("CSV serialization")). How to test: @test_throws GEMSMagTIP.NotSupported ...

source
GEMSMagTIP.PreprocessConfigType

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...).

source
GEMSMagTIP.StatIndType
struct StatInd
    DateTime::Date
    stn::String
    prp::String
    var::NamedTuple
end

df = 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)
end
source
GEMSMagTIP.core_readFunction

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.

source
GEMSMagTIP.read_dataMethod

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)
source
GEMSMagTIP.read_dataMethod

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).

source
GEMSMagTIP.standardize_var_suffixMethod

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"
source
GEMSMagTIP.tomatchvarMethod

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

source
GEMSMagTIP.tomatchvarcoreMethod

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"
source
GEMSMagTIP.varstr2ntMethod

For transforming :variable to :var_type and :var_comp.

Example

transform(:variable => ByRow(v -> varstr2nt) => AsTable)

source