Skip to content

DRAFT: Update Requirements #1222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 39 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,50 @@ requires-python = ">=3.10"

# minimal dependencies start
dependencies = [
"antimeridian",
"cartopy",
"dask[dataframe]",
"datashader",
"geoviews",
"holoviews",
"matplotlib",
"matplotlib-inline",
"netcdf4",
"xarray[io]",
"numba",
"numpy",
"pandas",
"pyarrow",
"requests",
"scikit-learn",
"scipy",
"shapely",
"spatialpandas",
"geopandas",
"xarray",
"hvplot",
"healpix",
"polars",
"healpix",
"scikit-learn",
]
# minimal dependencies end

[project.optional-dependencies]
complete = ["uxarray[math, dev]"]
math = ['gmpy2']
dev = ['pathlib', 'pre_commit', 'pytest', 'pytest-cov', 'ruff', 'asv']
complete = ["uxarray[viz, dev, complete]"]
viz = ['matplotlib', 'cartopy', 'antimeridian', 'datashader', 'holoviews', 'geoviews', 'hvplot', 'spatialpandas', 'geopandas']
healpix = ['healpix']
dev = ['pathlib', 'requests', 'pytest', 'pytest-cov', 'ruff', 'asv', 'pre_commit']

#dependencies = [x`
# "antimeridian", *
# "cartopy", *
# "dask[dataframe]",
# "datashader", *
# "geoviews", *
# "holoviews", *
# "matplotlib", *
# "matplotlib-inline", TODO
# "netcdf4", TODO: Included in Xarray[io]
# "numba", *
# "numpy", TODO: Included in Xarray
# "pandas", TODO: Included in Xarray
# "pyarrow", TODO: do we need it?
# "requests", TODO:
# "scikit-learn", # TODO: Do we want this to be required?
# "scipy", TODO: Included in Xarray[io]
# "shapely",
# "spatialpandas",
# "geopandas",
# "xarray",
# "hvplot",
# "healpix",
# "polars",
#]
# minimal dependencies end

#[project.optional-dependencies]
#complete = ["uxarray[math, dev]"]
#math = ['gmpy2']
#dev = ['pathlib', 'pre_commit', 'pytest', 'pytest-cov', 'ruff', 'asv']

[project.urls]
Documentation = "https://uxarray.readthedocs.io/"
Expand Down
6 changes: 1 addition & 5 deletions uxarray/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .cmaps import diverging, sequential, sequential_blue, sequential_green
# from .cmaps import diverging, sequential, sequential_blue, sequential_green
from .constants import INT_DTYPE, INT_FILL_VALUE
from .core.api import concat, open_dataset, open_grid, open_mfdataset
from .core.dataarray import UxDataArray
Expand Down Expand Up @@ -27,8 +27,4 @@
"INT_DTYPE",
"INT_FILL_VALUE",
"Grid",
"sequential",
"diverging",
"sequential_blue",
"sequential_green",
)
64 changes: 32 additions & 32 deletions uxarray/cmaps.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
from matplotlib.colors import LinearSegmentedColormap

diverging = LinearSegmentedColormap.from_list(
"diverging",
(
(0.000, (0.016, 0.576, 0.565)),
(0.500, (1.000, 1.000, 1.000)),
(1.000, (0.004, 0.400, 0.569)),
),
)

# UXarray themed sequential color map
sequential = LinearSegmentedColormap.from_list(
"sequential", ((0.000, (0.004, 0.400, 0.569)), (1.000, (0.016, 0.576, 0.565)))
)

sequential_blue = LinearSegmentedColormap.from_list(
"sequential_blue", ((0.000, (1.000, 1.000, 1.000)), (1.000, (0.004, 0.400, 0.569)))
)

sequential_green = LinearSegmentedColormap.from_list(
"sequential_green", ((0.000, (1.000, 1.000, 1.000)), (1.000, (0.016, 0.576, 0.565)))
)

sequential_green_blue = LinearSegmentedColormap.from_list(
"sequential_green_blue",
(
(0.000, (1.000, 1.000, 1.000)),
(0.500, (0.016, 0.576, 0.565)),
(1.000, (0.004, 0.400, 0.569)),
),
)
# from matplotlib.colors import LinearSegmentedColormap
#
# diverging = LinearSegmentedColormap.from_list(
# "diverging",
# (
# (0.000, (0.016, 0.576, 0.565)),
# (0.500, (1.000, 1.000, 1.000)),
# (1.000, (0.004, 0.400, 0.569)),
# ),
# )
#
# # UXarray themed sequential color map
# sequential = LinearSegmentedColormap.from_list(
# "sequential", ((0.000, (0.004, 0.400, 0.569)), (1.000, (0.016, 0.576, 0.565)))
# )
#
# sequential_blue = LinearSegmentedColormap.from_list(
# "sequential_blue", ((0.000, (1.000, 1.000, 1.000)), (1.000, (0.004, 0.400, 0.569)))
# )
#
# sequential_green = LinearSegmentedColormap.from_list(
# "sequential_green", ((0.000, (1.000, 1.000, 1.000)), (1.000, (0.016, 0.576, 0.565)))
# )
#
# sequential_green_blue = LinearSegmentedColormap.from_list(
# "sequential_green_blue",
# (
# (0.000, (1.000, 1.000, 1.000)),
# (0.500, (0.016, 0.576, 0.565)),
# (1.000, (0.004, 0.400, 0.569)),
# ),
# )
5 changes: 4 additions & 1 deletion uxarray/core/aggregation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import dask.array as da
import numpy as np

import uxarray.core.dataarray
Expand Down Expand Up @@ -71,6 +70,8 @@ def _uxda_grid_aggregate(uxda, destination, aggregation, **kwargs):

def _node_to_face_aggregation(uxda, aggregation, aggregation_func_kwargs):
"""Applies a Node to Face Topological aggregation."""
import dask.array as da

if not uxda._node_centered():
raise ValueError(
f"Data Variable must be mapped to the corner nodes of each face, with dimension "
Expand Down Expand Up @@ -137,6 +138,8 @@ def _apply_node_to_face_aggregation_dask(*args, **kwargs):

def _node_to_edge_aggregation(uxda, aggregation, aggregation_func_kwargs):
"""Applies a Node to Edge Topological aggregation."""
import dask.array as da

if not uxda._node_centered():
raise ValueError(
f"Data Variable must be mapped to the corner nodes of each face, with dimension "
Expand Down
6 changes: 3 additions & 3 deletions uxarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import TYPE_CHECKING, Any, Hashable, Literal, Optional
from warnings import warn

import cartopy.crs as ccrs
# import cartopy.crs as ccrs
import numpy as np
import xarray as xr
from xarray.core import dtypes
Expand Down Expand Up @@ -145,7 +145,7 @@ def data_mapping(self):
def to_geodataframe(
self,
periodic_elements: Optional[str] = "exclude",
projection: Optional[ccrs.Projection] = None,
projection: Optional = None,
cache: Optional[bool] = True,
override: Optional[bool] = False,
engine: Optional[str] = "spatialpandas",
Expand Down Expand Up @@ -256,7 +256,7 @@ def to_geodataframe(
def to_polycollection(
self,
periodic_elements: Optional[str] = "exclude",
projection: Optional[ccrs.Projection] = None,
projection: Optional = None,
return_indices: Optional[bool] = False,
cache: Optional[bool] = True,
override: Optional[bool] = False,
Expand Down
3 changes: 2 additions & 1 deletion uxarray/core/zonal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import dask.array as da
import numpy as np

from uxarray.grid.integrate import _zonal_face_weights, _zonal_face_weights_robust
Expand All @@ -7,6 +6,8 @@

def _compute_non_conservative_zonal_mean(uxda, latitudes, use_robust_weights=False):
"""Computes the non-conservative zonal mean across one or more latitudes."""
import dask.array as da

uxgrid = uxda.uxgrid
n_nodes_per_face = uxgrid.n_nodes_per_face.values
shape = uxda.shape[:-1] + (len(latitudes),)
Expand Down
Loading
Loading