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 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
58 changes: 58 additions & 0 deletions environment_icechunk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: icechunk
channels:
- conda-forge
# - nodefaults # Speeds solving env, by limiting the number of options

dependencies:
- python =3.12

# Data Engine
- icechunk # installs zarr3

# Data processing
- geopandas # installs shapely, pyarrow, pyogrio, libgdal, networkx
- xarray
- rioxarray
- dask

# Remote Access
- fsspec
- s3fs # Access to Amazon S3 filesystem
- kerchunk
- virtualizarr
- cdsapi # Access to Copernicus Data System for ERA5


# # HyRiver packages for data fetching
# - pygeoogc # Retrieve Data from RESTful, WMS, and WFS Services
# - async-retriever # Asynchronous requests with persistent caching

# # Visualization (optional)
# - hvplot # hvPlot installs most HoloViz libs, https://holoviz.org
# - geoviews
# - contextily # for static plotting

# # Interactivity via Jupyter Notebooks
# - jupyterlab
# - nodejs # required for many extensions
# - ipympl # jupyter-matplotlib, https://github.com/matplotlib/ipympl
# - ipywidgets # Interactive HTML widgets for Jupyter
# - ipywidgets_bokeh
# - jupyter_bokeh # Renders Holviz / Bokeh objects in Jupyter
# - pyviz_comms # bidirectional communication between Python & JavaScript for Jupyter
# - jupyter_fsspec

# Dev tools: Language Server Protocol (LSP) (Optional)
- python-lsp-server # LSP extension for Python (pylsp), including:
- pylsp-mypy # MyPy type checking for Python >=3.7.
# - jupyterlab-lsp # Provides both server extension and lab extension

# Environment and package management
- conda
- conda-build
- conda-libmamba-solver # Faster env solver, https://conda.github.io/conda-libmamba-solver/
- pip
- git # for pip installing directly from GitHub
# PIP install requirements only if it is not possible with conda
- pip:
# -
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