-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert size 1 array dtype without becoming scalar * Ensure z coords are recognised by guess_coord_axis * Test time coord creation * Allow integers in lat-lon headings * Update test results * What's new
- Loading branch information
Showing
9 changed files
with
257 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
lib/iris/tests/unit/fileformats/name_loaders/test__build_lat_lon_for_NAME_timeseries.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright Iris contributors | ||
# | ||
# This file is part of Iris and is released under the LGPL license. | ||
# See COPYING and COPYING.LESSER in the root of the repository for full | ||
# licensing details. | ||
""" | ||
Unit tests for :func:`iris.analysis.name_loaders._build_lat_lon_for_NAME_timeseries`. | ||
""" | ||
|
||
# Import iris.tests first so that some things can be initialised before | ||
# importing anything else. | ||
import iris.tests as tests # isort:skip | ||
|
||
from iris.fileformats.name_loaders import ( | ||
NAMECoord, | ||
_build_lat_lon_for_NAME_timeseries, | ||
) | ||
|
||
|
||
class TestCellMethods(tests.IrisTest): | ||
def test_float(self): | ||
column_headings = { | ||
"X": ["X = -.100 Lat-Long", "X = -1.600 Lat-Long"], | ||
"Y": ["Y = 52.450 Lat-Long", "Y = 51. Lat-Long"], | ||
} | ||
lat, lon = _build_lat_lon_for_NAME_timeseries(column_headings) | ||
self.assertIsInstance(lat, NAMECoord) | ||
self.assertIsInstance(lon, NAMECoord) | ||
self.assertEqual(lat.name, "latitude") | ||
self.assertEqual(lon.name, "longitude") | ||
self.assertIsNone(lat.dimension) | ||
self.assertIsNone(lon.dimension) | ||
self.assertArrayEqual(lat.values, [52.45, 51.0]) | ||
self.assertArrayEqual(lon.values, [-0.1, -1.6]) | ||
|
||
def test_int(self): | ||
column_headings = { | ||
"X": ["X = -1 Lat-Long", "X = -2 Lat-Long"], | ||
"Y": ["Y = 52 Lat-Long", "Y = 51 Lat-Long"], | ||
} | ||
lat, lon = _build_lat_lon_for_NAME_timeseries(column_headings) | ||
self.assertIsInstance(lat, NAMECoord) | ||
self.assertIsInstance(lon, NAMECoord) | ||
self.assertEqual(lat.name, "latitude") | ||
self.assertEqual(lon.name, "longitude") | ||
self.assertIsNone(lat.dimension) | ||
self.assertIsNone(lon.dimension) | ||
self.assertArrayEqual(lat.values, [52.0, 51.0]) | ||
self.assertArrayEqual(lon.values, [-1.0, -2.0]) | ||
self.assertIsInstance(lat.values[0], float) | ||
self.assertIsInstance(lon.values[0], float) |
Oops, something went wrong.