Copyright | (C) 2017 Ricky Elrod |
---|---|
License | (see project LICENSE file) |
Maintainer | Ricky Elrod <ricky@elrod.me> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Data.HABSim.Grib2.CSVParse
Contents
Description
This module provides utilities for parsing and filtering data from a
wgrib2
-generated CSV file. Once the CSV files is generated, it can be
parsed and filtered in the following way (preferably with better error
handling):
myCsv <-readFile
"/path/to/csv.csv" casedecodeGrib
myCsv of Left str -> error str Right gribLines -> casefilterGrib
38.8977 (-77.0365) 950 gribLines of Nothing -> error "No entry found" Just wh -> print wh
- module Data.HABSim.Grib2.CSVParse.Types
- gribLineToRaw :: GribLine -> RawGribLine
- decodeKeyedGrib :: ByteString -> Either String (Vector KeyedGribLine)
- keyedGribToHM :: Vector KeyedGribLine -> HashMap Key GribLine
- filterKeyedGrib :: Latitude -> Longitude -> Int -> Direction -> HashMap Key GribLine -> Maybe GribLine
Documentation
gribLineToRaw :: GribLine -> RawGribLine #
Given any kind of GridLine
(usually either a UGRDGribLine
or a
VGRDGribLine
, but could also be an OtherGribLine
), pull the raw Grib line
out of it.
Keyed/HashMap-based Grib data
decodeKeyedGrib :: ByteString -> Either String (Vector KeyedGribLine) #
A helper function that primarily exists just to help type inference.
decodeKeyedGrib = decode NoHeader
(where decode
and NoHeader
both come
from Cassava).
keyedGribToHM :: Vector KeyedGribLine -> HashMap Key GribLine #
Convert a Vector
of KeyedGribLine
into a HashMap
keyed on the
latitude longitude, pressure, and direction of the grib line.