-
Notifications
You must be signed in to change notification settings - Fork 36
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
missingval keyword for RasterStack #611
Comments
How can there be any missing values if its below zero? It shouldnt have a missing value set at all. (so set it to But the file should still load. (So we will fix that part - but the misssingval will still be wrong) |
Ok looking at it now its actually But you are right, its not possible to change it to -9999. Will fix that julia> st = RasterStack(CHELSA{BioClim}, (1, 2); missingval = -9999)
╭─────────────────────────╮
│ 43200×20880 RasterStack │
├─────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────── dims ┐
↓ X Projected{Float64} LinRange{Float64}(-180.00013888885002, 179.99152633785002, 43200) ForwardOrdered Regular Intervals{Start},
→ Y Projected{Float64} LinRange{Float64}(83.99152708185001, -90.00013888884999, 20880) ReverseOrdered Regular Intervals{Start}
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── layers ┤
:bio1 eltype: Int16 dims: X, Y size: 43200×20880
:bio2 eltype: Int16 dims: X, Y size: 43200×20880
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── raster ┤
extent: Extent(X = (-180.00013888885002, 179.99985967115), Y = (-90.00013888884999, 83.99986041515001))
missingval: (bio1 = -32768, bio2 = -32768)
crs: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994
33,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
julia> st.bio1
╭──────────────────────────────────╮
│ 43200×20880 Raster{Int16,2} bio1 │
├──────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────── dims ┐
↓ X Projected{Float64} LinRange{Float64}(-180.00013888885002, 179.99152633785002, 43200) ForwardOrdered Regular Intervals{Start},
→ Y Projected{Float64} LinRange{Float64}(83.99152708185001, -90.00013888884999, 20880) ReverseOrdered Regular Intervals{Start}
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── metadata ┤
Metadata{Rasters.GDALsource} of Dict{String, Any} with 4 entries:
"units" => ""
"offset" => 0.0
"filepath" => "/home/raf/Data/Raster/CHELSA/BioClim/CHELSA_bio10_01.tif"
"scale" => 1.0
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── raster ┤
extent: Extent(X = (-180.00013888885002, 179.99985967115), Y = (-90.00013888884999, 83.99986041515001))
missingval: -32768
crs: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994
33,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
↓ → 83.9915 83.9832 83.9749 83.9665 83.9582 83.9499 83.9415 … -89.9501 -89.9585 -89.9668 -89.9751 -89.9835 -89.9918 -90.0001
-180.0 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768
-179.992 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768
⋮ ⋮ ⋱ ⋮
179.975 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768
179.983 -32768 -32768 -32768 -32768 -32768 -32768 -32768 … -32768 -32768 -32768 -32768 -32768 -32768 -32768
179.992 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768 |
Ahh it turns out this is a deeper issue of using So we need to pivot to a specific |
About the missing values below zero: it seems somethign changed between CHELSA v1 and CHELSA v2. On CHELSA v2, somehow the missingvalue really is There aren't actually any missing values though, so setting To reproduce, on this branch of
I don't really understand why It seems a bit inconsistent that a Full stacktrace:
|
No good reasons, I'll fix that too in the kw PR. |
It doesn't seem possible to pass a
missingval
keyword toRasterStack
at the moment. Would this be hard to implement?I ran into this with the CHELSA dataset, which has
UInt16
type but a missingval of-99999
, which throws an error unlessmissingval
is passed explicitly (not sure if this is a bug or not in itself?).E.g.
This workaround does work, of course:
rs = RasterStack(Raster.(CHELSA{BioClim}, (1,2); missingval = -99999.0)...)
The text was updated successfully, but these errors were encountered: