Skip to content

Commit

Permalink
Updated gssha_demo.ipynb
Browse files Browse the repository at this point in the history
1) Fixed direct and global radiation parameter selection, 2) performs unit conversion from J/m^2 to W/m^2 for both direct and global radiation parameters, and 3) fixed wind speed calculation
  • Loading branch information
jrutyna committed Apr 3, 2024
1 parent 2a19d0c commit 7ed6480
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions examples/gssha_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,8 @@
" 'total_cloud_cover',\n",
" '10m_u_component_of_wind', # used to calculate wind speed\n",
" '10m_v_component_of_wind', # used to calculate wind speed\n",
" 'total_sky_direct_solar_radiation_at_surface',\n",
" 'surface_solar_radiation_downwards',\n",
" 'surface_net_solar_radiation',\n",
" ],\n",
" start_time='2023-03-01T00:00:00',\n",
" end_time='2023-03-31T23:00:00',\n",
Expand Down Expand Up @@ -1832,7 +1832,9 @@
"calculated_wind_speed = False\n",
"converted_clouds = False\n",
"converted_temp = False\n",
"converted_pressure = False"
"converted_pressure = False\n",
"converted_direct_radiation = False\n",
"converted_global_radiation = False"
]
},
{
Expand Down Expand Up @@ -1896,7 +1898,7 @@
"if not calculated_wind_speed:\n",
" wind_speed = metpy.calc.wind_speed(\n",
" (hmet_data['10m_u_component_of_wind'] * units.meter_per_second),\n",
" (hmet_data['10m_u_component_of_wind'] * units.meter_per_second),\n",
" (hmet_data['10m_v_component_of_wind'] * units.meter_per_second),\n",
" ).metpy.convert_units(units.kts)\n",
"\n",
" # convert to kts\n",
Expand Down Expand Up @@ -1981,6 +1983,30 @@
" converted_temp = True"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Convert both direct and global radition to W/m^2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if not converted_direct_radiation:\n",
" hmet_data['total_sky_direct_solar_radiation_at_surface'] = hmet_data['total_sky_direct_solar_radiation_at_surface'] / 3600\n",
" hmet_data['total_sky_direct_solar_radiation_at_surface'].attrs['units'] = 'W/m^2'\n",
" converted_direct_radiation = True\n",
"\n",
"if not converted_global_radiation:\n",
" hmet_data['surface_solar_radiation_downwards'] = hmet_data['surface_solar_radiation_downwards'] / 3600\n",
" hmet_data['surface_solar_radiation_downwards'].attrs['units'] = 'W/m^2'\n",
" converted_global_radiation = True"
]
},
{
"cell_type": "code",
"execution_count": 24,
Expand Down Expand Up @@ -2761,8 +2787,8 @@
" 'total_cloud_cover': 'Total Sky Cover',\n",
" 'wind_speed': 'Wind Speed',\n",
" '2m_temperature': 'Dry Bulb Temperature',\n",
" 'surface_solar_radiation_downwards': 'Direct Radiation',\n",
" 'surface_net_solar_radiation': 'Global Radiation',\n",
" 'total_sky_direct_solar_radiation_at_surface': 'Direct Radiation',\n",
" 'surface_solar_radiation_downwards': 'Global Radiation',\n",
"}"
]
},
Expand Down

0 comments on commit 7ed6480

Please sign in to comment.