Skip to content

fix: add object.__init__() call in MFDatasetCommonDims and WebMapService classes#3078

Open
shubhamdagar9854 wants to merge 2 commits into
Open-MSS:developfrom
shubhamdagar9854:fix/missed-super-init-call
Open

fix: add object.__init__() call in MFDatasetCommonDims and WebMapService classes#3078
shubhamdagar9854 wants to merge 2 commits into
Open-MSS:developfrom
shubhamdagar9854:fix/missed-super-init-call

Conversation

@shubhamdagar9854

Copy link
Copy Markdown

…ice classes

Purpose of PR?:

Fixes #2750

Does this PR introduce a breaking change?
No

If the changes in this PR are manually verified, list down the scenarios covered::

  • Added super().init() call in MFDatasetCommonDims class in mslib/utils/netCDF4tools.py
  • Added super().init() call in WebMapService class in mslib/utils/ogcwms.py

Additional information for reviewer? :
Both classes were missing a call to the parent init. Added super().init() with appropriate arguments in both classes.

Does this PR results in some Documentation changes?
No

Checklist:
-[✅] Bug fix. Fixes #2750

  • New feature (Non-API breaking changes that adds functionality)
    -[✅] PR Title follows the convention of `fix : add object.init() call in MFDatasetCommonDims and WebMapService classes
  • Commit has unit tests

@shubhamdagar9854

Copy link
Copy Markdown
Author

After investigation, the test failures are caused by two separate issues:

  1. MFDatasetCommonDims (netCDF4tools.py): Fixed by using object.init(self)
    instead of super().init() since this class intentionally overrides the parent
    netCDF4.MFDataset logic. Calling super().init() causes OSError because MSS
    test files do not have an aggregation dimension.

  2. WebMapService (ogcwms.py): Fixed by using object.init(self) instead of
    super().init() since this class intentionally bypasses the parent
    initialization. Additionally fixed readString() method by encoding the XML string
    to bytes before parsing, resolving the ValueError: Unicode strings with encoding
    declaration are not supported.

The following failures are pre-existing and unrelated to this PR:

  • Build Gallery / Test-MSS-docs: shutil.move fails because plots folder is not
    created, this issue exists on the develop branch as well.
  • RTFD env basics / Test-RTFD: documentation build failure, pre-existing issue.

@ReimarBauer

ReimarBauer commented Jun 14, 2026

Copy link
Copy Markdown
Member

After investigation, the test failures are caused by two separate issues:

  1. MFDatasetCommonDims (netCDF4tools.py): Fixed by using object.init(self)
    instead of super().init() since this class intentionally overrides the parent
    netCDF4.MFDataset logic. Calling super().init() causes OSError because MSS
    test files do not have an aggregation dimension.
  2. WebMapService (ogcwms.py): Fixed by using object.init(self) instead of
    super().init() since this class intentionally bypasses the parent
    initialization. Additionally fixed readString() method by encoding the XML string
    to bytes before parsing, resolving the ValueError: Unicode strings with encoding
    declaration are not supported.

The following failures are pre-existing and unrelated to this PR:

  • Build Gallery / Test-MSS-docs: shutil.move fails because plots folder is not
    created, this issue exists on the develop branch as well.
  • RTFD env basics / Test-RTFD: documentation build failure, pre-existing issue.

The build Gallery and RTFD tests run without your change

This is also a consequent of your changes

FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_HSec::test_invalid_crs_codes[EPSG:12345678] - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.SFC.EUR_LL015.036.sfc.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_HSec::test_meter_crs_codes[EPSG:3995] - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.SFC.EUR_LL015.036.sfc.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_HSec::test_degree_crs_codes[MSS:merc,40] - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.SFC.EUR_LL015.036.sfc.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_HSec::test_degree_crs_codes[EPSG:77790010] - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.SFC.EUR_LL015.036.sfc.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_CloudsWindStyle_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.P_derived.EUR_LL015.036.ml.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_CloudsStyle_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.P_derived.EUR_LL015.036.ml.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_ProbabilityOfWCBStyle_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.P_derived.EUR_LL015.036.ml.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_SpecificHumdityStyle_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.P_derived.EUR_LL015.036.ml.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_EMACEyja_Style_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.P_derived.EUR_LL015.036.ml.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_PotentialVorticityStyle_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.P_derived.EUR_LL015.036.ml.nc does not have a aggregation dimension
FAILED tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_LagrantoTrajStyle_PL_01 - OSError: master dataset /tmp/tmpjsajgeja/mswms/testdata/20121017_12_ecmwf_forecast.PRESSURE_LEVELS.EUR_LL015.036.pl.nc does not have a aggregation dimension

@shubhamdagar9854

Copy link
Copy Markdown
Author

I tried object.init(self) but it causes test failures as shown in CI.
These classes intentionally skip parent init. Could you suggest the
correct fix, or should this warning be suppressed with a comment instead?

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

Successfully merging this pull request may close these issues.

Missed call to __init__ of the super class

2 participants