Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of ForcingModel upon reading bc file is incorrect #306

Closed
veenstrajelmer opened this issue Aug 17, 2022 · 3 comments
Closed

Validation of ForcingModel upon reading bc file is incorrect #306

veenstrajelmer opened this issue Aug 17, 2022 · 3 comments
Milestone

Comments

@veenstrajelmer
Copy link
Collaborator

Describe the bug
When reading a bc file for salinity (with multiple times and layers), there is a validation error, while this file was properly read by the dflowfm software.

ValidationError: 3 validation errors for ForcingModel
salinity_bc_simple.bc -> forcing -> 0 -> bc_simple_0001 -> verticalPositions
  field required (type=value_error.missing)
salinity_bc_simple.bc -> forcing -> 0 -> bc_simple_0001 -> verticalInterpolation
  field required (type=value_error.missing)
salinity_bc_simple.bc -> forcing -> 0 -> bc_simple_0001 -> verticalPositionType
  field required (type=value_error.missing)

To Reproduce

file_bc_3D = Path('salinity_simple.bc')
m = ForcingModel(file_bc_3D)

Expected behavior
Correct reading of the file

Screenshots
If applicable, add screenshots to help explain your problem.

Version info (please complete the following information):

  • OS: Windows, Anaconda, Spyder
  • Version: 0.3.0

Additional context
The file contents of salinity_simple.bc:

[forcing]
Name                            = bc_simple_0001
Function                        = t3D
Time-interpolation              = linear
Vertical position type          = zdatum
Vertical position specification = -34.43  -25.21  -18.50
Quantity                        = time
Unit                            = MINUTES since 1993-01-01 00:00:00
Quantity                        = salinitybnd
Unit                            = 1e-3
Vertical position               = 1
Quantity                        = salinitybnd
Unit                            = 1e-3
Vertical position               = 2
Quantity                        = salinitybnd
Unit                            = 1e-3
Vertical position               = 3
10800.0  3.4398e+01  3.4393e+01  3.4392e+01 
10800.0  3.4398e+01  3.4393e+01  3.4392e+01 
12240.0  3.4332e+01  3.4318e+01  3.4314e+01 
12240.0  3.4332e+01  3.4318e+01  3.4314e+01 
13680.0  3.4290e+01  3.4263e+01  3.4253e+01 
13680.0  3.4290e+01  3.4263e+01  3.4253e+01 
15120.0  3.4266e+01  3.4246e+01  3.4220e+01 
15120.0  3.4266e+01  3.4246e+01  3.4220e+01 
16560.0  3.4259e+01  3.4221e+01  3.4198e+01 
16560.0  3.4259e+01  3.4221e+01  3.4198e+01 
18000.0  3.4238e+01  3.4206e+01  3.4200e+01 
18000.0  3.4238e+01  3.4206e+01  3.4200e+01 
19440.0  3.4331e+01  3.4293e+01  3.4266e+01 
19440.0  3.4331e+01  3.4293e+01  3.4266e+01 
20880.0  3.4510e+01  3.4472e+01  3.4441e+01 
20880.0  3.4510e+01  3.4472e+01  3.4441e+01 
22320.0  3.4668e+01  3.4666e+01  3.4665e+01 
22320.0  3.4668e+01  3.4666e+01  3.4665e+01 
@veenstrajelmer
Copy link
Collaborator Author

The suggestion was made to convert the keywords to different (1D2D) naming convention. verticalInterpolation was added to avoid an error (even though linear is default in the kernel, so should not be a mandatory keyword in my view). Unfortunately, zdatum is not implemented yet so that raises an error. Also, the verticalPositions value is not interpreted as a valid list:

ValidationError: 2 validation errors for ForcingModel
salinity_bc_simple_newnames.bc -> forcing -> 0 -> bc_simple_0001 -> verticalPositions
  value is not a valid list (type=type_error.list)
salinity_bc_simple_newnames.bc -> forcing -> 0 -> bc_simple_0001 -> verticalPositionType
  value is not a valid enumeration member; permitted: 'percBed', 'ZBed' (type=type_error.enum; enum_values=[<VerticalPositionType.percentage_bed: 'percBed'>, <VerticalPositionType.z_bed: 'ZBed'>])

The file contents:

[forcing]
Name                            = bc_simple_0001
Function                        = t3D
Time-interpolation              = linear
verticalPositionType          = ZBed
verticalPositions           = -34.43  -25.21  -18.50
verticalInterpolation      = linear
Quantity                        = time
Unit                            = MINUTES since 1993-01-01 00:00:00
Quantity                        = salinitybnd
Unit                            = 1e-3
Vertical position               = 1
Quantity                        = salinitybnd
Unit                            = 1e-3
Vertical position               = 2
Quantity                        = salinitybnd
Unit                            = 1e-3
Vertical position               = 3
10800.0  3.4398e+01  3.4393e+01  3.4392e+01 
10800.0  3.4398e+01  3.4393e+01  3.4392e+01 
12240.0  3.4332e+01  3.4318e+01  3.4314e+01 
12240.0  3.4332e+01  3.4318e+01  3.4314e+01 
13680.0  3.4290e+01  3.4263e+01  3.4253e+01 
13680.0  3.4290e+01  3.4263e+01  3.4253e+01 
15120.0  3.4266e+01  3.4246e+01  3.4220e+01 
15120.0  3.4266e+01  3.4246e+01  3.4220e+01 
16560.0  3.4259e+01  3.4221e+01  3.4198e+01 
16560.0  3.4259e+01  3.4221e+01  3.4198e+01 
18000.0  3.4238e+01  3.4206e+01  3.4200e+01 
18000.0  3.4238e+01  3.4206e+01  3.4200e+01 
19440.0  3.4331e+01  3.4293e+01  3.4266e+01 
19440.0  3.4331e+01  3.4293e+01  3.4266e+01 
20880.0  3.4510e+01  3.4472e+01  3.4441e+01 
20880.0  3.4510e+01  3.4472e+01  3.4441e+01 
22320.0  3.4668e+01  3.4666e+01  3.4665e+01 
22320.0  3.4668e+01  3.4666e+01  3.4665e+01 

@priscavdsluis
Copy link
Contributor

@veenstrajelmer,
For the issues mentioned in your last comment I have made two issues:
#323 (Add support for ZDatum for Vertical Position Type)
#325 (t3d.verticalPositions is not parsed to a list and will raise a validation error)

@arthurvd arthurvd added this to the Release 0.4 milestone Sep 20, 2022
@veenstrajelmer
Copy link
Collaborator Author

This issue is solved by #356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants