Skip to content

Commit

Permalink
Close #17, WIP on #8
Browse files Browse the repository at this point in the history
  • Loading branch information
KCollins committed Sep 17, 2024
1 parent 1c2b6f1 commit 194908c
Showing 1 changed file with 28 additions and 35 deletions.
63 changes: 28 additions & 35 deletions notebooks/ConjugateMap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"\n",
"# Import functions:\n",
"import datetime\n",
"from conjugate_map.conjCalcFunctions import *"
"import conjugate_map.conjCalcFunctions as conj"
]
},
{
Expand All @@ -75,7 +75,7 @@
"metadata": {},
"outputs": [],
"source": [
"help(calc_mlat_rings)"
"help(conj.calc_mlat_rings)"
]
},
{
Expand All @@ -89,17 +89,17 @@
"lat, lon = [-64, -64]\n",
"\n",
"print(\"Geopack: \")\n",
"print(findconj(lat, lon, ut, method=\"geopack\"))\n",
"print(conj.findconj(lat, lon, ut, method=\"geopack\"))\n",
"print(\"AACGM: \")\n",
"print(findconj(lat, lon, ut, method=\"aacgm\"))"
"print(conj.findconj(lat, lon, ut, method=\"aacgm\"))"
]
},
{
"cell_type": "raw",
"id": "29685dad-9706-447d-b1e1-c8423bbb6947",
"metadata": {},
"source": [
"help(conjcalc)"
"help(conj.conjcalc)"
]
},
{
Expand Down Expand Up @@ -323,19 +323,6 @@
"stations"
]
},
{
"cell_type": "raw",
"id": "c1ec99c8-09b7-4b34-b495-7b456040633c",
"metadata": {},
"source": [
"# Testing conjcalc() with just lat and lon data....\n",
"\n",
"df2 = stations[['GLAT', 'GLON']].copy()\n",
"# conjcalc(df2)\n",
"# print(df2)\n",
"conjcalc(df2)"
]
},
{
"cell_type": "markdown",
"id": "f779e464-3d15-42f1-8404-1453348d7c4c",
Expand All @@ -346,9 +333,11 @@
]
},
{
"cell_type": "raw",
"id": "e3cd5544-e625-4d18-acec-e1db7b96e1dc",
"cell_type": "code",
"execution_count": null,
"id": "55f4a69c-1e26-48ab-8209-b03ae3e3411f",
"metadata": {},
"outputs": [],
"source": [
"# url = 'http://aeronomy.haystack.mit.edu/share/eclipse_2017/eclipse20170821.txt.000km.hiRes'\n",
"# filename = 'input/eclipse20170821.txt.000km.hiRes'\n",
Expand Down Expand Up @@ -390,9 +379,11 @@
]
},
{
"cell_type": "raw",
"id": "f67ba71e-43f6-4387-ae81-a1b084b6bb75",
"cell_type": "code",
"execution_count": null,
"id": "81da5591-d3c6-4c6f-b485-675ba360ed64",
"metadata": {},
"outputs": [],
"source": [
"# import required module\n",
"import os\n",
Expand Down Expand Up @@ -539,7 +530,7 @@
"outputs": [],
"source": [
"# foo = conjcalc(Antarctic_coastline.sample(20000).sort_index(), latname = 'lat', lonname='lon')\n",
"foo = conjcalc(Antarctic_coastline.sample(10000).sort_values('lon'), latname = 'lat', lonname='lon')\n",
"foo = conj.conjcalc(Antarctic_coastline.sample(10000).sort_values('lon'), latname = 'lat', lonname='lon')\n",
"# foo = conjcalc(Antarctic_coastline.sample(10000).sort_values('lon'), latname = 'lat', lonname='lon')\n",
"\n",
"df = foo[['PLAT', 'PLON']]\n",
Expand Down Expand Up @@ -604,15 +595,15 @@
"metadata": {},
"outputs": [],
"source": [
"n2s = conjcalc(stations, dtime = dt.datetime(2020, 1, 1), mode = 'N2S', method = 'aacgm', is_saved = True)\n",
"n2s = conj.conjcalc(stations, dtime = dt.datetime(2020, 1, 1), mode = 'N2S', method = 'aacgm', is_saved = True)\n",
"n2s.to_csv('output/stations_N2S_aacgm.csv') #save as .csv\n",
"s2n = conjcalc(stations, dtime = dt.datetime(2020, 1, 1), mode = 'S2N', method = 'aacgm', is_saved = True)\n",
"s2n = conj.conjcalc(stations, dtime = dt.datetime(2020, 1, 1), mode = 'S2N', method = 'aacgm', is_saved = True)\n",
"s2n.to_csv('output/stations_S2N_aacgm.csv') #save as .csv\n",
"# conjcalc(stations)\n",
"# stations[stations.index==\"PG0\"].GLON\n",
"\n",
"\n",
"stations = conjcalc(stations, is_saved = True)\n",
"stations = conj.conjcalc(stations, is_saved = True)\n",
"# stations.to_csv('output/stations.csv') #save as .csv"
]
},
Expand Down Expand Up @@ -695,11 +686,11 @@
"outputs": [],
"source": [
"# run conjcalc for aacgm\n",
"foo = conjcalc(stations, method = \"aacgm\", mode = 'flip')\n",
"foo = conj.conjcalc(stations, method = \"aacgm\", mode = 'flip')\n",
"foo['PLAT_aacgm'] = foo['PLAT']\n",
"foo['PLON_aacgm'] = foo['PLON']\n",
"# run conjcalc with geopack\n",
"foo = conjcalc(stations, method = \"geopack\", mode = 'flip')\n",
"foo = conj.conjcalc(stations, method = \"geopack\", mode = 'flip')\n",
"foo = foo.rename(columns={\"PLAT\": \"PLAT_geopack\", \"PLON\": \"PLON_geopack\"})\n",
"\n",
"# flight path chart\n",
Expand Down Expand Up @@ -784,7 +775,7 @@
"metadata": {},
"outputs": [],
"source": [
"rings = calc_mlat_rings(list(range(-90, 90, 5)), ut = datetime.datetime(2020, 1, 1), is_saved = True)"
"rings = conj.calc_mlat_rings(list(range(-90, 90, 5)), ut = datetime.datetime(2020, 1, 1), is_saved = True)"
]
},
{
Expand Down Expand Up @@ -812,7 +803,7 @@
"# try:\n",
"# print(\"Computing for \" + str(year) + \"...................................................................\")\n",
"# # run conjcalc for the year of interest\n",
"# data = conjcalc(stations, dtime = dt.datetime(year, 1, 1), is_verbose = False, mode='S2N')\n",
"# data = conj.conjcalc(stations, dtime = dt.datetime(year, 1, 1), is_verbose = False, mode='S2N')\n",
"# # add year column to table\n",
"# data = pd.DataFrame(data)\n",
"# data['Year'] = year\n",
Expand Down Expand Up @@ -864,7 +855,9 @@
"cell_type": "code",
"execution_count": null,
"id": "5a88b698-f87a-4ac9-a78f-4ae29b35d8d8",
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"stations_over_time = pd.DataFrame()\n",
Expand All @@ -874,7 +867,7 @@
" try:\n",
" print(\"Computing for \" + str(year) + \"...................................................................\")\n",
" # run conjcalc for the year of interest\n",
" data = conjcalc(stations, dtime = dt.datetime(year, 1, 1), is_verbose = False, mode='N2S')\n",
" data = conj.conjcalc(stations, dtime = dt.datetime(year, 1, 1), is_verbose = False, mode='N2S')\n",
" # add year column to table\n",
" data = pd.DataFrame(data)\n",
" data['Year'] = year\n",
Expand Down Expand Up @@ -934,7 +927,7 @@
"metadata": {},
"outputs": [],
"source": [
"help(calc_mlat_rings)"
"help(conj.calc_mlat_rings)"
]
},
{
Expand All @@ -953,7 +946,7 @@
" try:\n",
" print(\"Computing for \" + str(year) + \"...................................................................\")\n",
" # run conjcalc for the year of interest\n",
" rings = calc_mlat_rings(list(range(-90, 90, 5)), ut = datetime.datetime(year, 1, 1), is_saved = True)\n",
" rings = conj.calc_mlat_rings(list(range(-90, 90, 5)), ut = datetime.datetime(year, 1, 1), is_saved = True)\n",
" # add year column to table\n",
" df = pd.DataFrame.from_dict(rings, orient='index')\n",
" df = df.explode(['glats', 'glons'])\n",
Expand Down Expand Up @@ -1028,7 +1021,7 @@
" try:\n",
" print(\"Computing for \" + str(year) + \"...................................................................\")\n",
" # run conjcalc for the year of interest\n",
" data = conjcalc(Antarctic_coastline, latname = 'lat', lonname = 'lon', dtime = dt.datetime(year, 1, 1), is_verbose = False, mode='S2N')\n",
" data = conj.conjcalc(Antarctic_coastline, latname = 'lat', lonname = 'lon', dtime = dt.datetime(year, 1, 1), is_verbose = False, mode='S2N')\n",
" # add year column to table\n",
" data = pd.DataFrame(data)\n",
" data['Year'] = year\n",
Expand Down

0 comments on commit 194908c

Please sign in to comment.