Skip to content

Commit

Permalink
Merge pull request #127 from cal-adapt/cksplit2a
Browse files Browse the repository at this point in the history
Split Code into 2 repos, changes to notebooks needed for this.
  • Loading branch information
elehmer authored Sep 5, 2024
2 parents b82e8ff + 132c936 commit edfe134
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 92 deletions.
17 changes: 12 additions & 5 deletions collaborative/DFU/annual_consumption_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,14 @@
"outputs": [],
"source": [
"from climakitae.util.utils import (convert_to_local_time, compute_annual_aggreggate, trendline, \n",
" compute_multimodel_stats, hdd_cdd_lineplot, hdh_cdh_lineplot, combine_hdd_cdd)\n",
" compute_multimodel_stats, combine_hdd_cdd)\n",
"from climakitae.tools.derived_variables import compute_hdd_cdd, compute_hdh_cdh\n",
"import climakitae as ck"
"from climakitaegui.util.utils import (hdd_cdd_lineplot, hdh_cdh_lineplot)\n",
"\n",
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import panel as pn\n",
"pn.extension()"
]
},
{
Expand Down Expand Up @@ -95,7 +100,7 @@
},
"outputs": [],
"source": [
"selections = ck.Select()\n",
"selections = ckg.Select()\n",
"\n",
"selections.data_type = \"Station\"\n",
"selections.area_subset = \"CA Electricity Demand Forecast Zones\"\n",
Expand Down Expand Up @@ -375,7 +380,7 @@
},
"outputs": [],
"source": [
"ck.view(to_plot) * point_df.hvplot.points(\n",
"ckg.view(to_plot) * point_df.hvplot.points(\n",
" hover_cols = [\"weather station\"], \n",
" marker = \"star\", size = 300, color = \"black\"\n",
")"
Expand Down Expand Up @@ -882,7 +887,9 @@
"cell_type": "code",
"execution_count": null,
"id": "74a7544e-2a5d-4f3c-b848-c8e2588011e9",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"filename = \"daily_hdh_cdh_{0}.csv\".format(station_name.replace(\" \", \"_\").lower())\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
"outputs": [],
"source": [
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import xarray as xr\n",
"import pandas as pd\n",
"import hvplot as hv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
Expand All @@ -56,7 +56,9 @@
"\n",
"import s3fs\n",
"import pyproj\n",
"import itertools"
"import itertools\n",
"import panel as pn\n",
"pn.extension()"
]
},
{
Expand Down Expand Up @@ -219,7 +221,7 @@
"stats_list = []\n",
"\n",
"# initialize selections\n",
"selections = ck.Select()\n",
"selections = ckg.Select()\n",
"\n",
"def tas_dew_localize(stations_df, correct_tz=False):\n",
" '''\n",
Expand Down
11 changes: 8 additions & 3 deletions collaborative/DFU/localization_methodology.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
"outputs": [],
"source": [
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import xarray as xr\n",
"import pandas as pd\n",
"import panel as pn\n",
"pn.extension()\n",
"\n",
"from climakitae.util.utils import read_csv_file\n",
"\n",
Expand Down Expand Up @@ -129,7 +132,7 @@
"metadata": {},
"outputs": [],
"source": [
"selections = ck.Select()"
"selections = ckg.Select()"
]
},
{
Expand Down Expand Up @@ -313,11 +316,13 @@
"cell_type": "code",
"execution_count": null,
"id": "46428dc1-31fb-460b-b672-4360673c8f4f",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from bokeh.models import HoverTool\n",
"from climakitae.util.utils import read_ae_colormap\n",
"from climakitae.util.colormap import read_ae_colormap\n",
"\n",
"raw_cmap = read_ae_colormap(cmap='ae_orange', cmap_hex=True)\n",
"af_cmap = read_ae_colormap(cmap='ae_diverging', cmap_hex=True)\n",
Expand Down
13 changes: 12 additions & 1 deletion collaborative/DFU/station_data_access.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
"outputs": [],
"source": [
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import pandas as pd\n",
"import xarray as xr\n",
"import panel as pn\n",
"pn.extension()\n",
"\n",
"from climakitae.util.utils import read_csv_file"
]
Expand Down Expand Up @@ -152,7 +155,7 @@
},
"outputs": [],
"source": [
"ck.view(obs_ds)"
"ckg.view(obs_ds)"
]
},
{
Expand Down Expand Up @@ -218,6 +221,14 @@
"filename = 'HadISD_{}'.format(station_id)\n",
"ck.export(obs_ds, filename, \"csv\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1b269fef-e71c-4ccd-b659-eb5d455e8d37",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
14 changes: 5 additions & 9 deletions collaborative/DFU/station_hourly_profiles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"outputs": [],
"source": [
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import panel as pn\n",
"pn.extension()\n",
"\n",
"import numpy as np\n",
"import xarray as xr\n",
"import pandas as pd\n",
Expand All @@ -52,7 +56,7 @@
},
"outputs": [],
"source": [
"selections = ck.Select()\n",
"selections = ckg.Select()\n",
"selections.show()"
]
},
Expand Down Expand Up @@ -663,14 +667,6 @@
"table_back = pd.read_csv('test_output.csv',index_col=[0,1], header=[0,1])\n",
"table_back"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6abe4d06-f85c-4ef1-9d97-99e27fc909b1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
72 changes: 72 additions & 0 deletions collaborative/DFU/wecc-station-data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
icao,wmo,faa,name,country,state,latitude,longitude,elevation,begin,end,station id,hadisd duplicate
KABQ,723650,23050,ALBUQUERQUE INTERNATIONAL SUNPORT AIRPORT,US,NM,35.042,-106.615,1618.4,19410701,20220228,723650-23050,FALSE
KACV,725945,24283,ARCATA AIRPORT,US,CA,40.978,-124.105,64.5,19730101,20220228,725945-24283,FALSE
KAKO,724698,24015,COLORADO PLAINS REGIONAL AIRPORT,US,CO,40.174,-103.215,1428,19730101,20220228,724698-24015,FALSE
KBCE,724756,23159,BRYCE CANYON AIRPORT,US,UT,37.701,-112.149,2309.9,19730101,20220228,724756-23159,FALSE
KBFL,723840,23155,MEADOWS FIELD AIRPORT,US,CA,35.434,-119.055,149.3,19411001,20220228,723840-23155,FALSE
KBKF,724695,23036,BUCKLEY AIR FORCE BASE,US,CO,39.717,-104.75,1726.1,19440301,20220228,724695-23036,FALSE
KBLH,747188,23158,BLYTHE ASOS,US,CA,33.619,-114.715,120.4,19420613,20220227,747188-23158,FALSE
KBOI,726810,24131,BOISE AIR TERMINAL,US,ID,43.567,-116.241,860.5,19310101,20220228,726810-24131,FALSE
KBUR,722880,23152,BURBANK-GLENDALE-PASADENA AIRPORT,US,CA,34.2,-118.365,222.7,19430601,20220228,722880-23152,FALSE
KBZN,726797,24132,GALLATIN FIELD AIRPORT,US,MT,45.788,-111.162,1350.7,19730101,20220228,726797-24132,FALSE
KCAG,725700,99999,CRAIG-MOFFAT AIRPORT,US,CO,40.5,-107.533,1915,19770827,20051231,725700-99999,FALSE
KCQT,722874,93134,DOWNTOWN LOS ANGELES USC CAMPUS,US,CA,34.024,-118.291,54.6,20000101,20220228,722874-93134,FALSE
KCYS,725640,24018,CHEYENNE AIRPORT,US,WY,41.158,-104.808,1864.9,19480101,20220228,725640-24018,FALSE
KDNR,724690,23062,DENVER WEATHER SERVICE FORECAST OFFICE,US,CO,39.75,-104.867,1612,19400515,19950301,724690-23062,FALSE
KEED,723805,23179,NEEDLES AIRPORT,US,CA,34.768,-114.618,270.6,19770217,20220228,723805-23179,FALSE
KEKO,725825,24121,ELKO REGIONAL AIRPORT,US,NV,40.824,-115.786,1540.5,19770101,20220228,725825-24121,FALSE
KELP,722700,23044,EL PASO INTERNATIONAL AIRPORT,US,TX,31.812,-106.377,1202.1,19410401,20220228,722700-23044,FALSE
KFAT,723890,93193,FRESNO YOSEMITE INTERNATIONAL AIRPORT,US,CA,36.78,-119.72,101.9,19411204,20220228,723890-93193,FALSE
KFLG,723755,03103,FLAGSTAFF PULLIAM AIRPORT,US,AZ,35.144,-111.666,2139.1,19480101,20041231,723755-03103,FALSE
KFSD,726510,14944,JOE FOSS FIELD AIRPORT,US,SD,43.578,-96.754,432.4,19421001,20220228,726510-14944,FALSE
KGEG,727850,24157,SPOKANE INTERNATIONAL AIRPORT,US,WA,47.622,-117.528,717.7,19410811,20220301,727850-24157,FALSE
KIDA,725785,24145,IDAHO FALLS REGIONAL ARPT,US,ID,43.52,-112.068,1442.7,19730101,20220228,725785-24145,FALSE
KIGM,723700,93167,KINGMAN AIRPORT,US,AZ,35.257,-113.934,1043.5,19990101,20220228,723700-93167,TRUE
KIPL,747185,03144,IMPERIAL COUNTY AIRPORT,US,CA,32.834,-115.579,-16,19730101,20051231,747185-99999,FALSE
KLAR,725645,24022,LARAMIE REGIONAL AIRPORT,US,WY,41.317,-105.673,2216.8,19730101,20220228,725645-24022,FALSE
KLAS,723860,23169,MCCARRAN INTERNATIONAL AIRPORT,US,NV,36.072,-115.163,662.8,19730101,20220228,723860-23169,FALSE
KLAX,722950,23174,LOS ANGELES INTERNATIONAL AIRPORT,US,CA,33.938,-118.387,29.7,19440101,20220228,722950-23174,TRUE
KLGB,722970,23129,LONG BEACH DAUGHERTY FIELD,US,CA,33.812,-118.147,10.2,19430101,20220228,722970-23129,FALSE
KLMT,725895,94236,KLAMATH FALLS AIRPORT,US,OR,42.147,-121.726,1244.5,19590901,20220228,725895-94236,FALSE
KLSV,746140,23112,NELLIS AFB AIRPORT,US,NV,36.25,-115.033,570,20050101,20220228,746140-23112,FALSE
KLUF,722785,23111,LUKE AFB AIRPORT,US,AZ,33.55,-112.367,330.7,19411201,20220228,722785-23111,FALSE
KMCE,724815,99999,MERCED MUNI MACREADY,US,CA,37.285,-120.514,48,19831001,20051231,724815-23257,FALSE
KMCI,724460,03947,KANSAS CITY INTERNATIONAL AIRPORT,US,MO,39.297,-94.731,307.4,19730101,20220228,724460-03947,FALSE
KMOD,724926,23258,MODESTO CITY-COUNTY AIRPORT,US,CA,37.625,-120.955,26.6,19730101,20220228,724926-23258,FALSE
KMSO,727730,24153,MISSOULA INTERNATIONAL AIRPORT,US,MT,46.921,-114.094,973.8,19730101,20220301,727730-24153,FALSE
KNKX,722931,93107,SAN DIEGO MIRAMAR WSCMO,US,CA,32.867,-117.133,145.7,19470701,19881231,999999-93107,FALSE
KOAK,724930,23230,METRO OAKLAND INTERNATIONAL AIRPORT,US,CA,37.718,-122.233,1.5,19430101,20220228,724930-23230,FALSE
KOGD,725750,24126,OGDEN-HINCKLEY AIRPORT,US,UT,41.194,-112.017,1356.1,19730101,20220228,725750-24126,FALSE
KOTH,726917,24284,NORTH BEND MUNICIPAL AIRPORT,US,OR,43.413,-124.244,5.2,19770101,20220228,726917-24284,FALSE
KOXR,723927,93110,OXNARD AIRPORT,US,CA,34.2,-119.204,11.9,19440401,20220228,723927-93110,FALSE
KPDX,726980,24229,PORTLAND INTERNATIONAL AIRPORT,US,OR,45.596,-122.609,6.7,19360501,20220228,726980-24229,FALSE
KPHX,722780,23183,PHOENIX SKY HARBOR INTERNATIONAL AIRPORT,US,AZ,33.428,-112.004,339.2,19730101,20220228,722780-23183,FALSE
KPRC,723723,23184,ERNEST A. LOVE FIELD AIRPORT,US,AZ,34.649,-112.422,1527.8,19900228,20220228,723723-23184,FALSE
KPSP,722868,93138,PALM SPRINGS REGIONAL AIRPORT,US,CA,33.833,-116.5,145,19430510,20051231,722868-99999,FALSE
KPUB,724640,93058,PUEBLO MEMORIAL AIRPORT,US,CO,38.289,-104.506,1424.5,19421001,20220228,724640-93058,FALSE
KPUC,724700,99999,CARBON COUNTY REGIONAL AIRPORT,US,UT,39.617,-110.75,1799,19770827,20051231,724700-99999,FALSE
KRAL,722869,03171,RIVERSIDE MUNICIPAL AIRPORT,US,CA,33.95,-117.433,249,19770116,20051231,722869-99999,FALSE
KRBL,725910,24216,RED BLUFF MUNICIPAL AIRPORT,US,CA,40.152,-122.255,108.1,19730101,20220228,725910-24216,FALSE
KRDD,725915,24257,REDDING MUNICIPAL AIRPORT,US,CA,40.518,-122.299,153,19440901,19910331,725915-24257,FALSE
KRNO,724880,23185,RENO TAHOE INTERNATIONAL AIRPORT,US,NV,39.508,-119.768,1342.5,19430105,20220228,724880-23185,FALSE
KSAC,724830,23232,SACRAMENTO EXECUTIVE AIRPORT,US,CA,38.507,-121.496,5.9,19730101,20220228,724830-23232,FALSE
KSAF,723656,23049,SANTA FE MUNICIPAL AIRPORT,US,NM,35.611,-106.096,1916.3,19460801,20220228,723656-23049,FALSE
KSAN,722900,23188,SAN DIEGO INTERNATIONAL AIRPORT,US,CA,32.734,-117.183,4.6,19420101,20220228,722900-23188,FALSE
KSBA,723925,23190,SANTA BARBARA MUNICIPAL AIRPORT,US,CA,34.424,-119.842,2.5,19730101,20220228,723925-23190,FALSE
KSBP,722897,93206,SAN LUIS COUNTY REGIONAL AIRPORT,US,CA,35.233,-120.633,65,19730227,20051231,722897-99999,FALSE
KSCK,724920,23237,STOCKTON METROPOLITAN AIRPORT,US,CA,37.89,-121.226,8.3,19410103,20220228,724920-23237,FALSE
KSEA,727930,24233,SEATTLE-TACOMA INTERNATIONAL AIRPORT,US,WA,47.445,-122.314,112.5,19480101,20220301,727930-24233,FALSE
KSEE,722907,53143,GILLESPIE FIELD AIRPORT,US,CA,32.833,-116.967,118,19730101,20051231,722907-99999,FALSE
KSFO,724940,23234,SAN FRANCISCO INTERNATIONAL AIRPORT,US,CA,37.62,-122.366,3.2,19730101,20220228,724940-23234,FALSE
KSGF,724400,13995,SPRINGFIELD-BRANSON REGIONAL AIRPORT,US,MO,37.24,-93.39,384.7,19730101,20220228,724400-13995,FALSE
KSJC,724945,23293,SAN JOSE INTERNATIONAL AIRPORT,US,CA,37.359,-121.924,15,19730101,20220228,724945-23293,FALSE
KSLC,725720,24127,SALT LAKE CITY INTERNATIONAL AIRPORT,US,UT,40.771,-111.965,1288.4,19411101,20220228,725720-24127,FALSE
KSMF,724839,93225,SACRAMENTO INTERNATIONAL AIRPORT,US,CA,38.701,-121.595,7.5,19730101,20220228,724839-93225,FALSE
KSNA,722977,93184,JOHN WAYNE AIRPORT,US,CA,33.68,-117.867,13,19400617,20220228,722977-93184,FALSE
KTRM,747187,03104,DESERT RESORTS REGIONAL AIRPORT,US,CA,33.632,-116.164,-36,19430712,20220228,747187-03104,FALSE
KTUS,722740,23160,TUCSON INTERNATIONAL AIRPORT,US,AZ,32.132,-110.956,777.6,19730101,20220228,722740-23160,FALSE
KTWF,725866,99999,JOSLIN FIELD MAGIC VALLEY AIRPORT,US,ID,42.483,-114.483,1265,19730101,20051231,725866-99999,FALSE
KUKI,725905,23275,UKIAH MUNICIPAL AIRPORT,US,CA,39.128,-123.2,183.7,19730101,20220228,725905-23275,FALSE
KWJF,723816,03159,GENERAL WILLIAM J. FOX AIRFIELD AIRPORT,US,CA,34.741,-118.213,712.6,19740601,20220228,723816-03159,FALSE
KYKM,727810,24243,YAKIMA AIR TERMINAL,US,WA,46.564,-120.535,321,19730101,20220228,727810-24243,FALSE
KONT,747040,03102,ONTARIO INTERNATIONAL AIRPORT,US,CA,34.067,-117.65,303.9,19421215,19991231,747040-03102,TRUE
15 changes: 11 additions & 4 deletions collaborative/IOU/heat_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@
"outputs": [],
"source": [
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import pandas as pd\n",
"from climakitae.util.utils import read_csv_file, get_closest_gridcell, compute_multimodel_stats, trendline, summary_table, convert_to_local_time"
"import panel as pn\n",
"pn.extension()\n",
"\n",
"from climakitae.util.utils import (\n",
" read_csv_file, get_closest_gridcell, compute_multimodel_stats, \n",
" trendline, summary_table, convert_to_local_time\n",
")"
]
},
{
Expand All @@ -67,7 +74,7 @@
"outputs": [],
"source": [
"# select historical data\n",
"selections = ck.Select()\n",
"selections = ckg.Select()\n",
"\n",
"selections.data_type = 'Gridded'\n",
"selections.area_subset = 'CA Electric Load Serving Entities (IOU & POU)'\n",
Expand Down Expand Up @@ -784,7 +791,7 @@
},
"outputs": [],
"source": [
"ck.view(heatidx_hist_day)"
"ckg.view(heatidx_hist_day)"
]
},
{
Expand All @@ -804,7 +811,7 @@
},
"outputs": [],
"source": [
"ck.view(heatidx_proj_day)"
"ckg.view(heatidx_proj_day)"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions exploratory/internal_variability.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@
"outputs": [],
"source": [
"import climakitae as ck\n",
"import climakitaegui as ckg\n",
"import panel as pn\n",
"pn.extension()\n",
"from climakitae.explore.uncertainty import (\n",
" CmipOpt, get_ensemble_data,\n",
" get_warm_level, grab_multimodel_data,\n",
" _area_wgt_average, get_ks_pval_df)\n",
"from climakitae.util.utils import read_ae_colormap\n",
"from climakitae.util.colormap import read_ae_colormap\n",
"\n",
"import holoviews as hv\n",
"from bokeh.models import HoverTool\n",
Expand Down Expand Up @@ -124,7 +125,7 @@
},
"outputs": [],
"source": [
"selections = ck.Select()"
"selections = ckg.Select()"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion exploratory/model_uncertainty.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"import numpy as np\n",
"import cartopy.crs as ccrs\n",
"import holoviews as hv\n",
"import hvplot.xarray\n",
"from climakitae.util.utils import read_csv_file\n",
"\n",
"import warnings\n",
Expand Down Expand Up @@ -342,7 +343,7 @@
"source": [
"# set up for plots\n",
"from climakitae.explore.uncertainty import compute_vmin_vmax\n",
"from climakitae.util.utils import read_ae_colormap\n",
"from climakitae.util.colormap import read_ae_colormap\n",
"cmap = read_ae_colormap(cmap='ae_orange', cmap_hex=True)\n",
"\n",
"from bokeh.models import HoverTool\n",
Expand Down
Loading

0 comments on commit edfe134

Please sign in to comment.