From c649985e9f28c03062b7038756208348c2c9d686 Mon Sep 17 00:00:00 2001 From: lrennels Date: Tue, 3 Mar 2020 23:31:44 -0800 Subject: [PATCH 01/11] Remove type specification from VegaLite specs --- src/explorer/explore.jl | 4 ++-- test/test_explorer_model.jl | 2 +- test/test_explorer_sim.jl | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/explorer/explore.jl b/src/explorer/explore.jl index 98b78a775..f77748763 100644 --- a/src/explorer/explore.jl +++ b/src/explorer/explore.jl @@ -128,7 +128,7 @@ function plot(m::Model, comp_name::Symbol, datum_name::Symbol; interactive::Bool spec = Mimi._spec_for_item(m, comp_name, datum_name, interactive=interactive) spec === nothing ? error("Spec cannot be built.") : VLspec = spec["VLspec"] - return VegaLite.VLSpec{:plot}(VLspec) + return VegaLite.VLSpec(VLspec) end @@ -158,5 +158,5 @@ function plot(sim_inst::SimulationInstance, comp_name::Symbol, datum_name::Symbo spec = Mimi._spec_for_sim_item(sim_inst, comp_name, datum_name, results; interactive = interactive, model_index = model_index) spec === nothing ? error("Spec cannot be built.") : VLspec = spec["VLspec"] - return VegaLite.VLSpec{:plot}(VLspec) + return VegaLite.VLSpec(VLspec) end diff --git a/test/test_explorer_model.jl b/test/test_explorer_model.jl index fc06f1f20..ea6cd410b 100644 --- a/test/test_explorer_model.jl +++ b/test/test_explorer_model.jl @@ -70,7 +70,7 @@ close(w) items = [:a, :b, :c, :d, :e, :f, :x] for item in items p = Mimi.plot(m, :MyComp, item) - @test typeof(p) == VegaLite.VLSpec{:plot} + @test typeof(p) == VegaLite.VLSpec end #6. errors and warnings diff --git a/test/test_explorer_sim.jl b/test/test_explorer_sim.jl index f72055fce..b06cec2aa 100644 --- a/test/test_explorer_sim.jl +++ b/test/test_explorer_sim.jl @@ -75,46 +75,46 @@ close(w) # trumpet plot p = Mimi.plot(si, :emissions, :E_Global) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si, :emissions, :E_Global; interactive = true) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :emissions, :E_Global, results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :emissions, :E_Global; interactive = true, results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec @test_throws ErrorException p = Mimi.plot(si_disk, :emissions, :E_Global) #should error, no in-memory results # mulitrumpet plot p = Mimi.plot(si, :emissions, :E) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si, :emissions, :E; interactive = true); -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :emissions, :E, results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :emissions, :E; interactive = true, results_output_dir = results_output_dir); -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec # histogram plot p = Mimi.plot(si, :grosseconomy, :share_var) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si, :grosseconomy, :share_var; interactive = true); # currently just calls static version -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :grosseconomy, :share_var; results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :grosseconomy, :share_var; interactive = true, results_output_dir = results_output_dir); # currently just calls static version -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec # multihistogram plot p = Mimi.plot(si, :grosseconomy, :depk_var) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si, :grosseconomy, :depk_var; interactive = true); -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :grosseconomy, :depk_var; results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec p = Mimi.plot(si_disk, :grosseconomy, :depk_var; interactive = true, results_output_dir = results_output_dir); -@test typeof(p) == VegaLite.VLSpec{:plot} +@test typeof(p) == VegaLite.VLSpec From 4136d2aa62d27ac170d5dd71e4e14b625739686e Mon Sep 17 00:00:00 2001 From: lrennels Date: Tue, 3 Mar 2020 23:45:20 -0800 Subject: [PATCH 02/11] Fix VegaLite compat version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c82cc93c6..9ab0bc127 100644 --- a/Project.toml +++ b/Project.toml @@ -58,7 +58,7 @@ ProgressMeter = "1.2" StatsBase = "0.32" StringBuilders = "0.2" TableTraits = "0.4.1, 1" -VegaLite = "1, 2.0" +VegaLite = "2.0" julia = "1.2" [extras] From 5db36a931d2b6d4360f9c38256f993e2e9adaeb1 Mon Sep 17 00:00:00 2001 From: Lisa Rennels <31779240+lrennels@users.noreply.github.com> Date: Tue, 3 Mar 2020 23:50:27 -0800 Subject: [PATCH 03/11] Update VegLite combat version to 2 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9ab0bc127..3ab139bef 100644 --- a/Project.toml +++ b/Project.toml @@ -58,7 +58,7 @@ ProgressMeter = "1.2" StatsBase = "0.32" StringBuilders = "0.2" TableTraits = "0.4.1, 1" -VegaLite = "2.0" +VegaLite = "2" julia = "1.2" [extras] From 48fa266e3645f9614eb0e8761ec70e2aa6d55e06 Mon Sep 17 00:00:00 2001 From: lrennels Date: Tue, 3 Mar 2020 23:58:54 -0800 Subject: [PATCH 04/11] Update JSON compat version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3ab139bef..614a37ed4 100644 --- a/Project.toml +++ b/Project.toml @@ -49,7 +49,7 @@ GlobalSensitivityAnalysis = "0.0.9" GraphPlot = "0.3, 0.4" IterTools = "1.3" IteratorInterfaceExtensions = "0.1.1, 1" -JSON = "0.21" +JSON = "0.20.1" LightGraphs = "1.3" MacroTools = "0.5" MetaGraphs = "0.6" From ea497648ab7a2c164b26501ba47e58c2f631d3f8 Mon Sep 17 00:00:00 2001 From: lrennels Date: Wed, 4 Mar 2020 00:01:09 -0800 Subject: [PATCH 05/11] More changes to compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 614a37ed4..3ab139bef 100644 --- a/Project.toml +++ b/Project.toml @@ -49,7 +49,7 @@ GlobalSensitivityAnalysis = "0.0.9" GraphPlot = "0.3, 0.4" IterTools = "1.3" IteratorInterfaceExtensions = "0.1.1, 1" -JSON = "0.20.1" +JSON = "0.21" LightGraphs = "1.3" MacroTools = "0.5" MetaGraphs = "0.6" From 2a60e697314c571d092dd4dd610317f683360989 Mon Sep 17 00:00:00 2001 From: lrennels Date: Wed, 4 Mar 2020 00:32:56 -0800 Subject: [PATCH 06/11] Remove julia 1.2 compatibility --- .github/workflows/dependencytest-workflow.yml | 2 +- .github/workflows/jlpkgbutler-ci-master-workflow.yml | 2 +- .github/workflows/jlpkgbutler-ci-pr-workflow.yml | 2 +- Project.toml | 2 +- docs/src/tutorials/tutorial_1.md | 2 +- docs/src/tutorials/tutorial_2.md | 2 +- docs/src/tutorials/tutorial_3.md | 2 +- docs/src/tutorials/tutorial_4.md | 2 +- docs/src/tutorials/tutorial_main.md | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dependencytest-workflow.yml b/.github/workflows/dependencytest-workflow.yml index 6a966c0a6..b9fcc33cf 100644 --- a/.github/workflows/dependencytest-workflow.yml +++ b/.github/workflows/dependencytest-workflow.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.2, 1.3] + julia-version: [1.3] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: diff --git a/.github/workflows/jlpkgbutler-ci-master-workflow.yml b/.github/workflows/jlpkgbutler-ci-master-workflow.yml index 944a82f9b..445a86590 100644 --- a/.github/workflows/jlpkgbutler-ci-master-workflow.yml +++ b/.github/workflows/jlpkgbutler-ci-master-workflow.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.2.0, 1.3.1] + julia-version: [1.3.1] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: diff --git a/.github/workflows/jlpkgbutler-ci-pr-workflow.yml b/.github/workflows/jlpkgbutler-ci-pr-workflow.yml index 3fbdce92c..6be28d023 100644 --- a/.github/workflows/jlpkgbutler-ci-pr-workflow.yml +++ b/.github/workflows/jlpkgbutler-ci-pr-workflow.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.2.0, 1.3.1] + julia-version: [1.3.1] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: diff --git a/Project.toml b/Project.toml index 3ab139bef..475c46566 100644 --- a/Project.toml +++ b/Project.toml @@ -59,7 +59,7 @@ StatsBase = "0.32" StringBuilders = "0.2" TableTraits = "0.4.1, 1" VegaLite = "2" -julia = "1.2" +julia = "1.3" [extras] DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" diff --git a/docs/src/tutorials/tutorial_1.md b/docs/src/tutorials/tutorial_1.md index 82262f150..37d7c0fe7 100644 --- a/docs/src/tutorials/tutorial_1.md +++ b/docs/src/tutorials/tutorial_1.md @@ -4,7 +4,7 @@ This tutorial walks through the steps to download, run, and view the output of a Working through the following tutorial will require: -- [Julia v1.2.0](https://julialang.org/downloads/) or higher +- [Julia v1.3.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_2.md b/docs/src/tutorials/tutorial_2.md index 4b95fbe0a..85d632077 100644 --- a/docs/src/tutorials/tutorial_2.md +++ b/docs/src/tutorials/tutorial_2.md @@ -4,7 +4,7 @@ This tutorial walks through the steps to modify an existing model. There are se Working through the following tutorial will require: -- [Julia v1.2.0](https://julialang.org/downloads/) or higher +- [Julia v1.3.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_3.md b/docs/src/tutorials/tutorial_3.md index c60fe3039..a5face150 100644 --- a/docs/src/tutorials/tutorial_3.md +++ b/docs/src/tutorials/tutorial_3.md @@ -6,7 +6,7 @@ While we will walk through the code step by step below, the full code for implem Working through the following tutorial will require: -- [Julia v1.2.0](https://julialang.org/downloads/) or higher +- [Julia v1.3.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_4.md b/docs/src/tutorials/tutorial_4.md index 48abeb812..dddb64b9b 100644 --- a/docs/src/tutorials/tutorial_4.md +++ b/docs/src/tutorials/tutorial_4.md @@ -4,7 +4,7 @@ This tutorial walks through the sensitivity analysis (SA) functionality of Mimi, Working through the following tutorial will require: -- [Julia v1.2.0](https://julialang.org/downloads/) or higher +- [Julia v1.3.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_main.md b/docs/src/tutorials/tutorial_main.md index ddcc99b9b..bbc1837c9 100644 --- a/docs/src/tutorials/tutorial_main.md +++ b/docs/src/tutorials/tutorial_main.md @@ -33,7 +33,7 @@ _Additional AERE Workshop Tutorials: The Mimi developement team recently partici ## Requirements and Initial Setup -These tutorials require [Julia v1.2.0](https://julialang.org/downloads/) and [Mimi v0.9.0](https://github.com/mimiframework/Mimi.jl), or later. +These tutorials require [Julia v1.3.0](https://julialang.org/downloads/) and [Mimi v0.9.0](https://github.com/mimiframework/Mimi.jl), or later. To use the following tutorials, follow the steps below. From 45e4103c4a385947d8866d0cc9e121db14fb1fb1 Mon Sep 17 00:00:00 2001 From: lrennels Date: Wed, 4 Mar 2020 00:58:35 -0800 Subject: [PATCH 07/11] Allow both julia versions --- .github/workflows/dependencytest-workflow.yml | 2 +- .../jlpkgbutler-ci-master-workflow.yml | 2 +- .../workflows/jlpkgbutler-ci-pr-workflow.yml | 2 +- Project.toml | 4 +- docs/src/tutorials/tutorial_1.md | 2 +- docs/src/tutorials/tutorial_2.md | 2 +- docs/src/tutorials/tutorial_3.md | 2 +- docs/src/tutorials/tutorial_4.md | 2 +- docs/src/tutorials/tutorial_main.md | 2 +- src/explorer/explore.jl | 12 +++++- test/test_explorer_model.jl | 6 ++- test/test_explorer_sim.jl | 40 +++++++++++-------- 12 files changed, 49 insertions(+), 29 deletions(-) diff --git a/.github/workflows/dependencytest-workflow.yml b/.github/workflows/dependencytest-workflow.yml index b9fcc33cf..6a966c0a6 100644 --- a/.github/workflows/dependencytest-workflow.yml +++ b/.github/workflows/dependencytest-workflow.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.3] + julia-version: [1.2, 1.3] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: diff --git a/.github/workflows/jlpkgbutler-ci-master-workflow.yml b/.github/workflows/jlpkgbutler-ci-master-workflow.yml index 445a86590..944a82f9b 100644 --- a/.github/workflows/jlpkgbutler-ci-master-workflow.yml +++ b/.github/workflows/jlpkgbutler-ci-master-workflow.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.3.1] + julia-version: [1.2.0, 1.3.1] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: diff --git a/.github/workflows/jlpkgbutler-ci-pr-workflow.yml b/.github/workflows/jlpkgbutler-ci-pr-workflow.yml index 6be28d023..3fbdce92c 100644 --- a/.github/workflows/jlpkgbutler-ci-pr-workflow.yml +++ b/.github/workflows/jlpkgbutler-ci-pr-workflow.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.3.1] + julia-version: [1.2.0, 1.3.1] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: diff --git a/Project.toml b/Project.toml index 475c46566..e5dcd6e69 100644 --- a/Project.toml +++ b/Project.toml @@ -58,8 +58,8 @@ ProgressMeter = "1.2" StatsBase = "0.32" StringBuilders = "0.2" TableTraits = "0.4.1, 1" -VegaLite = "2" -julia = "1.3" +VegaLite = "1.0, 2" +julia = "1.2, 1.3" [extras] DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" diff --git a/docs/src/tutorials/tutorial_1.md b/docs/src/tutorials/tutorial_1.md index 37d7c0fe7..82262f150 100644 --- a/docs/src/tutorials/tutorial_1.md +++ b/docs/src/tutorials/tutorial_1.md @@ -4,7 +4,7 @@ This tutorial walks through the steps to download, run, and view the output of a Working through the following tutorial will require: -- [Julia v1.3.0](https://julialang.org/downloads/) or higher +- [Julia v1.2.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_2.md b/docs/src/tutorials/tutorial_2.md index 85d632077..4b95fbe0a 100644 --- a/docs/src/tutorials/tutorial_2.md +++ b/docs/src/tutorials/tutorial_2.md @@ -4,7 +4,7 @@ This tutorial walks through the steps to modify an existing model. There are se Working through the following tutorial will require: -- [Julia v1.3.0](https://julialang.org/downloads/) or higher +- [Julia v1.2.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_3.md b/docs/src/tutorials/tutorial_3.md index a5face150..c60fe3039 100644 --- a/docs/src/tutorials/tutorial_3.md +++ b/docs/src/tutorials/tutorial_3.md @@ -6,7 +6,7 @@ While we will walk through the code step by step below, the full code for implem Working through the following tutorial will require: -- [Julia v1.3.0](https://julialang.org/downloads/) or higher +- [Julia v1.2.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_4.md b/docs/src/tutorials/tutorial_4.md index dddb64b9b..48abeb812 100644 --- a/docs/src/tutorials/tutorial_4.md +++ b/docs/src/tutorials/tutorial_4.md @@ -4,7 +4,7 @@ This tutorial walks through the sensitivity analysis (SA) functionality of Mimi, Working through the following tutorial will require: -- [Julia v1.3.0](https://julialang.org/downloads/) or higher +- [Julia v1.2.0](https://julialang.org/downloads/) or higher - [Mimi v0.9.4](https://github.com/mimiframework/Mimi.jl) If you have not yet prepared these, go back to the main tutorial page and follow the instructions for their download. diff --git a/docs/src/tutorials/tutorial_main.md b/docs/src/tutorials/tutorial_main.md index bbc1837c9..ddcc99b9b 100644 --- a/docs/src/tutorials/tutorial_main.md +++ b/docs/src/tutorials/tutorial_main.md @@ -33,7 +33,7 @@ _Additional AERE Workshop Tutorials: The Mimi developement team recently partici ## Requirements and Initial Setup -These tutorials require [Julia v1.3.0](https://julialang.org/downloads/) and [Mimi v0.9.0](https://github.com/mimiframework/Mimi.jl), or later. +These tutorials require [Julia v1.2.0](https://julialang.org/downloads/) and [Mimi v0.9.0](https://github.com/mimiframework/Mimi.jl), or later. To use the following tutorials, follow the steps below. diff --git a/src/explorer/explore.jl b/src/explorer/explore.jl index f77748763..3300a68dd 100644 --- a/src/explorer/explore.jl +++ b/src/explorer/explore.jl @@ -128,7 +128,11 @@ function plot(m::Model, comp_name::Symbol, datum_name::Symbol; interactive::Bool spec = Mimi._spec_for_item(m, comp_name, datum_name, interactive=interactive) spec === nothing ? error("Spec cannot be built.") : VLspec = spec["VLspec"] - return VegaLite.VLSpec(VLspec) + if(VERSION < v"1.3.0") + return VegaLite.VLSpec{:plot}(VLspec) + else + return VegaLite.VLSpec(VLspec) + end end @@ -158,5 +162,9 @@ function plot(sim_inst::SimulationInstance, comp_name::Symbol, datum_name::Symbo spec = Mimi._spec_for_sim_item(sim_inst, comp_name, datum_name, results; interactive = interactive, model_index = model_index) spec === nothing ? error("Spec cannot be built.") : VLspec = spec["VLspec"] - return VegaLite.VLSpec(VLspec) + if(VERSION < v"1.3.0") + return VegaLite.VLSpec{:plot}(VLspec) + else + return VegaLite.VLSpec(VLspec) + end end diff --git a/test/test_explorer_model.jl b/test/test_explorer_model.jl index ea6cd410b..c15dc64ba 100644 --- a/test/test_explorer_model.jl +++ b/test/test_explorer_model.jl @@ -70,7 +70,11 @@ close(w) items = [:a, :b, :c, :d, :e, :f, :x] for item in items p = Mimi.plot(m, :MyComp, item) - @test typeof(p) == VegaLite.VLSpec + if(VERSION < v"1.3.0") + @test typeof(p) == VegaLite.VLSpec{:plot} + else + @test typeof(p) == VegaLite.VLSpec + end end #6. errors and warnings diff --git a/test/test_explorer_sim.jl b/test/test_explorer_sim.jl index b06cec2aa..12ed4490d 100644 --- a/test/test_explorer_sim.jl +++ b/test/test_explorer_sim.jl @@ -73,48 +73,56 @@ close(w) ## 3. Plots +function plot_type_test(p) + if(VERSION < v"1.3.0") + @test typeof(p) == VegaLite.VLSpec{:plot} + else + @test typeof(p) == VegaLite.VLSpec + end +end + # trumpet plot p = Mimi.plot(si, :emissions, :E_Global) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si, :emissions, :E_Global; interactive = true) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :emissions, :E_Global, results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :emissions, :E_Global; interactive = true, results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) @test_throws ErrorException p = Mimi.plot(si_disk, :emissions, :E_Global) #should error, no in-memory results # mulitrumpet plot p = Mimi.plot(si, :emissions, :E) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si, :emissions, :E; interactive = true); -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p)c p = Mimi.plot(si_disk, :emissions, :E, results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :emissions, :E; interactive = true, results_output_dir = results_output_dir); -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) # histogram plot p = Mimi.plot(si, :grosseconomy, :share_var) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si, :grosseconomy, :share_var; interactive = true); # currently just calls static version -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :grosseconomy, :share_var; results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :grosseconomy, :share_var; interactive = true, results_output_dir = results_output_dir); # currently just calls static version -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) # multihistogram plot p = Mimi.plot(si, :grosseconomy, :depk_var) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si, :grosseconomy, :depk_var; interactive = true); -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :grosseconomy, :depk_var; results_output_dir = results_output_dir) -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) p = Mimi.plot(si_disk, :grosseconomy, :depk_var; interactive = true, results_output_dir = results_output_dir); -@test typeof(p) == VegaLite.VLSpec +plot_type_test(p) From a791ac4ad7462d44fa7fb33407d5a81bf7a3948a Mon Sep 17 00:00:00 2001 From: Lisa Rennels <31779240+lrennels@users.noreply.github.com> Date: Wed, 4 Mar 2020 01:05:05 -0800 Subject: [PATCH 08/11] Fix Project.toml --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index e5dcd6e69..69959e844 100644 --- a/Project.toml +++ b/Project.toml @@ -58,8 +58,8 @@ ProgressMeter = "1.2" StatsBase = "0.32" StringBuilders = "0.2" TableTraits = "0.4.1, 1" -VegaLite = "1.0, 2" -julia = "1.2, 1.3" +VegaLite = "1, 2" +julia = "1.2" [extras] DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" From 63ab0e1dee2552ba7759582ebb8bed710ab43d4f Mon Sep 17 00:00:00 2001 From: Lisa Rennels <31779240+lrennels@users.noreply.github.com> Date: Wed, 4 Mar 2020 01:06:11 -0800 Subject: [PATCH 09/11] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 69959e844..c82cc93c6 100644 --- a/Project.toml +++ b/Project.toml @@ -58,7 +58,7 @@ ProgressMeter = "1.2" StatsBase = "0.32" StringBuilders = "0.2" TableTraits = "0.4.1, 1" -VegaLite = "1, 2" +VegaLite = "1, 2.0" julia = "1.2" [extras] From 2379ff9c411bfb9fe57933a6796a0ee731407e94 Mon Sep 17 00:00:00 2001 From: lrennels Date: Wed, 4 Mar 2020 01:11:48 -0800 Subject: [PATCH 10/11] Remove bug --- test/test_explorer_sim.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_explorer_sim.jl b/test/test_explorer_sim.jl index 12ed4490d..45b210a39 100644 --- a/test/test_explorer_sim.jl +++ b/test/test_explorer_sim.jl @@ -98,7 +98,7 @@ plot_type_test(p) p = Mimi.plot(si, :emissions, :E) plot_type_test(p) p = Mimi.plot(si, :emissions, :E; interactive = true); -plot_type_test(p)c +plot_type_test(p) p = Mimi.plot(si_disk, :emissions, :E, results_output_dir = results_output_dir) plot_type_test(p) From 7c45a83b3c7c91849932e11c38a2f6dd42eee2c6 Mon Sep 17 00:00:00 2001 From: lrennels Date: Wed, 4 Mar 2020 12:17:28 -0800 Subject: [PATCH 11/11] Add check for VegaLite version --- src/explorer/explore.jl | 20 ++++++++------------ test/test_explorer_model.jl | 12 +++++++----- test/test_explorer_sim.jl | 6 +++--- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/explorer/explore.jl b/src/explorer/explore.jl index 3300a68dd..818481e38 100644 --- a/src/explorer/explore.jl +++ b/src/explorer/explore.jl @@ -112,6 +112,11 @@ function explore(sim_inst::SimulationInstance; title="Electron", model_index::In end +# Helper function returns true if VegaLite is verison 3 or above, and false otherwise +function _is_VegaLite_v3() + return isdefined(VegaLite, :vlplot) ? true : false +end + """ plot(m::Model, comp_name::Symbol, datum_name::Symbol; interactive::Bool = false) @@ -128,14 +133,8 @@ function plot(m::Model, comp_name::Symbol, datum_name::Symbol; interactive::Bool spec = Mimi._spec_for_item(m, comp_name, datum_name, interactive=interactive) spec === nothing ? error("Spec cannot be built.") : VLspec = spec["VLspec"] - if(VERSION < v"1.3.0") - return VegaLite.VLSpec{:plot}(VLspec) - else - return VegaLite.VLSpec(VLspec) - end - + return _is_VegaLite_v3() ? VegaLite.VLSpec(VLspec) : VegaLite.VLSpec{:plot}(VLspec) end - """ plot(sim_inst::SimulationInstance, comp_name::Symbol, datum_name::Symbol; interactive::Bool = false, model_index::Int = 1, scen_name::Union{Nothing, String} = nothing, results_output_dir::Union{Nothing, String} = nothing) @@ -162,9 +161,6 @@ function plot(sim_inst::SimulationInstance, comp_name::Symbol, datum_name::Symbo spec = Mimi._spec_for_sim_item(sim_inst, comp_name, datum_name, results; interactive = interactive, model_index = model_index) spec === nothing ? error("Spec cannot be built.") : VLspec = spec["VLspec"] - if(VERSION < v"1.3.0") - return VegaLite.VLSpec{:plot}(VLspec) - else - return VegaLite.VLSpec(VLspec) - end + return _is_VegaLite_v3() ? VegaLite.VLSpec(VLspec) : VegaLite.VLSpec{:plot}(VLspec) + end diff --git a/test/test_explorer_model.jl b/test/test_explorer_model.jl index c15dc64ba..a309632f4 100644 --- a/test/test_explorer_model.jl +++ b/test/test_explorer_model.jl @@ -7,6 +7,11 @@ using Electron import Mimi: dataframe_or_scalar, _spec_for_item, menu_item_list, getdataframe, dim_names +# Helper function returns true if VegaLite is verison 3 or above, and false otherwise +function _is_VegaLite_v3() + return isdefined(VegaLite, :vlplot) ? true : false +end + @defcomp MyComp begin a = Parameter(index=[time, regions]) b = Parameter(index=[time]) @@ -70,11 +75,8 @@ close(w) items = [:a, :b, :c, :d, :e, :f, :x] for item in items p = Mimi.plot(m, :MyComp, item) - if(VERSION < v"1.3.0") - @test typeof(p) == VegaLite.VLSpec{:plot} - else - @test typeof(p) == VegaLite.VLSpec - end + p_type = _is_VegaLite_v3() ? VegaLite.VLSpec : VegaLite.VLSpec{:plot} + @test typeof(p) == p_type end #6. errors and warnings diff --git a/test/test_explorer_sim.jl b/test/test_explorer_sim.jl index 45b210a39..ba74fd29d 100644 --- a/test/test_explorer_sim.jl +++ b/test/test_explorer_sim.jl @@ -74,10 +74,10 @@ close(w) ## 3. Plots function plot_type_test(p) - if(VERSION < v"1.3.0") - @test typeof(p) == VegaLite.VLSpec{:plot} - else + if _is_VegaLite_v3() @test typeof(p) == VegaLite.VLSpec + else + @test typeof(p) == VegaLite.VLSpec{:plot} end end