Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 5, 2024
1 parent 225cfd2 commit bc1ba77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
24 changes: 13 additions & 11 deletions src/geovista/examples/vector_data/wind_arrows.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@
^^^^^^^^^^
The data source provides X and Y arrays containing plain longitude and
latitude values, which is the most common case.
latitude values, which is the most common case.
The wind information is provided in three separate field arrays, 'U, V and W'
-- i.e. eastward, northward and vertical components.
-- i.e. eastward, northward and vertical components.
These values are coded for each location (X, Y), measured relative to the longitude,
latitude and vertical directions at each point.
There is no connectivity provided, so each location has a vector and is independent of
the others. Hence we use the ``geovista.Transform.from_points`` function, passing the
winds to the ``vectors`` keyword.
winds to the ``vectors`` keyword.
Initially, we can just show the horizontal winds, as this easier to interpret.
""" # noqa: D205,D212,D400
from __future__ import annotations

import geovista as gv
from geovista.pantry.data import lfric_winds

Expand All @@ -38,7 +40,7 @@
mesh = gv.Transform.from_points(
sample.lons,
sample.lats,
vectors = (sample.u, sample.v),
vectors=(sample.u, sample.v),
)

# Create a new mesh containing arrow glyphs, from the mesh vectors.
Expand All @@ -58,7 +60,7 @@
selected_view = [
(-4.0688208659033505, -2.5462610064466777, -2.859304866708606),
(-0.0037798285484313965, 0.005168497562408447, -0.0031679868698120117),
(-0.523382090763761, -0.11174892277533728, 0.8447386372874786)
(-0.523382090763761, -0.11174892277533728, 0.8447386372874786),
]
plotter.camera_position = selected_view
plotter.show()
Expand All @@ -76,11 +78,11 @@
sample.lons,
sample.lats,
# supply all three components
vectors = (sample.u, sample.v, sample.w),
vectors=(sample.u, sample.v, sample.w),
# apply additional scaling to W values
vectors_z_scaling=1500.,
vectors_z_scaling=1500.0,
# offset from surface so avoid downward-pointing arrows disappearing
radius=1.1
radius=1.1,
)
arrows = mesh.glyph(factor=0.02)

Expand All @@ -95,7 +97,7 @@
selected_view = [
(0.6917810912064826, -3.065688850990997, 0.4317999141924935),
(0.41358279170396495, 0.07362917740509836, 0.5091223320854129),
(0.8088496364623022, 0.05726400555597287, 0.5852205560833343)
(0.8088496364623022, 0.05726400555597287, 0.5852205560833343),
]
plotter.camera_position = selected_view
plotter.show()
Expand All @@ -109,7 +111,7 @@
mesh = gv.Transform.from_points(
sample.lons,
sample.lats,
vectors = (sample.u, sample.v),
vectors=(sample.u, sample.v),
)
# Note: with no scaling, the basic arrows size is now rather different
arrows = mesh.glyph(factor=0.1, scale=False)
Expand All @@ -125,7 +127,7 @@
selected_view = [
(-4.0688208659033505, -2.5462610064466777, -2.859304866708606),
(-0.0037798285484313965, 0.005168497562408447, -0.0031679868698120117),
(-0.523382090763761, -0.11174892277533728, 0.8447386372874786)
(-0.523382090763761, -0.11174892277533728, 0.8447386372874786),
]
plotter.camera_position = selected_view
plotter.show()
4 changes: 0 additions & 4 deletions src/geovista/pantry/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from dataclasses import dataclass, field
from enum import Enum
from functools import lru_cache
from pathlib import Path
from typing import TYPE_CHECKING

import lazy_loader as lazy
Expand Down Expand Up @@ -981,7 +980,6 @@ def ww3_global_tri() -> SampleUnstructuredXY:
)



@lru_cache(maxsize=LRU_CACHE_SIZE)
def lfric_winds() -> SampleStructuredXYZ:
"""Download and cache unstructured 3D winds sample.
Expand Down Expand Up @@ -1015,5 +1013,3 @@ def lfric_winds() -> SampleStructuredXYZ:
name = "Wind"

return SampleVectorsXYUVW(lons, lats, u, v, w, name=name, units=units)


0 comments on commit bc1ba77

Please sign in to comment.