diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 50f4c73..695d86c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -46,7 +46,8 @@ jobs: - "3.11" os: - ubuntu-latest - - macos-13 + - macos-26 + - macos-26-intel - windows-latest env: MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434 diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index b71be67..89d4713 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,8 +1,11 @@ -name: Publish Resourcecode 📦 to PyPI and TestPypi (for providing test builds to alpha users) +name: Publish Resourcecode 📦 to PyPI on: - pull_request: push: + branches: + - main + tags: + - 'v*' # Déclenche uniquement pour les tags commençant par 'v' jobs: build: @@ -12,9 +15,9 @@ jobs: steps: - uses: actions/checkout@v6 - name: Install uv - uses: astral-sh/setup-uv@v8.1.0 + uses: astral-sh/setup-uv@v8.2.0 with: - version: "0.11.16" + version: "" enable-cache: true - name: Build a binary wheel and a source tarball run: uv build @@ -24,12 +27,50 @@ jobs: name: resourcecode path: dist/ + verify-version: + name: Verify package version + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: resourcecode + path: dist/ + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install package in development mode + run: pip install -e . + - name: Verify version consistency + run: | + # Extraire la version du package installé + PACKAGE_VERSION=$(python -c "import resourcecode; print(resourcecode.__version__)") + TAG_VERSION=${GITHUB_REF#refs/tags/v} + + echo "Tag version: $TAG_VERSION" + echo "Package version: $PACKAGE_VERSION" + + if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then + echo "ERROR: Version mismatch between tag ($TAG_VERSION) and package ($PACKAGE_VERSION)" + exit 1 + fi + + # Vérifie que la version existe déjà sur PyPI + EXISTS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/resourcecode/$TAG_VERSION/json") + if [ "$EXISTS" -ne 404 ]; then + echo "ERROR: Version $TAG_VERSION already exists on PyPI" + exit 1 + fi + publish-to-pypi: - name: >- - Publish Resourcecode 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + name: Publish Resourcecode 📦 to PyPI needs: - build + - verify-version runs-on: ubuntu-latest environment: name: publish @@ -51,9 +92,7 @@ jobs: run: uv publish github-release: - name: >- - Sign the Resourcecode 📦 with Sigstore - and upload them to GitHub Release + name: Sign the Resourcecode 📦 with Sigstore and upload to GitHub Release needs: - publish-to-pypi runs-on: ubuntu-latest @@ -82,41 +121,12 @@ jobs: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' - --notes "" + --notes "Release ${{ github.ref_name }}" + --generate-notes - name: Upload artifact signatures to GitHub Release env: GITHUB_TOKEN: ${{ github.token }} - # Upload to GitHub Release using the `gh` CLI. - # `dist/` contains the built packages, and the - # sigstore-produced signatures and certificates. run: >- gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}' - - publish-to-testpypi: - name: Publish Resourcecode 📦 to TestPyPI - if: "!startsWith(github.ref, 'refs/tags/')" # only publish to testPyPI for non-tagged pushes - needs: - - build - runs-on: ubuntu-latest - - environment: - name: publish - url: https://test.pypi.org/p/resourcecode - - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: resourcecode - path: dist/ - - name: Install uv - uses: astral-sh/setup-uv@v8.1.0 - with: - version: "0.11.16" - - name: Publish Resourcecode 📦 to TestPyPI - run: uv publish --publish-url https://test.pypi.org/legacy/ diff --git a/.gitignore b/.gitignore index d40efb6..122674c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,11 @@ uv.lock .venv/ # Jupyter checkpoints -**/.ipynb_checkpoints/ \ No newline at end of file +**/.ipynb_checkpoints/ + +/resourcecode/__pycache__ +/resourcecode/*/__pycache__ +*/__pycache__ +/build +/.doctrees +/resourcecode.egg-info diff --git a/CHANGELOG.md b/CHANGELOG.md index a380d1d..9157793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,31 @@ +## Version 2.1 (TBD) + +### 👷 Bug Fixes + - Add Time Zone information in index from `download_data()` (thanks to @Nouhaylaa1) + - Updated tests accordingly + +### Packaging & Tooling + - Fix the CI/CD to check before uploading to pypi and remove TestPyPi (unused) + +## Version 2.0 (02/06/2026) (thanks to @chabotsi) + +### Compatibility Updates + - Removed `numexpr` dependency for full pyiodide compatibility + - Updated `np.trapz()` → `np.trapezoid()` (numpy API change) + - Migrated from `scipy.stats.mvn()` to `scipy.stats.multivariate_normal()` + - Fixed crash in `download_data()` with Python 3.14 and numpy/xarray when opening files + - Updated dependency versions for marimo wasm compatibility + +### 👷 Bug Fixes + - Fixed `censgaussfit()` to handle positive semi-definite sigma matrices + - Updated tests to check values instead of `dtypes` + - Set fixed random seed for reproducible tests + +### Packaging & Tooling + - Moved `config.ini` into the package for distribution + - Migrated project to uv package manager + + ## Version 1.3.1 (TBD) ### 👷 Bug fixes - Pin version of Numpy to be < 2.0.0 because `trapz` is renamed in higher versions diff --git a/CITATION.cff b/CITATION.cff index 2e5fa50..7daa86b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,8 +8,8 @@ type: software license: 'GPL-3.0-or-later' repository-code: "https://resourcecode-project.github.io/py-resourcecode/" url: "https://resourcecode-project.github.io/py-resourcecode/" -version: 1.3.1 -date-released: '2023-03-18' +version: 2.1.0 +date-released: '2026-06-30' authors: - given-names: Nicolas family-names: Raillard @@ -38,4 +38,3 @@ authors: family-names: Papillon email: louis.papillon@innosea.fr affiliation: Innosea - diff --git a/README.md b/README.md index acd6e9b..5f123ba 100644 --- a/README.md +++ b/README.md @@ -85,18 +85,18 @@ See the following example: ... """) >>> data - fp hs -2017-01-01 00:00:00 0.412 0.246 -2017-01-01 01:00:00 0.410 0.212 -2017-01-01 02:00:00 0.414 0.172 -2017-01-01 03:00:00 0.437 0.138 -2017-01-01 04:00:00 0.464 0.102 -... ... ... -2017-03-19 02:00:00 0.088 0.056 -2017-03-19 03:00:00 0.088 0.066 -2017-03-19 04:00:00 0.089 0.078 -2017-03-19 05:00:00 0.090 0.084 -2017-03-19 06:00:00 0.732 0.086 + fp hs +2017-01-01 00:00:00+00:00 0.412 0.246 +2017-01-01 01:00:00+00:00 0.410 0.212 +2017-01-01 02:00:00+00:00 0.414 0.172 +2017-01-01 03:00:00+00:00 0.437 0.138 +2017-01-01 04:00:00+00:00 0.464 0.102 +... ... ... +2017-03-19 02:00:00+00:00 0.088 0.056 +2017-03-19 03:00:00+00:00 0.088 0.066 +2017-03-19 04:00:00+00:00 0.089 0.078 +2017-03-19 05:00:00+00:00 0.090 0.084 +2017-03-19 06:00:00+00:00 0.732 0.086 [1855 rows x 2 columns] diff --git a/doc/conf.py b/doc/conf.py index 051e530..b4ea593 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/__init__.py b/resourcecode/__init__.py index bf38226..0ad48dd 100644 --- a/resourcecode/__init__.py +++ b/resourcecode/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/__version__.py b/resourcecode/__version__.py index bd425de..84faa84 100644 --- a/resourcecode/__version__.py +++ b/resourcecode/__version__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # This file is part of Resourcecode. @@ -17,5 +17,5 @@ # You should have received a copy of the GNU General Public License along # with Resourcecode. If not, see . -numversion = (2, 0, 0) +numversion = (2, 1, 0) __version__ = ".".join(str(num) for num in numversion) diff --git a/resourcecode/client.py b/resourcecode/client.py index 81f26fd..b6bca7b 100644 --- a/resourcecode/client.py +++ b/resourcecode/client.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. @@ -212,7 +212,7 @@ def get_dataframe_from_criteria(self, criteria: Union[str, dict]) -> pd.DataFram try: node_id = int(parsed_criteria["node"]) except ValueError: # failed to convert node to an integer - raise BadPointIdError("Point Id must be an integer, can not be " f"{parsed_criteria['node']!r}") + raise BadPointIdError(f"Point Id must be an integer, can not be {parsed_criteria['node']!r}") else: if node_id not in self.possible_points_id: raise BadPointIdError(f"{parsed_criteria['node']} is an unknown pointId.") @@ -276,7 +276,7 @@ def get_dataframe_from_criteria(self, criteria: Union[str, dict]) -> pd.DataFram return pd.DataFrame( result_array[:, 1:], columns=parsed_criteria["parameter"], - index=pd.to_datetime(index_array.astype(np.int64), unit="ms"), + index=pd.to_datetime(index_array.astype(np.int64), unit="ms", utc=True), ) def _get_rawdata_from_criteria(self, single_parameter_criteria): @@ -298,4 +298,4 @@ def _get_rawdata_from_criteria(self, single_parameter_criteria): if response.ok: return response.json() - raise ValueError("Unable to get a response from the database" "(status code = {})".format(response.status_code)) + raise ValueError("Unable to get a response from the database(status code = {})".format(response.status_code)) diff --git a/resourcecode/data/__init__.py b/resourcecode/data/__init__.py index fcd8c70..ad83c61 100644 --- a/resourcecode/data/__init__.py +++ b/resourcecode/data/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/eva/__init__.py b/resourcecode/eva/__init__.py index ee4b3cf..d5fdece 100644 --- a/resourcecode/eva/__init__.py +++ b/resourcecode/eva/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 # Extreme Values Modelling -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/eva/censgaussfit.py b/resourcecode/eva/censgaussfit.py index 62a5fb0..8bb0787 100644 --- a/resourcecode/eva/censgaussfit.py +++ b/resourcecode/eva/censgaussfit.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/eva/extrema.py b/resourcecode/eva/extrema.py index 282cf1d..9958717 100644 --- a/resourcecode/eva/extrema.py +++ b/resourcecode/eva/extrema.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/eva/huseby.py b/resourcecode/eva/huseby.py index 344ef5a..f7f5584 100644 --- a/resourcecode/eva/huseby.py +++ b/resourcecode/eva/huseby.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/eva/simulation.py b/resourcecode/eva/simulation.py index d2a1482..5f3b471 100644 --- a/resourcecode/eva/simulation.py +++ b/resourcecode/eva/simulation.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/exceptions.py b/resourcecode/exceptions.py index 64cb055..70244a7 100644 --- a/resourcecode/exceptions.py +++ b/resourcecode/exceptions.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/io.py b/resourcecode/io.py index 293f064..df813ad 100644 --- a/resourcecode/io.py +++ b/resourcecode/io.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/opsplanning/__init__.py b/resourcecode/opsplanning/__init__.py index 424b6a8..805824e 100644 --- a/resourcecode/opsplanning/__init__.py +++ b/resourcecode/opsplanning/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. @@ -44,13 +44,13 @@ The module, in order of execution to produce a full result, consists of: 1. Use a pandas query to limit the dataset to the timestamps matching - operational criteria (`data.query("hs < 2 and tp < 3")` for instance) + operational criteria (`data.query("hs < 2 and tp < 3")` for instance) 2. ww_calc - method to identify the weather windows 3. oplen_calc - method to calculate operational length 4. wwmonstats - method that produces monthly statistics of number of - weather windows + weather windows 5. olmonstats - method that produces monthly statistics of operational - length values + length values Created on Wed Dec 2 14:14:48 2020 @@ -156,12 +156,12 @@ def oplen_calc(critsubs, oplen, critical_operation=False, date=1, monstrt=True): Nominal length of the operation (if no downtime), in hours critical_operation : BOOLEAN - False for non-critical operations: - With this flag to False, it is assumed that the operation can be - halted for the duration of weather downtime and started again + With this flag to False, it is assumed that the operation can be + halted for the duration of weather downtime and started again - True is for continuous window search: - In this case operations can't be halted and if stopped due to - weather downtime have to restart from the beginning once the - conditions allow + In this case operations can't be halted and if stopped due to + weather downtime have to restart from the beginning once the + conditions allow The default is non critical operation. date : INT,DATETIME optional @@ -207,6 +207,7 @@ def oplen_calc(critsubs, oplen, critical_operation=False, date=1, monstrt=True): start=dt.datetime(yerng[0], morng[0], 1), end=dt.datetime(yerng[1], morng[1], 1), freq="MS", + tz="utc", ) daterng = daterng.shift(dayval - 1, freq="D") oplendetect = pd.Series(np.zeros(daterng.shape[0], dtype="timedelta64[s]"), index=daterng) @@ -215,7 +216,7 @@ def oplen_calc(critsubs, oplen, critical_operation=False, date=1, monstrt=True): daterng = pd.date_range(start=date, end=date) oplendetect = pd.Series(np.zeros(daterng.shape[0], dtype="timedelta64[s]"), index=daterng) else: - msg = "Variable date in single result calculation should be" " a datetime object" + msg = "Variable date in single result calculation should be a datetime object" raise NameError(msg) else: raise NameError("Input option monstrt should be boolean") diff --git a/resourcecode/plotly_theme.py b/resourcecode/plotly_theme.py index 9953267..b29cc4b 100644 --- a/resourcecode/plotly_theme.py +++ b/resourcecode/plotly_theme.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/producible_assessment/__init__.py b/resourcecode/producible_assessment/__init__.py index 97fcb41..8902031 100644 --- a/resourcecode/producible_assessment/__init__.py +++ b/resourcecode/producible_assessment/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/producible_assessment/main.py b/resourcecode/producible_assessment/main.py index 4b800e7..69aabfc 100644 --- a/resourcecode/producible_assessment/main.py +++ b/resourcecode/producible_assessment/main.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/resassess/__init__.py b/resourcecode/resassess/__init__.py index 895f9ca..9aad1b1 100644 --- a/resourcecode/resassess/__init__.py +++ b/resourcecode/resassess/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/__init__.py b/resourcecode/spectrum/__init__.py index 1d982ac..b52c020 100644 --- a/resourcecode/spectrum/__init__.py +++ b/resourcecode/spectrum/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 # Spectral data tools -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/compute_parameters.py b/resourcecode/spectrum/compute_parameters.py index 19ae022..4776844 100644 --- a/resourcecode/spectrum/compute_parameters.py +++ b/resourcecode/spectrum/compute_parameters.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/convert2D1D.py b/resourcecode/spectrum/convert2D1D.py index 893df16..b577050 100644 --- a/resourcecode/spectrum/convert2D1D.py +++ b/resourcecode/spectrum/convert2D1D.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/dispersion.py b/resourcecode/spectrum/dispersion.py index cfabe8f..e9c7d59 100644 --- a/resourcecode/spectrum/dispersion.py +++ b/resourcecode/spectrum/dispersion.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/download_data.py b/resourcecode/spectrum/download_data.py index 13ae3ef..09dcccc 100644 --- a/resourcecode/spectrum/download_data.py +++ b/resourcecode/spectrum/download_data.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/jonswap.py b/resourcecode/spectrum/jonswap.py index b14fb40..7e73a01 100644 --- a/resourcecode/spectrum/jonswap.py +++ b/resourcecode/spectrum/jonswap.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/spectrum/plots.py b/resourcecode/spectrum/plots.py index 3b1cc92..209314d 100644 --- a/resourcecode/spectrum/plots.py +++ b/resourcecode/spectrum/plots.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/utils.py b/resourcecode/utils.py index 2f4af0e..69777b0 100644 --- a/resourcecode/utils.py +++ b/resourcecode/utils.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/weatherwindow/__init__.py b/resourcecode/weatherwindow/__init__.py index dd51aa1..a7a8ad5 100644 --- a/resourcecode/weatherwindow/__init__.py +++ b/resourcecode/weatherwindow/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/resourcecode/weatherwindow/weatherwindow.py b/resourcecode/weatherwindow/weatherwindow.py index 1bf92cb..3713ac8 100644 --- a/resourcecode/weatherwindow/weatherwindow.py +++ b/resourcecode/weatherwindow/weatherwindow.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/__init__.py b/tests/__init__.py index 886a1b2..f17047f 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_client.py b/tests/test_client.py index 901f74a..9316719 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. @@ -158,8 +158,8 @@ def test_get_criteria_single_parameter(client): assert len(data) == 744 assert (data.columns == ["fp"]).all() - assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00") - assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00") + assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00", utc=True) + assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00", utc=True) assert data.fp[0] == pytest.approx(0.074) assert data.fp[-1] == pytest.approx(0.097) @@ -169,8 +169,8 @@ def test_get_criteria_single_tp_parameter(client): assert len(data) == 744 assert (data.columns == ["tp"]).all() - assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00") - assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00") + assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00", utc=True) + assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00", utc=True) assert data.tp[0] == pytest.approx(13.51351) assert data.tp[-1] == pytest.approx(10.30928) @@ -180,8 +180,8 @@ def test_get_criteria_multiple_parameters(client): assert len(data) == 744 assert (data.columns == ["fp", "hs"]).all() - assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00") - assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00") + assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00", utc=True) + assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00", utc=True) assert data.fp[0] == pytest.approx(0.074) assert data.fp[-1] == pytest.approx(0.097) assert data.hs[0] == pytest.approx(0.296) @@ -200,7 +200,7 @@ def test_get_criteria_multiple_parameters_and_none_values(client): assert pd.isnull(data.uust[0]) # the third value is not null. - assert data.index[2] == pd.to_datetime("2017-01-01 02:00:00") + assert data.index[2] == pd.to_datetime("2017-01-01 02:00:00", utc=True) assert data.uust[2] == pytest.approx(0.1699999962) data = client.get_dataframe_from_criteria('{"parameter": ["uust", "fp"]}') @@ -210,8 +210,8 @@ def test_get_criteria_multiple_parameters_and_none_values(client): # in that case, we have two variables. The second one, fp, is not null, # therefore the index can be completed despite that uust is null. - assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00") - assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00") + assert data.index[0] == pd.to_datetime("2017-01-01 00:00:00", utc=True) + assert data.index[-1] == pd.to_datetime("2017-01-31 23:00:00", utc=True) assert data.fp[0] == pytest.approx(0.074) assert data.fp[-1] == pytest.approx(0.097) diff --git a/tests/test_data.py b/tests/test_data.py index 32c26c8..ea9e257 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_eva.py b/tests/test_eva.py index 3919fba..6aba533 100644 --- a/tests/test_eva.py +++ b/tests/test_eva.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_netfcd.py b/tests/test_netfcd.py index 74e3b38..7e736e8 100644 --- a/tests/test_netfcd.py +++ b/tests/test_netfcd.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_opsplanning.py b/tests/test_opsplanning.py index 7c08fa1..abc44da 100644 --- a/tests/test_opsplanning.py +++ b/tests/test_opsplanning.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. @@ -34,6 +34,7 @@ def data(): parse_dates=True, dayfirst=True, ) + df = df.tz_localize("UTC") return df diff --git a/tests/test_producible_assessment.py b/tests/test_producible_assessment.py index 70c824b..26af1e2 100644 --- a/tests/test_producible_assessment.py +++ b/tests/test_producible_assessment.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_resassess.py b/tests/test_resassess.py index fca8a99..31ae828 100644 --- a/tests/test_resassess.py +++ b/tests/test_resassess.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_spectrum.py b/tests/test_spectrum.py index 0947c71..72e7f68 100644 --- a/tests/test_spectrum.py +++ b/tests/test_spectrum.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_utils.py b/tests/test_utils.py index bdc01a2..d4ce105 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode. diff --git a/tests/test_weather_window.py b/tests/test_weather_window.py index b9ed74d..f228e29 100644 --- a/tests/test_weather_window.py +++ b/tests/test_weather_window.py @@ -1,6 +1,6 @@ # coding: utf-8 -# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved. +# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved. # contact -- mailto:nicolas.raillard@ifremer.fr # # This file is part of Resourcecode.