MCPcopy Index your code
hub / github.com/pydata/xarray / test_geo_data

Method test_geo_data

xarray/tests/test_plot.py:583–613  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

581 _infer_interval_breaks(x, scale="log")
582
583 def test_geo_data(self) -> None:
584 # Regression test for gh2250
585 # Realistic coordinates taken from the example dataset
586 lat = np.array(
587 [
588 [16.28, 18.48, 19.58, 19.54, 18.35],
589 [28.07, 30.52, 31.73, 31.68, 30.37],
590 [39.65, 42.27, 43.56, 43.51, 42.11],
591 [50.52, 53.22, 54.55, 54.50, 53.06],
592 ]
593 )
594 lon = np.array(
595 [
596 [-126.13, -113.69, -100.92, -88.04, -75.29],
597 [-129.27, -115.62, -101.54, -87.32, -73.26],
598 [-133.10, -118.00, -102.31, -86.42, -70.76],
599 [-137.85, -120.99, -103.28, -85.28, -67.62],
600 ]
601 )
602 data = np.hypot(lon, lat)
603 da = DataArray(
604 data,
605 dims=("y", "x"),
606 coords={"lon": (("y", "x"), lon), "lat": (("y", "x"), lat)},
607 )
608 da.plot(x="lon", y="lat") # type: ignore[call-arg]
609 ax = plt.gca()
610 assert ax.has_data()
611 da.plot(x="lat", y="lon") # type: ignore[call-arg]
612 ax = plt.gca()
613 assert ax.has_data()
614
615 def test_datetime_dimension(self) -> None:
616 nrow = 3

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
plotMethod · 0.80
has_dataMethod · 0.80

Tested by

no test coverage detected