Website

User Guide

_images/fwf-popups.png
Meteogram forecasts of:
    1. FWI values

    1. Associated meteorology

    1. Station-located two-week comparison of observed vs. forecasted FWI values

    1. Associated meteorology. Solid lines represent forecasts and dashed lines represent observed values.

  • A and B can be activated by a double-click on a Desktop computer and single-click on mobile.

  • C and D can be activated by selecting the “weather station” layer in the main drop-down menu and clicking on a weather station of interest.

Visualization Steps

Below are the steps to visualizing the data on a leaflet map. The data starts in python as a zarr file and is converted to a workable leafletjs formate.

  1. Python’s matplotlib is used to create countourf of each forecast product.
  2. From here geojsoncontour is used to convert the countourf plot to a geojson file.
    Cnorm = matplotlib.colors.Normalize(vmin= vmin, vmax =vmax+1)
    contourf = plt.contourf(lngs, lats, fillarray, levels = levels, \
                            linestyles = 'None', norm = Cnorm, colors = colors, extend = 'both')
    plt.close()
    
    geojsoncontour.contourf_to_geojson(
        contourf=contourf,
        min_angle_deg=None,
        ndigits=2,
        stroke_width=None,
        fill_opacity=None,
        geojson_properties=None,
        unit='',
        geojson_filepath = f'/fwf/data/geojson/{folderdate}/{geojson_filepath}.geojson')
    
  3. Now that the data is in a geojson format it could be added to a leaflet map using a variety of different leaflet extensions. However, the file size is a bit large, at this stage ~ 8 Mb. To help reduce the file size geojsons are converted to topojsons using geo2topo
    • If you quantize the geojosn to a topojson you save a lot on file size

    • I found if you use a quantization count (q) of 1e4, will reduce the geojson file by nearly an order of magnitude and doesn’t take away from the quality of the visualization on leaflet

    • reference: https://github.com/topojson/topojson-server

    • Execute geo2topo quantization on comand line

    geo2topo -q 1e4 path_to_infile/file_YYYYMMDDHH.geojson > path_to_outfile/file_YYYYMMDDHH.json
    
  4. Now that the data is in a topojsons its added to leaflet using Leaflet.VectorGrid.Slicer
    fetch(url, {cache: "default"}).then(function(response){
        return response.json();
    }).then(function(json){
        newLayer.addLayer(L.vectorGrid.slicer( json, {
            minZoom: 2,
            maxZoom: 18,
            rendererFactory: L.canvas.tile,
            vectorTileLayerStyles:{
                'FFMC': geo_json_styler18
                    }
                }
            ).setZIndex(500)
        )
    })};