Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated gssha_demo.ipynb #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading