Skip to content
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

Use geodatasets for naturalearth #155

Merged
merged 2 commits into from
Aug 7, 2024
Merged
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
3 changes: 2 additions & 1 deletion ensembleperturbation/plotting/nodes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from os import PathLike

import cartopy
import geodatasets
import geopandas
from matplotlib import cm, gridspec, pyplot
from matplotlib.axis import Axis
Expand Down Expand Up @@ -217,7 +218,7 @@ def plot_node_map(
float(nodes.coords['y'].max().values),
]

countries = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))
countries.plot(color='lightgrey', ax=map_axis)
coast = cartopy.feature.NaturalEarthFeature(
category='physical', scale='50m', facecolor='none', name='coastline'
Expand Down
5 changes: 3 additions & 2 deletions ensembleperturbation/plotting/perturbation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path
from typing import List

import geodatasets
import geopandas
from matplotlib import pyplot
from matplotlib.cm import get_cmap
Expand Down Expand Up @@ -175,7 +176,7 @@ def plot_perturbations(
figure.suptitle(f'{num_perturbations} perturbations of storm track')

map_axis = figure.add_subplot(1, 1, 1)
countries = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))

unique_perturbation_types = numpy.unique(perturbation_types)
encoded_perturbation_types = encode_categorical_values(
Expand Down Expand Up @@ -269,7 +270,7 @@ def plot_track_perturbations(
map_axis = figure.add_subplot(2, 1, 1)
Vmax_axis = figure.add_subplot(2, 2, 3)
Rmax_axis = figure.add_subplot(2, 2, 4)
countries = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))

unique_perturbation_types = numpy.unique(perturbation_types)
encoded_perturbation_types = encode_categorical_values(
Expand Down
7 changes: 4 additions & 3 deletions ensembleperturbation/plotting/surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Dict, List

import cartopy
import geodatasets
import geopandas
from matplotlib import gridspec, pyplot
from matplotlib.axis import Axis
Expand Down Expand Up @@ -410,7 +411,7 @@ def plot_selected_validations(
for index, source in enumerate(sources):
map_axis = figure.add_subplot(2, len(sources), index + 1)
map_axis.title.set_text(f'{source}')
countries = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))

map_axis.set_xlim((bounds[0], bounds[2]))
map_axis.set_ylim((bounds[1], bounds[3]))
Expand Down Expand Up @@ -485,7 +486,7 @@ def plot_selected_percentiles(
for index, source in enumerate(sources):
map_axis = figure.add_subplot(2, len(sources), index + 1)
map_axis.title.set_text(f'{source}')
countries = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))

map_axis.set_xlim((bounds[0], bounds[2]))
map_axis.set_ylim((bounds[1], bounds[3]))
Expand Down Expand Up @@ -622,7 +623,7 @@ def plot_selected_probability_fields(
for index, source in enumerate(sources):
map_axis = figure.add_subplot(2, len(sources), index + 1)
map_axis.title.set_text(f'{source}')
countries = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))

map_axis.set_xlim((bounds[0], bounds[2]))
map_axis.set_ylim((bounds[1], bounds[3]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Union

import cartopy
import geodatasets
import geopandas
import cmocean
from matplotlib import pyplot
Expand Down Expand Up @@ -227,9 +228,7 @@ def karhunen_loeve_prediction(
index += 1
map_axis = figure.add_subplot(2, len(sources), index, projection=map_crs)
map_axis.title.set_text(f'{source}')
countries = geopandas.read_file(
geopandas.datasets.get_path('naturalearth_lowres')
)
countries = geopandas.read_file(geodatasets.get_path('naturalearth land'))
countries.plot(color='lightgrey', ax=map_axis)
coast = cartopy.feature.NaturalEarthFeature(
category='physical', scale='50m', facecolor='none', name='coastline'
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dunamai = { version = '*', optional = true }
f90nml = '*'
fiona = '*'
geopandas = '*'
geodatasets = '*'
netcdf4 = '*'
matplotlib = { version = '*', optional = true }
numpy = '*'
Expand Down