Mercurial > gemma
comparison pkg/imports/fa.go @ 4513:9b1e5a3ed3cc
FA import: if no LOS is provided assume LOS3.
Near the black sea no LOS is provided with available fairway depth
data, as the conditions (and requirements) are actually _better_ than
LOS3. For gemma it is acceptable to assume LOS3 for these cases to
fit into the requirement of given a LOS so that current reports
and calculations work.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 04 Oct 2019 16:39:42 +0200 |
parents | 7128741faeb9 |
children | 7465b6244d5e |
comparison
equal
deleted
inserted
replaced
4512:7caf620dda50 | 4513:9b1e5a3ed3cc |
---|---|
298 fas []*ifaf.FairwayAvailability, | 298 fas []*ifaf.FairwayAvailability, |
299 tx *sql.Tx, | 299 tx *sql.Tx, |
300 feedback Feedback, | 300 feedback Feedback, |
301 ) ([]string, error) { | 301 ) ([]string, error) { |
302 | 302 |
303 default_los := ifaf.LosEnumLOS3 | |
304 | |
303 insertFAStmt, err := tx.PrepareContext(ctx, insertFASQL) | 305 insertFAStmt, err := tx.PrepareContext(ctx, insertFASQL) |
304 if err != nil { | 306 if err != nil { |
305 return nil, err | 307 return nil, err |
306 } | 308 } |
307 defer insertFAStmt.Close() | 309 defer insertFAStmt.Close() |
369 feedback.Info("Add %d Pdfs", bnPdfCount) | 371 feedback.Info("Add %d Pdfs", bnPdfCount) |
370 } | 372 } |
371 if faRes.Effective_fairway_availability != nil { | 373 if faRes.Effective_fairway_availability != nil { |
372 efaCount := 0 | 374 efaCount := 0 |
373 for _, efa := range faRes.Effective_fairway_availability.EffectiveFairwayAvailability { | 375 for _, efa := range faRes.Effective_fairway_availability.EffectiveFairwayAvailability { |
374 los := efa.Level_of_Service | 376 los := &default_los |
377 if efa.Level_of_Service != nil { | |
378 los = efa.Level_of_Service | |
379 } | |
375 fgt := efa.Forecast_generation_time | 380 fgt := efa.Forecast_generation_time |
376 if efa.Forecast_generation_time.Status == pgtype.Undefined { | 381 if efa.Forecast_generation_time.Status == pgtype.Undefined { |
377 fgt = pgtype.Timestamp{ | 382 fgt = pgtype.Timestamp{ |
378 Status: pgtype.Null, | 383 Status: pgtype.Null, |
379 } | 384 } |
405 } | 410 } |
406 | 411 |
407 if faRes.Reference_values != nil { | 412 if faRes.Reference_values != nil { |
408 rvCount := 0 | 413 rvCount := 0 |
409 for _, fav := range faRes.Reference_values.ReferenceValue { | 414 for _, fav := range faRes.Reference_values.ReferenceValue { |
415 los := &default_los | |
416 if fav.Level_of_Service != nil { | |
417 los = fav.Level_of_Service | |
418 } | |
410 res, err := insertFAVStmt.ExecContext( | 419 res, err := insertFAVStmt.ExecContext( |
411 ctx, | 420 ctx, |
412 faID, | 421 faID, |
413 fav.Level_of_Service, | 422 los, |
414 fav.Fairway_depth, | 423 fav.Fairway_depth, |
415 fav.Fairway_width, | 424 fav.Fairway_width, |
416 fav.Fairway_radius, | 425 fav.Fairway_radius, |
417 fav.Shallowest_spot_Lat, | 426 fav.Shallowest_spot_Lat, |
418 fav.Shallowest_spot_Lon, | 427 fav.Shallowest_spot_Lon, |