Examples#
The following set of instructions is a step-by-step guide to reproduce the result in [2], which is an example of using restoreio.
Dataset#
The paper uses the HF radar dataset from the Monterey Bay region in California, USA. The HF radar can be accessed publicly through the national HF radar network gateway maintained by the Coastal Observing Research and Development Center. Please follow these steps to obtain the data file.
Dataset Webpage: The studied data is available through its OpenDap page. In particular, the OpenDap URL of this dataset is
http://hfrnet-tds.ucsd.edu/thredds/dodsC/HFR/USWC/2km/hourly/RTV/HFRADAR_US_West_Coast_2km_Resolution_Hourly_RTV_best.ncd
Navigate to Dataset Webpage: To navigate to the above webpage, visit CORDC THREDDS Serever. From there, click on HF RADAR, US West Coast, and select HFRADAR US West Coast 2km Resolution Hourly RTV and choose Best Time Series.
Subseting Data: The above dataset contains the HF radar covering the west coast of the US from 2012 to the present date with 2km resolution and hourly updates. In the examples below, we focus on a spatial subset of this dataset within the Monterey Bay region for January 2017.
Reproducing Results#
The scripts to reproduce the results can be found in the source code of restoreio under the directory /examples/uncertainty_quant
.
Reproducing Figure 1#
python plot_gdop_coverage.py
Reproducing Figure 2 to Figure 9#
python restoreio_mwe.py
The above python script executes the following lines of code, which is given in Listing 1 of the manuscript. Users may change the settings in the function arguments below. For further details, refer to the API reference documentation of the function restoreio.restore()
function.
>>> # Install restoreio with: pip install restoreio
>>> from restoreio import restore
>>> # OpenDap URL of the remote netCDF data
>>> url = 'http://hfrnet-tds.ucsd.edu/thredds/' + \
... 'dodsC/HFR/USWC/2km/hourly/RTV/HFRAD' + \
... 'AR_US_West_Coast_2km_Resolution_Hou' + \
... 'rly_RTV_best.ncd'
>>> # Generate ensemble and reconstruct gaps
>>> restore(input=url, output='output.nc',
... min_lon=-122.344, max_lon=-121.781,
... min_lat=36.507, max_lat=36.992,
... time='2017-01-25T03:00:00',
... uncertainty_quant=True, plot=True,
... num_samples=2000, ratio_num_modes=1,
... kernel_width=5, scale_error=0.08,
... detect_land=True, fill_coast=True,
... write_samples=True, verbose=True)
The above script generates the output file output.nc
that contains all generated ensemble. Moreover, it creates a subdirectory called output_results
and stores Figure 2 to Figure 9 of the manuscript. These plots are shown below.
Reproducing Figure 10#
First, run
plot_js_divergence.sh
script:bash plot_js_divergence.sh
The above script creates a directory called
output_js_divergence
and stores the output filesoutput-001.nc
tooutput-200.nc
.Next, run
plot_js_divergence.py
script:python plot_js_divergence.py
Reproducing Figure 11#
Run plot_vel_distribution.py
script:
python plot_vel_distribution.py
The above script creates the following plot: