@@ -48,7 +48,10 @@ function GDALDataset(filename)
4848 allbands = map (1 : nb) do iband
4949 b = AG. getband (r, iband)
5050 gb = GDALBand (b, filename, iband)
51- name = AG. getname (AG. getcolorinterp (b))
51+ name = AG. GDAL. gdalgetdescription (b. ptr)
52+ if isempty (name)
53+ name = AG. getname (AG. getcolorinterp (b))
54+ end
5255 name => gb
5356 end
5457 proj = AG. getproj (r)
7679
7780get_varnames (ds:: GDALDataset ) = collect (keys (ds. bands))
7881
79- get_var_dims (ds:: GDALDataset , _) = (" X" , " Y" )
82+ function get_var_dims (ds:: GDALDataset , d)
83+ if d === " X"
84+ return (" X" ,)
85+ elseif d=== " Y"
86+ return (" Y" ,)
87+ else
88+ return (" X" , " Y" )
89+ end
90+ end
91+
92+ get_global_attrs (ds:: GDALDataset ) = Dict (" projection" => ds. projection)
8093
8194function get_var_attrs (ds:: GDALDataset , name)
8295 if name in (" Y" , " X" )
@@ -96,7 +109,7 @@ isy(s) = uppercase(s) == "Y"
96109function totransform (x, y)
97110 xstep = diff (x)
98111 ystep = diff (y)
99- if ! all (isapprox (first (xstep)), xstep) && ! all (isapprox (first (ystep)), ystep)
112+ if ! all (isapprox (first (xstep)), xstep) || ! all (isapprox (first (ystep)), ystep)
100113 throw (ArgumentError (" Grid must have regular spacing" ))
101114 end
102115 Float64[first (x), first (xstep), 0.0 , first (y), 0.0 , first (ystep)]
@@ -173,6 +186,7 @@ function create_dataset(
173186 else
174187 AG. setcolorinterp! (b, AG. GDAL. GDALColorInterp (icol - 1 ))
175188 end
189+ AG. GDAL. gdalsetdescription (b. ptr, varnames[i])
176190 atts = varattrs[i]
177191 haskey (atts, " missing_value" ) && AG. setnodatavalue! (b, atts[" missing_value" ])
178192 if haskey (atts, " labels" )
0 commit comments