diff --git a/ncl/ncl_entries/great_circle.ipynb b/ncl/ncl_entries/great_circle.ipynb index 3e95ab0a..df8a6f9c 100644 --- a/ncl/ncl_entries/great_circle.ipynb +++ b/ncl/ncl_entries/great_circle.ipynb @@ -90,13 +90,13 @@ } ], "source": [ - "from astropy.coordinates.representation import CartesianRepresentation, UnitSphericalRepresentation\n", + "from astropy.coordinates.representation import UnitSphericalRepresentation\n", "from astropy import units\n", "\n", "lat = 40.0150\n", "lon = -105.2705\n", "\n", - "spherical_coords = UnitSphericalRepresentation(lat=lat*units.deg, lon=lon*units.deg)\n", + "spherical_coords = UnitSphericalRepresentation(lat=lat * units.deg, lon=lon * units.deg)\n", "cart_coords = spherical_coords.to_cartesian()\n", "print(f\"X = {cart_coords.x.value}\")\n", "print(f\"Y = {cart_coords.y.value}\")\n", diff --git a/ncl/receipts/great_circle.ipynb b/ncl/receipts/great_circle.ipynb index 8942b39e..cc7392c8 100644 --- a/ncl/receipts/great_circle.ipynb +++ b/ncl/receipts/great_circle.ipynb @@ -146,9 +146,9 @@ "metadata": {}, "outputs": [], "source": [ - "#import geocat.datafiles as gdf\n", + "import geocat.datafiles as gdf\n", "import numpy as np\n", - "from astropy.coordinates.representation import CartesianRepresentation, UnitSphericalRepresentation\n", + "from astropy.coordinates.representation import UnitSphericalRepresentation\n", "from astropy import units\n", "\n", "css2c_data = gdf.get('applications_files/ncl_outputs/css2c_output.txt')\n", @@ -168,15 +168,17 @@ "source": [ "## Collect Latitude and Longtiude Pairs\n", "lat_lon = []\n", - "for lat in range(-90, 90+1):\n", - " for lon in range(-180, 180+1):\n", + "for lat in range(-90, 90 + 1):\n", + " for lon in range(-180, 180 + 1):\n", " lat_lon.append((lat, lon))\n", "\n", "## Calculate Cartesian coordinates\n", "astropy_css2c = {}\n", "for i, pair in enumerate(lat_lon):\n", " lat, lon = pair\n", - " spherical_coords = UnitSphericalRepresentation(lat=lat*units.deg, lon=lon*units.deg)\n", + " spherical_coords = UnitSphericalRepresentation(\n", + " lat=lat * units.deg, lon=lon * units.deg\n", + " )\n", " cart_coords = spherical_coords.to_cartesian()\n", " astropy_css2c[pair] = cart_coords.xyz.value" ] @@ -249,9 +251,9 @@ "source": [ "for key in ncl_css2c.keys():\n", " if key in astropy_css2c.keys():\n", - " assert abs(ncl_css2c[key][0]- astropy_css2c[key][0]) < 0.000005\n", - " assert abs(ncl_css2c[key][1]- astropy_css2c[key][1]) < 0.000005\n", - " assert abs(ncl_css2c[key][2]- astropy_css2c[key][2]) < 0.000005" + " assert abs(ncl_css2c[key][0] - astropy_css2c[key][0]) < 0.000005\n", + " assert abs(ncl_css2c[key][1] - astropy_css2c[key][1]) < 0.000005\n", + " assert abs(ncl_css2c[key][2] - astropy_css2c[key][2]) < 0.000005" ] } ],