Skip to content

Commit

Permalink
fixing imports
Browse files Browse the repository at this point in the history
MartinuzziFrancesco committed Jan 11, 2025
1 parent f34a0d7 commit 4bbe8a9
Showing 4 changed files with 10 additions and 10 deletions.
11 changes: 4 additions & 7 deletions src/SpectralIndices.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module SpectralIndices

using Compat: @compat #for @compat public
using Dates
using Downloads
using JSON

abstract type AbstractSpectralIndex end
abstract type AbstractPlatformBand end
using Compat: @compat
using Dates: Date
using Downloads: download
using JSON: parsefile

indices_funcs = Dict()
include("utils.jl")
1 change: 1 addition & 0 deletions src/indices.jl
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ struct SpectralIndices{T <: Dict{String, AbstractSpectralIndex}, O}
origin::O
end
=#
abstract type AbstractSpectralIndex end

struct SpectralIndex{S<:String,B,D<:Date,P,F} <: AbstractSpectralIndex
short_name::S
2 changes: 2 additions & 0 deletions src/platforms.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
abstract type AbstractPlatformBand end

struct PlatformBand{S<:String,W<:Number,B<:Number} <: AbstractPlatformBand
platform::S
band::S
6 changes: 3 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ data = load_json("my-custom-indices.json")
function load_json(filename::String="spectral-indices-dict.json")
fileloc = joinpath(dirname(@__FILE__), "..", "data", filename)
if isfile(fileloc)
return JSON.parsefile(fileloc)
return parsefile(fileloc)
else
error("The JSON file is not in the SpectralIndices/data folder")
end
@@ -61,11 +61,11 @@ function get_indices(
)
final_file = joinpath(fileloc, filename)
if online
indices_loc = Downloads.download(
indices_loc = download(
"https://raw.githubusercontent.com/awesome-spectral-indices/awesome-spectral-indices/main/output/spectral-indices-dict.json",
final_file,
)
indices = JSON.parsefile(indices_loc)
indices = parsefile(indices_loc)
else
indices = load_json()
end

0 comments on commit 4bbe8a9

Please sign in to comment.