From 284f22c0df0853d9e2f721f384a1d51e945faff2 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Tue, 25 Jun 2024 09:07:13 -0700 Subject: [PATCH] Reorganized files so that each file is a module Some files have changed names because there were name conflicts (e.g., the module `OutputVar`, the function `OutputVar`, and the struct `OutputVar`). --- NEWS.md | 4 ++++ src/ClimaAnalysis.jl | 6 +++--- src/{SimDir.jl => Sim.jl} | 4 ++++ src/{OutputVar.jl => Var.jl} | 6 +++++- test/runtests.jl | 10 +++++----- test/{CairoMakieExt.jl => test_CairoMakieExt.jl} | 0 test/{GeoMakieExt.jl => test_GeoMakieExt.jl} | 0 test/{SimDir.jl => test_Sim.jl} | 0 test/{Utils.jl => test_Utils.jl} | 0 test/{OutputVar.jl => test_Var.jl} | 0 10 files changed, 21 insertions(+), 9 deletions(-) rename src/{SimDir.jl => Sim.jl} (99%) rename src/{OutputVar.jl => Var.jl} (99%) rename test/{CairoMakieExt.jl => test_CairoMakieExt.jl} (100%) rename test/{GeoMakieExt.jl => test_GeoMakieExt.jl} (100%) rename test/{SimDir.jl => test_Sim.jl} (100%) rename test/{Utils.jl => test_Utils.jl} (100%) rename test/{OutputVar.jl => test_Var.jl} (100%) diff --git a/NEWS.md b/NEWS.md index a60add81..a0e5b87d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ ClimaAnalysis.jl Release Notes =============================== +v0.5.4 +------ +- Reorganized internal modules so that each file is a module. + v0.5.3 ------ - Add `Visualize.contour2D_on_globe!` for discrete contours. diff --git a/src/ClimaAnalysis.jl b/src/ClimaAnalysis.jl index 0f185c64..53ed8d45 100644 --- a/src/ClimaAnalysis.jl +++ b/src/ClimaAnalysis.jl @@ -3,9 +3,9 @@ module ClimaAnalysis include("Utils.jl") import .Utils -include("OutputVar.jl") -include("SimDir.jl") -import .SimDir +include("Var.jl") +include("Sim.jl") +import .Sim include("Visualize.jl") import .Visualize diff --git a/src/SimDir.jl b/src/Sim.jl similarity index 99% rename from src/SimDir.jl rename to src/Sim.jl index 953fee22..f25eb2bb 100644 --- a/src/SimDir.jl +++ b/src/Sim.jl @@ -1,3 +1,5 @@ +module Sim + import Base: get export SimDir, available_vars, available_reductions, available_periods @@ -191,3 +193,5 @@ end Check if the given SimDir contains OutputVars. """ Base.isempty(simdir::SimDir) = isempty(simdir.vars) + +end diff --git a/src/OutputVar.jl b/src/Var.jl similarity index 99% rename from src/OutputVar.jl rename to src/Var.jl index 05fbd0b6..fb1d6c4e 100644 --- a/src/OutputVar.jl +++ b/src/Var.jl @@ -1,9 +1,11 @@ +module Var + import NCDatasets import OrderedCollections: OrderedDict import Statistics: mean -import .Utils: nearest_index, seconds_to_prettystr +import ..Utils: nearest_index, seconds_to_prettystr export OutputVar, read_var, @@ -518,3 +520,5 @@ end @overload_binary_op (-) @overload_binary_op (*) @overload_binary_op (/) + +end diff --git a/test/runtests.jl b/test/runtests.jl index 2f1af838..9dc9e25a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,11 +6,11 @@ using Test @safetestset "Docstrings" begin @time include("doctest.jl") end @safetestset "Format" begin @time include("format.jl") end -@safetestset "Utils" begin @time include("Utils.jl") end -@safetestset "SimDir" begin @time include("SimDir.jl") end -@safetestset "OutputVar" begin @time include("OutputVar.jl") end -@safetestset "CairoMakieExt" begin @time include("CairoMakieExt.jl") end -@safetestset "GeoMakieExt" begin @time include("GeoMakieExt.jl") end +@safetestset "Utils" begin @time include("test_Utils.jl") end +@safetestset "SimDir" begin @time include("test_Sim.jl") end +@safetestset "OutputVar" begin @time include("test_Var.jl") end +@safetestset "CairoMakieExt" begin @time include("test_CairoMakieExt.jl") end +@safetestset "GeoMakieExt" begin @time include("test_GeoMakieExt.jl") end #! format: on nothing diff --git a/test/CairoMakieExt.jl b/test/test_CairoMakieExt.jl similarity index 100% rename from test/CairoMakieExt.jl rename to test/test_CairoMakieExt.jl diff --git a/test/GeoMakieExt.jl b/test/test_GeoMakieExt.jl similarity index 100% rename from test/GeoMakieExt.jl rename to test/test_GeoMakieExt.jl diff --git a/test/SimDir.jl b/test/test_Sim.jl similarity index 100% rename from test/SimDir.jl rename to test/test_Sim.jl diff --git a/test/Utils.jl b/test/test_Utils.jl similarity index 100% rename from test/Utils.jl rename to test/test_Utils.jl diff --git a/test/OutputVar.jl b/test/test_Var.jl similarity index 100% rename from test/OutputVar.jl rename to test/test_Var.jl