FMDAp can read DA pfs files and gives convenient access to the settings of several sections.
import fmdap
pfs_file = '../tests/testdata/OresundHD2D_EnKF10/OresundHD2D_EnKF10.m21fm'
pfs = fmdap.Pfs(pfs_file)
pfs.sections
['TIME', 'METHOD', 'MODEL_ERROR_MODEL', 'MODEL_STATE_SPACE', 'MEASUREMENTS', 'ESTIMATOR', 'ERRCOV_IO', 'ENSEMBLE_IO', 'DIAGNOSTICS']
pfs.METHOD
{'type': 1, 'ensemble_size': 10, 'rfactor_relative': 2}
pfs.model_errors
include | type | n_bounds | bound_code | st_dev | perturbation_type | propagation_type | propagation_parameter | initialization_type | horizontal_discretization_type | horizontal_corr_function | horizontal_corr | horizontal_grid_spacing | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | wlbc | 1 | 2 | 0.03 | additive | AR(1) | 10800 | 0 | 1 | 1 | 70000 | NaN |
2 | 1 | wlbc | 1 | 3 | 0.03 | additive | AR(1) | 14400 | 0 | 2 | 1 | 120000 | 20000 |
pfs.measurements
include | name | measured_variable | file_name | data_offset | item_number | position | coordinate_type | type_time_interpolation | st_dev | |
---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | Viken | water level | ..\obs\smhi_2228_viken.dfs0 | 0.3 | 1 | [12.5817, 56.128] | LONG/LAT | 1 | 0.02 |
2 | 2 | Drogden | water level | ..\obs\dmi_30357_Drogden_Fyr_cleaned.dfs0 | 0.25 | 1 | [12.7113, 55.5364] | LONG/LAT | 0 | 0.02 |
3 | 1 | Klagshamn | water level | ..\obs\smhi_2095_klagshamn.dfs0 | 0.18 | 1 | [12.89106996, 55.5165157] | LONG/LAT | 0 | 0.02 |
4 | 2 | Barsebaeck | water level | ..\obs\smhi_2099_barsebaeck.dfs0 | 0.28 | 1 | [12.90155524, 55.75885144] | LONG/LAT | 0 | 0.02 |
pfs.measurement_positions.set_index("name")
x | y | |
---|---|---|
name | ||
Viken | 12.581700 | 56.128000 |
Drogden | 12.711300 | 55.536400 |
Klagshamn | 12.891070 | 55.516516 |
Barsebaeck | 12.901555 | 55.758851 |
pfs.diagnostics
type | measurement_id | file_name | position | variable_name | include | coordinate_type | |
---|---|---|---|---|---|---|---|
1 | 1 | 1 | Diagnostics_Meas1_Viken.dfs0 | NaN | NaN | NaN | NaN |
2 | 1 | 2 | Diagnostics_Meas2_Drogden.dfs0 | NaN | NaN | NaN | NaN |
3 | 1 | 3 | Diagnostics_Meas3_Klagshamn.dfs0 | NaN | NaN | NaN | NaN |
4 | 1 | 4 | Diagnostics_Meas4_Barsebaeck.dfs0 | NaN | NaN | NaN | NaN |
5 | 2 | NaN | Diagnostics_wlbc_err_North.dfs0 | [342295.53, 6219783.16] | err01_wlbc | NaN | NaN |
6 | 2 | NaN | Diagnostics_wlbc_err_South.dfs0 | [350230.51, 6136002.01] | err02_wlbc | NaN | NaN |
7 | 2 | NaN | Diagnostics_err03_wind_v_err_at_Drogden.dfs0 | [12.7113, 55.5364] | err03_wind_v | 0 | LONG/LAT |
8 | 2 | NaN | Diagnostics_err04_bed_resis_err.dfs0 | [12.7113, 55.5364] | err04_hdpar | 0 | LONG/LAT |
9 | 3 | NaN | Diagnostics_Global_DA_statistics.dfs0 | NaN | NaN | NaN | NaN |
import mikeio
mesh = mikeio.open('../tests/testdata/Oresund_mesh_GEO.mesh')
pfs.validate_positions(mesh, pfs.measurements)
name | x_old | y_old | inside | dist | elem_id | x_cc | y_cc | |
---|---|---|---|---|---|---|---|---|
1 | Viken | 12.581700 | 56.128000 | True | 0.001887 | 1932 | 12.583287 | 56.126979 |
2 | Drogden | 12.711300 | 55.536400 | True | 0.004142 | 2885 | 12.711818 | 55.540510 |
3 | Klagshamn | 12.891070 | 55.516516 | True | 0.007662 | 1012 | 12.898017 | 55.513284 |
4 | Barsebaeck | 12.901555 | 55.758851 | True | 0.001654 | 1494 | 12.902781 | 55.757742 |