Skip to content

Commit dca35c8

Browse files
committed
Bug fixes
1 parent f4429be commit dca35c8

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/datasets/archgdal.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function get_var_attrs(ds::GDALDataset, name)
9595
if name in ("Y", "X")
9696
Dict{String,Any}()
9797
else
98-
ds.bands[name].attrs
98+
merge(ds.bands[name].attrs,get_global_attrs(ds))
9999
end
100100
end
101101

@@ -118,11 +118,11 @@ totransform(x::AbstractRange, y::AbstractRange) =
118118
Float64[first(x), step(x), 0.0, first(y), 0.0, step(y)]
119119
getproj(userproj::String, attrs) = AG.importPROJ4(userproj)
120120
getproj(userproj::AG.AbstractSpatialRef, attrs) = userproj
121-
function getproj(userproj::Nothing, attrs)
122-
if haskey(attr, "projection_PROJ4")
123-
return AG.importPROJ4(attr["projection_PROJ4"])
124-
elseif haskey(attr, "projection_WKT")
125-
return AG.importWKT(attr["projection_WKT"])
121+
function getproj(::Nothing, attrs)
122+
if haskey(attrs, "projection_PROJ4")
123+
return AG.importPROJ4(attrs["projection_PROJ4"])
124+
elseif haskey(attrs, "projection_WKT")
125+
return AG.importWKT(attrs["projection_WKT"])
126126
else
127127
error(
128128
"Could not determine output projection from attributes, please specify userproj",
@@ -154,7 +154,7 @@ function create_dataset(
154154
proj, trans
155155
elseif isx(dimnames[1]) && isy(dimnames[2])
156156
#Try to find out srs
157-
proj = getproj(userproj, gatts)
157+
proj = getproj(userproj, merge(gatts,varattrs...))
158158
trans = totransform(dimvals[1], dimvals[2])
159159
proj, trans
160160
else

src/datasets/datasetinterface.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
get_var_handle(ds, name) = ds[name]
44

55
"Return a list of variable names"
6-
function get_varnames(ds) end
6+
function get_varnames end
77

88
"Return a list of dimension names for a given variable"
9-
function get_var_dims(ds, name) end
9+
function get_var_dims end
1010

1111
"Return a dict with the attributes for a given variable"
12-
function get_var_attrs(ds,name) end
12+
function get_var_attrs end
1313

1414
"Return a dict with global attributes for the dataset"
15-
function get_global_attrs(ds) end
15+
function get_global_attrs end
1616

1717
#Functions to be implemented for Dataset sinks
1818
"Initialize and return a handle to a new empty dataset"
19-
function create_empty(T::Type,path,gatts) end
19+
function create_empty end
2020

2121
"""
2222
add_var(ds, T, name, s, dimlist, atts)
@@ -25,7 +25,7 @@ Add a new variable to the dataset with element type `T`,
2525
name `name`, size `s` and depending on the dimensions `dimlist`
2626
given by a list of Strings. `atts` is a Dict with attributes.
2727
"""
28-
function add_var(ds, T, name, s, dimlist, atts;kwargs...) end
28+
function add_var end
2929

3030
"""
3131
allow_parallel_write(ds)

0 commit comments

Comments
 (0)