Skip to content

Commit e641103

Browse files
style: pre-commit fixes
1 parent 80d43ab commit e641103

5 files changed

Lines changed: 20 additions & 17 deletions

File tree

docs/how_to/plotting_non_polar_regions.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"%autoreload 2\n",
3535
"\n",
3636
"import pygmt\n",
37+
"\n",
3738
"import polartoolkit as ptk"
3839
]
3940
},
@@ -58,15 +59,14 @@
5859
"\n",
5960
"# choose several EPSG codes\n",
6061
"epsgs = [\n",
61-
" \"10598\", # For N. America\n",
62+
" \"10598\", # For N. America\n",
6263
" # \"10596\", # For Europe\n",
6364
" # \"10594\", # For Asia\n",
6465
" # \"3857\", # Web Mercator, global but distorted at poles\n",
6566
"]\n",
6667
"\n",
6768
"grids = []\n",
6869
"for epsg in epsgs:\n",
69-
"\n",
7070
" # convert each region from meters into to lat/lon\n",
7171
" region_ll = ptk.region_xy_to_ll(\n",
7272
" region,\n",

docs/quickstart.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@
116116
],
117117
"source": [
118118
"import pyproj\n",
119-
"crs = pyproj.CRS(f\"epsg:3413\")\n",
119+
"\n",
120+
"crs = pyproj.CRS(\"epsg:3413\")\n",
120121
"crs"
121122
]
122123
},
@@ -217,7 +218,9 @@
217218
}
218219
],
219220
"source": [
220-
"lat_of_true_scale = [p for p in params if \"Latitude of standard parallel\" in p.name][0].value\n",
221+
"lat_of_true_scale = [p for p in params if \"Latitude of standard parallel\" in p.name][\n",
222+
" 0\n",
223+
"].value\n",
221224
"lat_of_true_scale"
222225
]
223226
},
@@ -274,7 +277,6 @@
274277
" hist=True,\n",
275278
" gridlines=True,\n",
276279
" epsg=\"3031\",\n",
277-
"\n",
278280
")\n",
279281
"print(fig.__dict__)\n",
280282
"fig.show(dpi=200)"

src/polartoolkit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
get_grid_registration,
5555
get_grid_spacing,
5656
get_min_max,
57-
gmt_str_to_list,
5857
gmt_projection_from_epsg,
58+
gmt_str_to_list,
5959
grid_blend,
6060
grid_compare,
6161
grid_trend,

src/polartoolkit/maps.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ def __init__(
166166
# assign geographic region in format for PyGMT to need for mixing projected and
167167
# geographic plotting elements
168168
if self.epsg in ("3031", "3413"):
169-
self.reg_latlon = "/".join(map(str, self.reg)) + "/+ue" # codespell:ignore ue
169+
self.reg_latlon = (
170+
"/".join(map(str, self.reg)) + "/+ue"
171+
) # codespell:ignore ue
170172
# self.reg_latlon = (*self.reg, "+ue", "") # codespell:ignore ue
171173
else:
172174
# # option 1: region from grid file
@@ -198,14 +200,15 @@ def __init__(
198200
input_crs=self.epsg,
199201
output_crs="EPSG:4326",
200202
)
201-
self.reg_latlon = f"{ll_lonlat[0]}/{ll_lonlat[1]}/{ur_lonlat[0]}/{ur_lonlat[1]}+r"
203+
self.reg_latlon = (
204+
f"{ll_lonlat[0]}/{ll_lonlat[1]}/{ur_lonlat[0]}/{ur_lonlat[1]}+r"
205+
)
202206

203207
# option 3: projected region with +ue
204208
# doesn't work with EPSG or PROJ string, but works with Stereographic projections
205209
# self.reg_latlon = "/".join(map(str, self.reg)) + "/+ue" # codespell:ignore ue
206210
# self.reg_latlon = (*self.reg, "+ue", "") # codespell:ignore ue
207211

208-
209212
def shift_figure(
210213
self,
211214
origin_shift: str | None = None,
@@ -1130,7 +1133,9 @@ def plot_inset(inset_reg, self, kwargs):
11301133
input_crs=self.epsg,
11311134
output_crs="EPSG:4326",
11321135
)
1133-
inset_reg_latlon = f"{ll_lonlat[0]}/{ll_lonlat[1]}/{ur_lonlat[0]}/{ur_lonlat[1]}+r"
1136+
inset_reg_latlon = (
1137+
f"{ll_lonlat[0]}/{ll_lonlat[1]}/{ur_lonlat[0]}/{ur_lonlat[1]}+r"
1138+
)
11341139

11351140
print(inset_reg)
11361141
print(inset_reg_latlon)
@@ -1140,7 +1145,7 @@ def plot_inset(inset_reg, self, kwargs):
11401145
region=inset_reg_latlon,
11411146
land="grey",
11421147
shorelines=f"1/{kwargs.get('inset_coast_pen', '0.2p,black')}",
1143-
verbose="error"
1148+
verbose="error",
11441149
)
11451150

11461151
box = self.reg
@@ -1151,7 +1156,7 @@ def plot_inset(inset_reg, self, kwargs):
11511156
region=inset_reg,
11521157
# projection=self.proj_latlon, # doesn't work
11531158
# projection=self.proj, # doesn't work
1154-
projection="x?" # auto determine region from inset width
1159+
projection="x?", # auto determine region from inset width
11551160
)
11561161
return self
11571162

@@ -1183,15 +1188,12 @@ def plot_inset(inset_reg, self, kwargs):
11831188
else:
11841189
self = plot_inset(inset_reg, self, kwargs)
11851190

1186-
11871191
# reset region and projection for main map
11881192
# self.basemap(region=self.reg, projection=self.proj, frame="+t")
11891193

11901194
# msg = "`add_inset` only supports EPSG:3031 and EPSG:3413"
11911195
# raise NotImplementedError(msg)
11921196

1193-
1194-
11951197
def add_scalebar(
11961198
self,
11971199
**kwargs: typing.Any,

src/polartoolkit/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,6 @@ def set_proj(
15611561
# proj_str = crs.to_proj4().replace(" ", "")
15621562
# proj_latlon = f'{proj_str}/{ratio}'
15631563

1564-
15651564
return proj, proj_latlon, fig_width, fig_height
15661565

15671566

@@ -2773,4 +2772,4 @@ def gmt_projection_from_epsg(epsg: str) -> str:
27732772
session.call_module(
27742773
"mapproject",
27752774
f"-J{epsg} -I -V {vin}",
2776-
)
2775+
)

0 commit comments

Comments
 (0)