Skip to content

Commit

Permalink
saved tutorials track data; fixed minor bug section 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmelo-Belo committed Sep 12, 2023
1 parent 7e67080 commit 6aa7b7f
Show file tree
Hide file tree
Showing 176 changed files with 775 additions and 10 deletions.
11 changes: 4 additions & 7 deletions notebooks-examples-trials/TropiDash_backbone.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"# The observed data is saved as a csv file called ibtracs.ACTIVE.list.v04r00.csv\n",
"url = 'https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/csv/ibtracs.ACTIVE.list.v04r00.csv'\n",
"r = requests.get(url, allow_redirects=True)\n",
"save_file = 'data/ibtracs.ACTIVE.list.v04r00.csv'\n",
"save_file = 'data/tracks/ibtracs.ACTIVE.list.v04r00.csv'\n",
"with open(save_file, 'wb') as f:\n",
" f.write(r.content)"
]
Expand All @@ -110,8 +110,7 @@
"df_storms_forecast = create_storms_df(start_date)\n",
"\n",
"## LOAD THE OBSERVED TRACKS IN A DATAFRAME ## \n",
"# df_storms_observed = pd.read_csv('data/ibtracs.ACTIVE.list.v04r00.csv', header=[0,1])\n",
"df_storms_observed = pd.read_csv('trials/test_data_access/ibtracs_data.csv', header=[0,1])\n",
"df_storms_observed = pd.read_csv('data/tracks/ibtracs.ACTIVE.list.v04r00.csv', header=[0,1])\n",
"\n",
"## CREATE THE LIST OF ACTIVE CYCLONES IN THE FORECAST ##\n",
"cycl = np.array((df_storms_forecast.stormIdentifier.unique(), df_storms_forecast.longStormName.unique()))\n",
Expand Down Expand Up @@ -255,12 +254,10 @@
" code, name = cyclone.value.split('-')\n",
" display(widgets.HTML(value=f\"Creating the dataset for tropical cyclone <b>{name}</b>\")) # clear previous cyclones plots\n",
" df_storms_forecast = create_storms_df(start_date_forecast.value)\n",
" # df_storms_observed = pd.read_csv('data/ibtracs.ACTIVE.list.v04r00.csv', header=[0,1])\n",
" df_storms_observed = pd.read_csv('trials/test_data_access/ibtracs_data.csv', header=[0,1])\n",
" df_storms_observed = pd.read_csv('data/tracks/ibtracs.ACTIVE.list.v04r00.csv', header=[0,1])\n",
" df_f = df_storms_forecast[df_storms_forecast.stormIdentifier == code]\n",
" df_f.reset_index(drop=True, inplace=True)\n",
" # df_o = df_storms_observed[df_storms_observed.NAME.squeeze() == name]\n",
" df_o = df_storms_observed[df_storms_observed.NAME.squeeze() == 'HILARY']\n",
" df_o = df_storms_observed[df_storms_observed.NAME.squeeze() == name]\n",
" df_o.reset_index(drop=True, inplace=True)\n",
" # Initial and final lat-lon\n",
" initial_lat_lon = (df_f.latitude.iloc[0], df_f.longitude.iloc[0])\n",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<PAMDataset>
<PAMRasterBand band="1">
<Description>2 metre temperature</Description>
<Metadata>
<MDI key="GRIB_cfName">air_temperature</MDI>
<MDI key="GRIB_cfVarName">t2m</MDI>
<MDI key="GRIB_dataType">fc</MDI>
<MDI key="GRIB_gridDefinitionDescription">Latitude/longitude</MDI>
<MDI key="GRIB_gridType">regular_ll</MDI>
<MDI key="GRIB_iDirectionIncrementInDegrees">0.4</MDI>
<MDI key="GRIB_iScansNegatively">0</MDI>
<MDI key="GRIB_jDirectionIncrementInDegrees">0.4</MDI>
<MDI key="GRIB_jPointsAreConsecutive">0</MDI>
<MDI key="GRIB_jScansPositively">0</MDI>
<MDI key="GRIB_latitudeOfFirstGridPointInDegrees">90.0</MDI>
<MDI key="GRIB_latitudeOfLastGridPointInDegrees">-90.0</MDI>
<MDI key="GRIB_longitudeOfFirstGridPointInDegrees">180.0</MDI>
<MDI key="GRIB_longitudeOfLastGridPointInDegrees">179.6</MDI>
<MDI key="GRIB_missingValue">3.4028234663852886e+38</MDI>
<MDI key="GRIB_name">2 metre temperature</MDI>
<MDI key="GRIB_numberOfPoints">405900</MDI>
<MDI key="GRIB_NV">0</MDI>
<MDI key="GRIB_Nx">900</MDI>
<MDI key="GRIB_Ny">451</MDI>
<MDI key="GRIB_paramId">167</MDI>
<MDI key="GRIB_shortName">2t</MDI>
<MDI key="GRIB_stepType">instant</MDI>
<MDI key="GRIB_stepUnits">1</MDI>
<MDI key="GRIB_typeOfLevel">heightAboveGround</MDI>
<MDI key="GRIB_units">K</MDI>
<MDI key="long_name">2 metre temperature</MDI>
<MDI key="standard_name">air_temperature</MDI>
<MDI key="STATISTICS_APPROXIMATE">YES</MDI>
<MDI key="STATISTICS_MAXIMUM">310.80377197266</MDI>
<MDI key="STATISTICS_MEAN">280.61687233108</MDI>
<MDI key="STATISTICS_MINIMUM">208.77252197266</MDI>
<MDI key="STATISTICS_STDDEV">20.452840550045</MDI>
<MDI key="STATISTICS_VALID_PERCENT">100</MDI>
<MDI key="units">K</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<PAMDataset>
<PAMRasterBand band="1">
<Description>msl</Description>
<Metadata>
<MDI key="STATISTICS_APPROXIMATE">YES</MDI>
<MDI key="STATISTICS_MAXIMUM">104.59562683105</MDI>
<MDI key="STATISTICS_MEAN">100.96308049192</MDI>
<MDI key="STATISTICS_MINIMUM">96.25562286377</MDI>
<MDI key="STATISTICS_STDDEV">1.2182982426252</MDI>
<MDI key="STATISTICS_VALID_PERCENT">100</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<PAMDataset>
<PAMRasterBand band="1">
<Description>Total precipitation</Description>
<Metadata>
<MDI key="STATISTICS_APPROXIMATE">YES</MDI>
<MDI key="STATISTICS_MAXIMUM">0.14429473876953</MDI>
<MDI key="STATISTICS_MEAN">0.0028296943035604</MDI>
<MDI key="STATISTICS_MINIMUM">0</MDI>
<MDI key="STATISTICS_STDDEV">0.0066340284669862</MDI>
<MDI key="STATISTICS_VALID_PERCENT">100</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added notebooks-examples-trials/data/msl_20230907.grib
Binary file not shown.
Binary file not shown.
Binary file added notebooks-examples-trials/data/msl_20230912.grib
Binary file not shown.
Binary file not shown.
Binary file removed notebooks-examples-trials/data/pts_raster07L.tif
Binary file not shown.
Binary file removed notebooks-examples-trials/data/pts_raster09W.tif
Binary file not shown.
Binary file removed notebooks-examples-trials/data/pts_raster10E.tif
Binary file not shown.
Binary file removed notebooks-examples-trials/data/pts_raster10L.tif
Binary file not shown.
Binary file added notebooks-examples-trials/data/skt_20230907.grib
Binary file not shown.
Binary file not shown.
Binary file added notebooks-examples-trials/data/skt_20230912.grib
Binary file not shown.
Binary file not shown.
Binary file added notebooks-examples-trials/data/tp_20230907.grib
Binary file not shown.
Binary file not shown.
Binary file added notebooks-examples-trials/data/tp_20230912.grib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<PAMDataset>
<PAMRasterBand band="1">
<Metadata>
<MDI key="STATISTICS_APPROXIMATE">YES</MDI>
<MDI key="STATISTICS_MAXIMUM">100</MDI>
<MDI key="STATISTICS_MEAN">5.4612016908213</MDI>
<MDI key="STATISTICS_MINIMUM">0</MDI>
<MDI key="STATISTICS_STDDEV">19.26469297149</MDI>
<MDI key="STATISTICS_VALID_PERCENT">100</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
7 changes: 4 additions & 3 deletions notebooks-examples-trials/tracks_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def mean_forecast_track(df_storm):
date = dates[t].strftime("%d-%m-%Y %H:%M")
if len(lat) > 0:
mean_lat_lon = meanposit(len(lat), lat, lon)
pressures.append(prs.mean())
pressures.append(prs.mean() * 10**-2) # Pa to hPa
winds.append(wds.mean())
mean_track_coord.append(mean_lat_lon)
timesteps.append(date)
Expand Down Expand Up @@ -325,7 +325,7 @@ def storm_df_reorganization(df):
def strike_probability_map(df_storm_forecast):
"""
Computes the strike probability map of a cyclone and saves it to raster file
"data/pts_raster.tif"
"data/tracks/pts_raster.tif"
df_storm_forecast: pandas.DataFrame
Dataframe containing the cyclone forecast tracks data
Expand All @@ -341,6 +341,7 @@ def strike_probability_map(df_storm_forecast):
df = storm_df_reorganization(df_storm_forecast.copy())
df.dropna(subset = ['lat', 'lon'], inplace=True)
df["id"] = df.number
forecast_date = min(df.date)

# Set of general parameters for the pts algorithm
distance = 200.0e3
Expand Down Expand Up @@ -461,7 +462,7 @@ def ranges(i):
strike_map = val.reshape((Nj, Ni))
strike_map_xr = xr.DataArray(strike_map, dims=('latitude', 'longitude'), coords={'latitude': lats, 'longitude': lons})

tif_path = f"data/pts_raster{storm_code}.tif"
tif_path = f"data/tracks/pts_raster_{storm_code}_{forecast_date}.tif"
strike_map_xr = strike_map_xr.rio.write_crs("epsg:4326")
strike_map_xr.rio.to_raster(tif_path)

Expand Down
Binary file added tutorials/data/20230907.bufr
Binary file not shown.
Loading

0 comments on commit 6aa7b7f

Please sign in to comment.