Skip to content

Commit

Permalink
fix(doc): compilation dependencies (#205)
Browse files Browse the repository at this point in the history
* fix(doc): compilation dependencies

* style: lint

* update .gitignore for pyenv
  • Loading branch information
sphamba authored Dec 4, 2023
1 parent 19e7886 commit 43e6eaf
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ __pycache__/

# Distribution / packaging
.Python
.python-version
build/
develop-eggs/
dist/
Expand Down
3 changes: 1 addition & 2 deletions disdrodb/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@author: ghiggi
"""
import os
from typing import Dict

from disdrodb.utils.yaml import read_yaml, write_yaml

Expand Down Expand Up @@ -66,7 +65,7 @@ def define_disdrodb_configs(base_dir: str = None, zenodo_token: str = None, zeno
return


def read_disdrodb_configs() -> Dict[str, str]:
def read_disdrodb_configs() -> dict[str, str]:
"""
Reads the DISDRODB configuration file and returns a dictionary with the configuration settings.
Expand Down
10 changes: 5 additions & 5 deletions disdrodb/data_transfer/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import os
import shutil
from typing import List, Optional, Union
from typing import Optional, Union

import click
import pooch
Expand Down Expand Up @@ -97,9 +97,9 @@ def click_download_options(function: object):


def download_archive(
data_sources: Optional[Union[str, List[str]]] = None,
campaign_names: Optional[Union[str, List[str]]] = None,
station_names: Optional[Union[str, List[str]]] = None,
data_sources: Optional[Union[str, list[str]]] = None,
campaign_names: Optional[Union[str, list[str]]] = None,
station_names: Optional[Union[str, list[str]]] = None,
force: bool = False,
base_dir: Optional[str] = None,
):
Expand Down Expand Up @@ -222,7 +222,7 @@ def _has_disdrodb_data_url(metadata_filepath):
return _is_valid_disdrodb_data_url(disdrodb_data_url)


def _select_metadata_with_remote_data_url(metadata_filepaths: List[str]) -> List[str]:
def _select_metadata_with_remote_data_url(metadata_filepaths: list[str]) -> list[str]:
"""Select metadata files that have a remote data url specified."""
return [fpath for fpath in metadata_filepaths if _has_disdrodb_data_url(fpath)]

Expand Down
4 changes: 2 additions & 2 deletions disdrodb/data_transfer/upload_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -----------------------------------------------------------------------------.
"""Routines to upload data to the DISDRODB Decentralized Data Archive."""

from typing import List, Optional
from typing import Optional

import click

Expand Down Expand Up @@ -95,7 +95,7 @@ def _check_if_upload(metadata_filepath: str, force: bool):
raise ValueError(f"'force' is False and {metadata_filepath} has already a 'disdrodb_data_url' specified.")


def _filter_already_uploaded(metadata_filepaths: List[str], force: bool) -> List[str]:
def _filter_already_uploaded(metadata_filepaths: list[str], force: bool) -> list[str]:
"""Filter metadata files that already have a remote url specified."""
filtered = []
for metadata_filepath in metadata_filepaths:
Expand Down
3 changes: 1 addition & 2 deletions disdrodb/data_transfer/zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import json
import os
from typing import Tuple

import requests

Expand Down Expand Up @@ -52,7 +51,7 @@ def _check_http_response(
raise ValueError(error_message)


def _create_zenodo_deposition(sandbox) -> Tuple[int, str]:
def _create_zenodo_deposition(sandbox) -> tuple[int, str]:
"""Create a new Zenodo deposition and get the deposit information.
At every function call, the deposit_id and bucket url will change !
Expand Down
10 changes: 5 additions & 5 deletions disdrodb/l0/check_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""Check configuration files."""

import os
from typing import List, Optional, Union
from typing import Optional, Union

import numpy as np
from pydantic import BaseModel, ValidationError, field_validator, model_validator
Expand Down Expand Up @@ -134,7 +134,7 @@ class L0BEncodingSchema(BaseModel):
shuffle: bool
fletcher32: bool
_FillValue: Optional[Union[int, float]]
chunksizes: Optional[Union[int, List[int]]]
chunksizes: Optional[Union[int, list[int]]]

# if contiguous=False, chunksizes specified, otherwise should be not !
@model_validator(mode="before")
Expand Down Expand Up @@ -212,10 +212,10 @@ class RawDataFormatSchema(BaseModel):
n_characters: Optional[int]
n_decimals: Optional[int]
n_naturals: Optional[int]
data_range: Optional[List[float]]
data_range: Optional[list[float]]
nan_flags: Optional[Union[int, str]] = None
valid_values: Optional[List[float]] = None
dimension_order: Optional[List[str]] = None
valid_values: Optional[list[float]] = None
dimension_order: Optional[list[str]] = None
n_values: Optional[int] = None
field_number: Optional[str] = None

Expand Down
4 changes: 2 additions & 2 deletions disdrodb/tests/test_l0/test_config_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -----------------------------------------------------------------------------.
"""Check DISDRODB L0 configuration files."""
import os
from typing import Dict, Union
from typing import Union

import pytest
import yaml
Expand All @@ -30,7 +30,7 @@
CONFIG_FOLDER = os.path.join(__root_path__, "disdrodb", "l0", "configs")


def read_yaml_file(filepath: str) -> Dict:
def read_yaml_file(filepath: str) -> dict:
"""Read a YAML file and return a dictionary.
Parameters
Expand Down
7 changes: 3 additions & 4 deletions disdrodb/utils/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""DISDRODB netCDF utility."""

import logging
from typing import Tuple

import numpy as np
import pandas as pd
Expand All @@ -31,7 +30,7 @@


####---------------------------------------------------------------------------.
def _sort_datasets_by_dim(list_ds: list, filepaths: str, dim: str = "time") -> Tuple[list, list]:
def _sort_datasets_by_dim(list_ds: list, filepaths: str, dim: str = "time") -> tuple[list, list]:
"""Sort a list of xarray.Dataset and corresponding file paths by the starting value of a specified dimension.
Parameters
Expand All @@ -55,7 +54,7 @@ def _sort_datasets_by_dim(list_ds: list, filepaths: str, dim: str = "time") -> T
return sorted_list_ds, sorted_filepaths


def _get_dim_values_index(list_ds: list, dim: str) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
def _get_dim_values_index(list_ds: list, dim: str) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
"""Get list and dataset indices associated to the dimension values."""
dim_values = np.concatenate([ds[dim].values for ds in list_ds])
list_index = np.concatenate([np.ones(len(ds[dim])) * i for i, ds in enumerate(list_ds)])
Expand Down Expand Up @@ -129,7 +128,7 @@ def _get_bad_info_dict(
list_index: np.ndarray,
dim_values: np.ndarray,
ds_index: np.ndarray,
) -> Tuple[dict, dict]:
) -> tuple[dict, dict]:
"""Return two dictionaries mapping, for each dataset, the bad values and indices to remove.
Parameters
Expand Down
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cftime==1.6.1
click==8.1.3
cloudpickle==2.1.0
colorama==0.4.5
donfig==0.8.1.post0
fsspec==2022.11.0
locket==1.0.0
netCDF4==1.6.2
Expand All @@ -19,14 +20,14 @@ nbsphinx==0.8.9
jupyter==1.0.0
h5py==3.7.0
setuptools==65.5.1
dask[distributed]==2022.9.1
dask[distributed]==2023.11.0
pre-commit==2.20.0
importlib==1.0.4
importlib-metadata==5.1.0
trollsift==0.5.0
coverage==7.2.2
pooch==1.7.0
pydantic==1.10.4
pydantic==2.5.2
pytest-cov==4.0.0
pytest-mock==3.10.0
pytest==7.2.0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"click",
"tqdm",
Expand Down

0 comments on commit 43e6eaf

Please sign in to comment.