-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error plotting 1D dataset with Makie #412
Comments
I have no idea how these fallbacks work in Makie.jl But this is more like something we should define in DimensionalData.jl recipes as it's not really a spatial problem but a general one. |
I agree, it's a general plotting issue, but it was at some point working in #389, no? That's why I posted it here. Feel free to close this if you think it's not within the package scope to fix it here. |
I have no idea I thought that was mostly for heatmaps. @asinghvi17 ? |
@asinghvi17 was #433 supposed to fix this issue? I ask because I'm still getting errors on main: julia> using Rasters
julia> using GLMakie
julia> using Downloads: download
julia> url = "https://www.unidata.ucar.edu/software/netcdf/examples/tos_O1_2001-2002.nc";
julia> filename = download(url, "tos_O1_2001-2002.nc");
julia> A = Raster(filename)
[ Info: No `name` or `key` keyword provided, using first valid layer with name `:tos`
180×170×24 Raster{Union{Missing, Float32},3} tos with dimensions:
X Mapped{Float64} Float64[1.0, 3.0, …, 357.0, 359.0] ForwardOrdered Explicit Intervals crs: EPSG mappedcrs: EPSG,
Y Mapped{Float64} Float64[-79.5, -78.5, …, 88.5, 89.5] ForwardOrdered Explicit Intervals crs: EPSG mappedcrs: EPSG,
Ti Sampled{CFTime.DateTime360Day} CFTime.DateTime360Day[CFTime.DateTime360Day(2001-01-16T00:00:00), …, CFTime.DateTime360Day(2002-12-16T00:00:00)] ForwardOrdered Explicit Intervals
extent: Extent(X = (-0.0, 360.0), Y = (-80.0, 90.0), Ti = (CFTime.DateTime360Day(2001-01-01T00:00:00), CFTime.DateTime360Day(2003-01-01T00:00:00)))
missingval: missing
crs: EPSG:4326
mappedcrs: EPSG:4326
parent:
[:, :, 1]
-79.5 -78.5 -77.5 -76.5 -75.5 -74.5 -73.5 … 81.5 82.5 83.5 84.5 85.5 86.5 87.5 88.5 89.5
1.0 missing missing missing missing missing missing missing 271.42 271.419 271.42 271.422 271.426 271.43 271.437 271.445 271.459
3.0 missing missing missing missing missing missing missing 271.42 271.419 271.42 271.422 271.426 271.431 271.438 271.445 271.459
5.0 missing missing missing missing missing missing missing 271.42 271.418 271.42 271.422 271.425 271.431 271.438 271.445 271.459
7.0 missing missing missing missing missing missing missing 271.42 271.417 271.419 271.421 271.425 271.431 271.439 271.446 271.459
9.0 missing missing missing missing missing missing missing … 271.419 271.415 271.418 271.421 271.425 271.431 271.439 271.446 271.459
11.0 missing missing missing missing missing missing missing 271.415 271.414 271.417 271.421 271.424 271.431 271.44 271.447 271.459
13.0 missing missing missing missing missing missing missing 271.411 271.411 271.417 271.421 271.424 271.431 271.44 271.447 271.459
15.0 missing missing missing missing missing missing missing 271.409 271.41 271.416 271.421 271.424 271.432 271.441 271.447 271.459
17.0 missing missing missing missing missing missing missing 271.409 271.409 271.416 271.422 271.424 271.432 271.441 271.448 271.459
19.0 missing missing missing missing missing missing missing … 271.408 271.408 271.417 271.422 271.425 271.433 271.441 271.448 271.459
21.0 missing missing missing missing missing missing missing 271.406 271.408 271.417 271.422 271.426 271.433 271.442 271.449 271.459
23.0 missing missing missing missing missing missing missing 271.405 271.408 271.417 271.422 271.428 271.434 271.443 271.449 271.459
25.0 missing missing missing missing missing missing missing 271.404 271.408 271.416 271.421 271.429 271.434 271.443 271.45 271.459
27.0 missing missing missing missing missing missing missing 271.405 271.407 271.416 271.421 271.43 271.435 271.444 271.45 271.459
29.0 missing missing missing missing missing missing missing … 271.404 271.407 271.416 271.421 271.431 271.437 271.445 271.451 271.459
31.0 missing missing missing missing missing missing missing 271.401 271.406 271.416 271.421 271.432 271.438 271.446 271.451 271.459
⋮ ⋮ ⋱ ⋮ ⋮
329.0 missing missing missing 271.252 271.297 273.015 273.751 missing missing missing 271.43 271.427 271.428 271.435 271.445 271.459
331.0 missing missing missing 271.26 271.305 273.014 273.877 … missing missing missing 271.43 271.428 271.429 271.435 271.445 271.459
333.0 missing missing missing missing 271.305 272.948 274.052 missing missing missing 271.43 271.428 271.429 271.434 271.445 271.459
335.0 missing missing missing missing missing 273.114 274.334 missing missing 271.425 271.43 271.428 271.429 271.434 271.445 271.459
337.0 missing missing missing missing missing 273.735 274.699 missing missing 271.425 271.429 271.428 271.429 271.433 271.445 271.459
339.0 missing missing missing missing missing missing 274.972 missing missing 271.425 271.428 271.428 271.429 271.433 271.445 271.459
341.0 missing missing missing missing missing missing 275.205 … missing 271.422 271.425 271.427 271.428 271.429 271.433 271.445 271.459
343.0 missing missing missing missing missing missing missing missing 271.422 271.425 271.426 271.427 271.43 271.434 271.445 271.459
345.0 missing missing missing missing missing missing missing 271.419 271.422 271.424 271.426 271.427 271.43 271.434 271.445 271.459
347.0 missing missing missing missing missing missing missing 271.419 271.422 271.423 271.425 271.427 271.43 271.434 271.445 271.459
349.0 missing missing missing missing missing missing missing 271.418 271.421 271.423 271.424 271.427 271.43 271.435 271.445 271.459
351.0 missing missing missing missing missing missing missing … 271.418 271.421 271.422 271.424 271.426 271.43 271.435 271.445 271.459
353.0 missing missing missing missing missing missing missing 271.419 271.421 271.421 271.423 271.426 271.43 271.436 271.445 271.459
355.0 missing missing missing missing missing missing missing 271.42 271.42 271.421 271.423 271.426 271.43 271.436 271.445 271.459
357.0 missing missing missing missing missing missing missing 271.42 271.42 271.421 271.423 271.426 271.43 271.437 271.445 271.459
359.0 missing missing missing missing missing missing missing 271.42 271.42 271.42 271.423 271.426 271.43 271.437 271.445 271.459
[and 23 more slices...]
julia> lines(replace_missing(A[Y(Near(20.0)), Ti(1)], missingval=NaN)) # fails
ERROR: `Makie.convert_arguments` for the plot type Lines{Tuple{Raster{Float64, 1, Tuple{X{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, X{Colon}}}}, Tuple{Y{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, Y{Colon}}}, Ti{DimensionalData.Dimensions.LookupArrays.Sampled{CFTime.DateTime360Day, Vector{CFTime.DateTime360Day}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{CFTime.DateTime360Day}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}}}}, Vector{Float64}, Symbol, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, Float64}}} and its conversion trait PointBased() was unsuccessful.
The signature that could not be converted was:
::Raster{Float32, 1, Tuple{X{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, X{Colon}}}}, Tuple{}, Vector{Float32}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata, Missing}
Makie needs to convert all plot input arguments to types that can be consumed by the backends (typically Arrays with Float32 elements).
You can define a method for `Makie.convert_arguments` (a type recipe) for these types or their supertypes to make this set of arguments convertible (See http://docs.makie.org/stable/documentation/recipes/index.html).
Alternatively, you can define `Makie.convert_single_argument` for single arguments which have types that are unknown to Makie but which can be converted to known types and fed back to the conversion pipeline.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] convert_arguments(T::Type{Lines{Tuple{Raster{Float64, 1, Tuple{X{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, X{Colon}}}}, Tuple{Y{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, Y{Colon}}}, Ti{DimensionalData.Dimensions.LookupArrays.Sampled{CFTime.DateTime360Day, Vector{CFTime.DateTime360Day}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{CFTime.DateTime360Day}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}}}}, Vector{Float64}, Symbol, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, Float64}}}}, args::Raster{Float32, 1, Tuple{X{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, X{Colon}}}}, Tuple{}, Vector{Float32}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata, Missing}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Makie ~/.julia/packages/Makie/Iqcri/src/conversions.jl:17
[3] convert_arguments(T::Type{Lines{Tuple{Raster{Float64, 1, Tuple{X{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, X{Colon}}}}, Tuple{Y{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, Y{Colon}}}, Ti{DimensionalData.Dimensions.LookupArrays.Sampled{CFTime.DateTime360Day, Vector{CFTime.DateTime360Day}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{CFTime.DateTime360Day}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}}}}, Vector{Float64}, Symbol, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, Float64}}}}, args::Raster{Float32, 1, Tuple{X{Mapped{Float64, Vector{Float64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Explicit{Matrix{Float64}}, DimensionalData.Dimensions.LookupArrays.Intervals{DimensionalData.Dimensions.LookupArrays.Center}, DimensionalData.Dimensions.LookupArrays.Metadata{Rasters.NCDsource, Dict{String, Any}}, EPSG, EPSG, X{Colon}}}}, Tuple{}, Vector{Float32}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata, Missing})
@ Makie ~/.julia/packages/Makie/Iqcri/src/conversions.jl:7 |
Ah damn. We will have to set up proper CI with Makie to test all of this properly. Its just a big overhead in the already long test time here to also compile e.g. CairoMakie.jl and make multiple plots in every CI run. |
Not necessarily...we could theoretically just test that the conversion pipelines are working. For this I'll install Rasters master and see what needs to be done... |
In #389 I had thought a Makie recipe for 1D datasets was implemented, but at the moment it isn't working. For example the MWE used there:
Fails for me with
and the same error appears anytime I need to plot any 1D dataset of my own.
Am I missing something here?
cc @asinghvi17
PS: I'm using Rasters v0.5.3
The text was updated successfully, but these errors were encountered: