Mercurial > gemma
comparison pkg/controllers/diff.go @ 4847:4847ac70103a
Made staticcheck happy.
- error strings should not end with punctuation or a newline (ST1005)
- error strings should not be capitalized (ST1005)
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 18 Nov 2019 11:54:20 +0100 |
parents | f4abfd0ee8ad |
children | 34bc6041e61e |
comparison
equal
deleted
inserted
replaced
4846:c69e35ec6adf | 4847:4847ac70103a |
---|---|
170 if err != nil { | 170 if err != nil { |
171 return 0, err | 171 return 0, err |
172 } | 172 } |
173 | 173 |
174 if minuendTree == nil { | 174 if minuendTree == nil { |
175 return 0, fmt.Errorf("Cannot find survey for %s/%s.", | 175 return 0, fmt.Errorf("cannot find survey for %s/%s", |
176 dci.Bottleneck, | 176 dci.Bottleneck, |
177 dci.Minuend.Format(common.DateFormat)) | 177 dci.Minuend.Format(common.DateFormat)) |
178 } | 178 } |
179 | 179 |
180 epsg := minuendTree.EPSG() | 180 epsg := minuendTree.EPSG() |
188 epsg, | 188 epsg, |
189 dci.Minuend.Time, | 189 dci.Minuend.Time, |
190 dci.Subtrahend.Time, | 190 dci.Subtrahend.Time, |
191 ).Scan(&box.X1, &box.Y1, &box.X2, &box.Y2); { | 191 ).Scan(&box.X1, &box.Y1, &box.X2, &box.Y2); { |
192 case err == sql.ErrNoRows: | 192 case err == sql.ErrNoRows: |
193 return 0, errors.New("No such intersection") | 193 return 0, errors.New("no such intersection") |
194 case err != nil: | 194 case err != nil: |
195 return 0, err | 195 return 0, err |
196 } | 196 } |
197 | 197 |
198 if box.Empty() { | 198 if box.Empty() { |
199 return 0, errors.New("Intersection is empty") | 199 return 0, errors.New("intersection is empty") |
200 } | 200 } |
201 | 201 |
202 log.Printf("info: bbox of intersection: (%.2f, %.2f) - (%.2f, %.2f)\n", | 202 log.Printf("info: bbox of intersection: (%.2f, %.2f) - (%.2f, %.2f)\n", |
203 box.X1, box.Y1, box.X2, box.Y2) | 203 box.X1, box.Y1, box.X2, box.Y2) |
204 | 204 |
219 if err != nil { | 219 if err != nil { |
220 return 0, err | 220 return 0, err |
221 } | 221 } |
222 | 222 |
223 if subtrahendTree == nil { | 223 if subtrahendTree == nil { |
224 return 0, fmt.Errorf("Cannot find survey for %s/%s.", | 224 return 0, fmt.Errorf("cannot find survey for %s/%s", |
225 dci.Bottleneck, | 225 dci.Bottleneck, |
226 dci.Subtrahend.Format(common.DateFormat)) | 226 dci.Subtrahend.Format(common.DateFormat)) |
227 } | 227 } |
228 | 228 |
229 // We need a slow path implementation for this. | 229 // We need a slow path implementation for this. |
230 if epsg != subtrahendTree.EPSG() { | 230 if epsg != subtrahendTree.EPSG() { |
231 return 0, errors.New("Calculating differences between two different " + | 231 return 0, errors.New("calculating differences between two different " + |
232 "EPSG code meshes are not supported, yet.") | 232 "EPSG code meshes are not supported, yet") |
233 } | 233 } |
234 | 234 |
235 start = time.Now() | 235 start = time.Now() |
236 raster.Diff(subtrahendTree.Value) | 236 raster.Diff(subtrahendTree.Value) |
237 log.Printf("info: A - B took %v\n", time.Since(start)) | 237 log.Printf("info: A - B took %v\n", time.Since(start)) |
244 } | 244 } |
245 defer tx.Rollback() | 245 defer tx.Rollback() |
246 | 246 |
247 zMin, zMax, ok := raster.ZExtent() | 247 zMin, zMax, ok := raster.ZExtent() |
248 if !ok { | 248 if !ok { |
249 return 0, errors.New("Scans do not have common points") | 249 return 0, errors.New("scans do not have common points") |
250 } | 250 } |
251 | 251 |
252 log.Printf("info: z range: %.3f - %.3f\n", zMin, zMax) | 252 log.Printf("info: z range: %.3f - %.3f\n", zMin, zMax) |
253 | 253 |
254 var heights []float64 | 254 var heights []float64 |