<jupyter_start><jupyter_text>**<NAME>**  *July 20, 2021* RRFS DataThe Rapid Refresh Forecast System is undergoing rapid development. There are prototype products available on the cloud on AWS. Some files have an index file, others do not.<jupyter_code>from herbie.archive import Herbie
from toolbox.cartopy_tools import common_features, pc
from paint.standard2 import cm_tmp

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
H = Herbie('2021-07-23', 
           model='rrfs', fxx=1)
H.SOURCES
x = H.xarray('TMP:2 m')
ax = common_features(crs=x.herbie.crs, figsize=[8,8]).ax
p = ax.pcolormesh(x.longitude, x.latitude, x.t2m, 
              transform=pc, 
              **cm_tmp(units='K').cmap_kwargs)
plt.colorbar(p, ax=ax, 
             orientation='horizontal', pad=.05,
             **cm_tmp(units='K').cbar_kwargs)

ax.set_title(x.t2m.GRIB_name, loc='right')
ax.set_title(f"{H.model.upper()}: {H.product_description}", loc='left')<jupyter_output>/p/home/blaylock/anaconda3/envs/herbie/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py:1702: UserWarning: The input coordinates to pcolormesh are interpreted as cell centers, but are not monotonically increasing or decreasing. This may lead to incorrectly calculated cell edges, in which case, please supply explicit cell edges to pcolormesh.
  X, Y, C, shading = self._pcolorargs('pcolormesh', *args,<jupyter_text>What about when there isn't an index file available?We have to download the full file.<jupyter_code>H = Herbie('2021-07-23', 
           model='rrfs', product='testbed.conus', member=1, priority='aws-mem')
# no index file available. Have to download the full file.
H.download()
import xarray
# Since we have the full file, we need to filter by keys to open the
# variable we want with cfgrib
x = xarray.open_dataset(
    H.get_localFilePath(), 
    engine='cfgrib', 
    backend_kwargs={'filter_by_keys': {'shortName': '2t',
                                       'typeOfLevel': 'heightAboveGround'}})
ax = common_features(crs=x.herbie.crs, figsize=[8,8]).ax
p = ax.pcolormesh(x.longitude, x.latitude, x.t2m, 
              transform=pc, 
              **cm_tmp(units='K').cmap_kwargs)
plt.colorbar(p, ax=ax, 
             orientation='horizontal', pad=.05,
             **cm_tmp(units='K').cbar_kwargs)

ax.set_title(x.t2m.GRIB_name, loc='right')
ax.set_title(f"{H.model.upper()}: member {H.member}", loc='left')<jupyter_output><empty_output><jupyter_text>Grid MappingHerbie attempts to parse the CF grid mapping from the GRIB data if it is available. This can be parsed by metpy.<jupyter_code>import metpy
crs_info = x.metpy.parse_cf().metpy_crs.item()
crs_info.to_cartopy()
crs_info.to_pyproj()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1268022181146026, 'fraction_numerical': 0.017005545286506468, 'mean_word_length': 4.16412213740458, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '27207', 'license': 'MIT', 'n_tokens_mistral': 965, 'n_tokens_neox': 922, 'n_words': 230, 'path': 'docs/_build/html/user_guide/notebooks/data_rrfs.ipynb', 'repo_name': 'blaylockbk/HRRR_archive_download', 'size': '2713'}