Skip to content

Fix deprecation and run-time warnings #112

Open

Description

@mhidas

Various DeprecationWarning and RuntimeWarning pop up when running the unittests. These should ideally be fixed before they become errors.

E.g.

test_aodntools/ncwriter/test_template.py::TestDatasetTemplate::test_ensure_completeness
  /home/travis/build/aodn/python-aodntools/test_aodntools/ncwriter/test_template.py:282: DeprecationWarning: Please use assertRaisesRegex instead.
    template.ensure_completeness)
  /home/travis/build/aodn/python-aodntools/test_aodntools/ncwriter/test_template.py:286: DeprecationWarning: Please use assertRaisesRegex instead.
    template.ensure_completeness)

test_aodntools/ncwriter/test_template.py::TestDatasetTemplate::test_ensure_consistency
  /home/travis/build/aodn/python-aodntools/test_aodntools/ncwriter/test_template.py:318: DeprecationWarning: Please use assertRaisesRegex instead.
    template.ensure_consistency)  # now should fail because dim X is already set
  /home/travis/build/aodn/python-aodntools/test_aodntools/ncwriter/test_template.py:323: DeprecationWarning: Please use assertRaisesRegex instead.
    self.assertRaisesRegexp(ValidationError, 'undefined dimensions', template.ensure_consistency)
  /home/travis/build/aodn/python-aodntools/test_aodntools/ncwriter/test_template.py:330: DeprecationWarning: Please use assertRaisesRegex instead.
    template.ensure_consistency

test_aodntools/ncwriter/test_template.py::TestDatasetTemplate::test_invalid_json
  /home/travis/build/aodn/python-aodntools/test_aodntools/ncwriter/test_template.py:105: DeprecationWarning: Please use assertRaisesRegex instead.
    self.assertRaisesRegexp(ValueError, error_pattern, DatasetTemplate.from_json, BAD_JSON)

test_aodntools/timeseries_products/test_aggregated_timeseries.py::TestAggregatedTimeseries::test_main_aggregator
  /home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/numpy/core/fromnumeric.py:83: RuntimeWarning: invalid value encountered in less
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
  /home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/numpy/core/fromnumeric.py:83: RuntimeWarning: invalid value encountered in greater
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
  /home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/numpy/core/fromnumeric.py:83: RuntimeWarning: invalid value encountered in reduce
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)

Activity

  1. added
    aggregated_timeseriesIssues relating to the aggregated time series product
    gridded_timeseriesIssues relating to the gridded time series product
    hourly_timeseriesIssues relating to the hourly time series product
    ncwriterRelated to creating netCDF files based on templates
    and removed
    gridded_timeseriesIssues relating to the gridded time series product
    hourly_timeseriesIssues relating to the hourly time series product
    on Mar 18, 2020
  2. mhidas commented on Mar 18, 2020

    @mhidas
    ContributorAuthor

    Yep, I just wasn't ready to fix them right now, and as you say the numpy ones will take a bit more debugging, so just noting here as a reminder for later.

  3. mhidas commented on Mar 19, 2020

    @mhidas
    ContributorAuthor
    /sw/chef/src/python-aodntools/aodntools/timeseries_products/hourly_timeseries.py:540: PendingDeprecationWarning: dropping variables using `drop` will be deprecated; using drop_vars is encouraged.
      nc_aggregated = nc_aggregated.drop('OBSERVATION')
    
  4. mhidas commented on Mar 24, 2020

    @mhidas
    ContributorAuthor
    /sw/chef/src/python-aodntools/aodntools/timeseries_products/gridded_timeseries.py:88: SerializationWarning: saving variable TEMP_count with floating point data as an integer dtype without any _FillValue to use for NaNs
      agg_dataset.to_netcdf(output_path, encoding=encoding, format='NETCDF4_CLASSIC')
    
  5. added
    gridded_timeseriesIssues relating to the gridded time series product
    hourly_timeseriesIssues relating to the hourly time series product
    on Mar 24, 2020
  6. mhidas commented on May 6, 2020

    @mhidas
    ContributorAuthor
    velocity_hourly_timeseries.py:195: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
      chunk_start = np.datetime64(nc.attrs['time_deployment_start'])
    velocity_hourly_timeseries.py:196: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
      chunk_end = np.datetime64(nc.attrs['time_deployment_end'])
    
  7. added
    velocity_hourlyIssues relating to the velocity hourly time series product
    on May 6, 2020
  8. added this to the v2.0 milestone on Jun 7, 2022
  9. mhidas commented on Jan 9, 2023

    @mhidas
    ContributorAuthor

    See also #136 :

    hourly_timeseries.py:401: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

    and

    hourly_timeseries.py:311: FutureWarning: 'base' in .resample() and in Grouper() is deprecated.
    The new arguments that you should use are 'offset' or 'origin'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

aggregated_timeseriesIssues relating to the aggregated time series productgridded_timeseriesIssues relating to the gridded time series producthourly_timeseriesIssues relating to the hourly time series productncwriterRelated to creating netCDF files based on templatesvelocity_hourlyIssues relating to the velocity hourly time series product

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions