File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
main/groovy/geoscript/layer
test/groovy/geoscript/layer Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,15 @@ class Format {
197
197
names
198
198
}
199
199
200
+ /**
201
+ * Whether the Format has a Raster by the given name
202
+ * @param name The Raster name
203
+ * @return Whether the Format has a Raster by the given name
204
+ */
205
+ boolean has (String name ) {
206
+ getNames(). contains(name)
207
+ }
208
+
200
209
/**
201
210
* Get metadata
202
211
* @param name The optional Raster name
Original file line number Diff line number Diff line change @@ -17,13 +17,18 @@ class FormatTestCase {
17
17
assertNotNull (format)
18
18
assertNotNull (format. stream)
19
19
assertTrue (format instanceof GeoTIFF )
20
+ assertTrue (format. has(" alki" ))
21
+ assertFalse (format. has(" badname" ))
20
22
21
23
// Existing NetCDF
22
24
file = new File (getClass(). getClassLoader(). getResource(" O3-NO2.nc" ). toURI())
23
25
format = Format . getFormat(file)
24
26
assertNotNull (format)
25
27
assertNotNull (format. stream)
26
28
assertTrue (format instanceof NetCDF )
29
+ assertTrue (format. has(" NO2" ))
30
+ assertTrue (format. has(" O3" ))
31
+ assertFalse (format. has(" A123" ))
27
32
28
33
// New png file
29
34
file = new File (" doesnotexist.png" )
You can’t perform that action at this time.
0 commit comments