Skip to content

Commit

Permalink
Use geodatasets for naturalearth (#155)
Browse files Browse the repository at this point in the history
* Use geodatasets for naturalearth

* oitnb fix
  • Loading branch information
SorooshMani-NOAA authored Aug 7, 2024
1 parent 7b37332 commit 38b543d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
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

0 comments on commit 38b543d

Please sign in to comment.