<jupyter_start><jupyter_text>Open and briefly analyze an example of synthetic-aperture radar (SAR) data, which is a form of radar used to create two or three dimensional reconstructions of objects. As part of the SUNRISE grant I am on with Rob, we are interested in using SAR data to identify submesoscale eddies in the northern Gulf of Mexico. SAR data can be particulary useful for this because some of the premium products contain very high spatial resolution compared to alternatives like satillite altimetry.  The data structure can be quite complicated - and the example shown is Level 2 Sentinal 1 downloaded from https://search.asf.alaska.edu//. You will have to make an account to download the data, but it only takes a minute. Level 2 means the data contain derived geophysical variables from processed (and calibrated) data; see https://sentinel.esa.int/web/sentinel/technical-guides/sentinel-1-sar/products-algorithms/level-2-algorithms/formatting for more information on the formatting and https://sentinel.esa.int/web/sentinel/user-guides/sentinel-1-sar/definitions for definitions.The data consists of three components: Ocean Swell Spectra, Ocean Wind Field, and Radial Surface Velocity. Each of these components is on a different spatial grid - further complicating things.<jupyter_code>ds = xr.open_dataset('s1a-iw-ocn-vv-20200913t001819-20200913t001844-034333-03FDDC-001.nc')
ds<jupyter_output><empty_output><jupyter_text>Plot the radial velocity as an example. It is defined as the 'ground range gridded difference between the measured Level-2 Doppler grid and the Level-1 calculated geometrical Doppler. The RVL component provides continuity of the ASAR Doppler grid. The RVL estimates are produced on a ground-range grid'. https://sentinel.esa.int/web/sentinel/technical-guides/sentinel-1-sar/products-algorithms/level-2/products/surface-radial-velocity-component<jupyter_code>ds.rvlRadVel<jupyter_output><empty_output><jupyter_text>The dimensions 'rvlRadVel' and 'rvlRaSize' can be thought of as the X and Y coordinates, with rvlSwath containing the different grids that the velocity is measured on. Here, let's plot the second one because it doesn't touch land, therefore containing no NaNs, which will make things easier when plotting<jupyter_code>ds.rvlRadVel[:,:,1].plot()<jupyter_output><empty_output><jupyter_text>We can make this plot better. Let's clean it up using cartopy to provide some geographical context.<jupyter_code>lon = ds.rvlLon[:,:,1].data
lat = ds.rvlLat[:,:,1].data
vel = ds.rvlRadVel[:,:,1].values
fig = plt.figure(figsize=(15,6))
ax = fig.add_axes([0.06, 0.01, 0.93, 0.95], projection=ccrs.Mercator())

mappable = ax.pcolormesh(lon, lat, vel, 
                       cmap = cmo.amp,
                       vmin = -1.5,
                       vmax = 0,
                       transform = ccrs.PlateCarree())

land_10m = cfeature.NaturalEarthFeature('physical', 'land', '10m',
                                edgecolor='face',
                                facecolor=cfeature.COLORS['land'])

states_provinces = cfeature.NaturalEarthFeature(
                   category='cultural',
                   name='admin_1_states_provinces_lines',
                   scale='10m',
                   facecolor='none')

gl = ax.gridlines(linewidth=0.4, color='black', alpha=0.5, linestyle='-', draw_labels=True)
ax.set_extent([-98, -90, 27, 30.5], ccrs.PlateCarree())
ax.add_feature(land_10m, facecolor='0.8')
ax.add_feature(states_provinces, edgecolor='0.2')
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.RIVERS)
ax.add_feature(cfeature.BORDERS, linestyle='-', edgecolor='0.2')
ax.set_aspect('auto')

cax = fig.add_axes([0.09, 0.91, 0.32, 0.02]) 
cb = fig.colorbar(mappable, cax=cax, orientation='horizontal')
cb.set_label(r'Radial Velocity [ms$^{-1}$]', fontsize=18, color='0.2')
cb.ax.tick_params(labelsize=18, length=2, color='0.2', labelcolor='0.2')
ax.tick_params(axis='y', labelsize=18)

gl.xformatter = LONGITUDE_FORMATTER
gl.yformatter = LATITUDE_FORMATTER
gl.right_labels = False
gl.top_labels = False

ax.set_title('Sentinel-1 SAR Radial Velocity: 09/13/20')
plt.rcParams.update({'font.size': 18})<jupyter_output><empty_output><jupyter_text>Let's look at another variable: the wind velocity measured from the SAR backscatter. It is a bit unclear what the reference height is but standard practice is 10 m above the surface<jupyter_code>ds.owiWindSpeed
lon = ds.owiLon.data
lat = ds.owiLat.data
windspd = ds.owiWindSpeed.values
fig = plt.figure(figsize=(15,6))
ax = fig.add_axes([0.06, 0.01, 0.93, 0.95], projection=ccrs.Mercator())

mappable = ax.pcolormesh(lon, lat, windspd, 
                       cmap = cmo.thermal,
                       
                       transform = ccrs.PlateCarree())

gl = ax.gridlines(linewidth=0.4, color='black', alpha=0.5, linestyle='-', draw_labels=True)
ax.set_extent([-98, -90, 27, 30.5], ccrs.PlateCarree())
ax.add_feature(land_10m, facecolor='0.8')
ax.add_feature(states_provinces, edgecolor='0.2')
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.RIVERS)
ax.add_feature(cfeature.BORDERS, linestyle='-', edgecolor='0.2')
ax.set_aspect('auto')

cax = fig.add_axes([0.09, 0.91, 0.32, 0.02]) 
cb = fig.colorbar(mappable, cax=cax, orientation='horizontal')
cb.set_label(r'Wind Speed [ms$^{-1}$]', fontsize=18, color='0.2')
cb.ax.tick_params(labelsize=18, length=2, color='0.2', labelcolor='0.2')
ax.tick_params(axis='y', labelsize=18)

gl.xformatter = LONGITUDE_FORMATTER
gl.yformatter = LATITUDE_FORMATTER
gl.right_labels = False
gl.top_labels = False

ax.set_title('Sentinel-1 SAR Wind Speed: 09/13/20')
plt.rcParams.update({'font.size': 18})<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12101689012711127, 'fraction_numerical': 0.03621800452725057, 'mean_word_length': 4.368224299065421, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '500781', 'license': 'MIT', 'n_tokens_mistral': 2078, 'n_tokens_neox': 1894, 'n_words': 487, 'path': 'HW1/Synthetic_aperture_radar/HW1_SAR_Schlichting.ipynb', 'repo_name': 'adv-py-geos/adv-py-geos', 'size': '5743'}