synopcsv

package module
v0.0.0-...-a860b0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2022 License: MIT Imports: 9 Imported by: 0

README

Synopcsv

Description

This package provides download and basic parsing for CSV files based on SYNOP code provided by Meteo France, as well as stations. The base page is located at: https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=90&id_rubrique=32

This is not a synop parser, as the files care in csv format, but contain synop codes, so the page is a bit misleading.

Build and test

This package has now moved to Go modules (so requires a Go version that supports them). It should work automatically.

  • Build with go build
  • Test with go test

Command line

A command line utility is available to download and insert some data into an influx db database, this is a test and work in progress. Example:

# cd cmd/insert && go run main.go -from 199601 -to 201706 -dbname ${INDLUX_DBNAME} -passwd ${INFLUX_PWD} -user ${INFLUX_USER} -url http://localhost:8086

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchMeasureCSV

func FetchMeasureCSV(date string) (io.Reader, error)

FetchMeasureCSV retrieve past measures in CSV format https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Synop/Archive/synop.${DATE}.csv.gz with ${DATE} a string as YYYYMM or https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Synop/synop.${DATE}.csv with ${DATE} a string as YYYYMMDDHH

func FetchStationCSV

func FetchStationCSV() (r io.Reader, err error)

FetchStationCSV retrieve station lists as csv from https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Synop/postesSynop.csv

Types

type CSV

type CSV struct {
	// contains filtered or unexported fields
}

CSV is a simple CSV structure to hold tabular data

type CSVRow

type CSVRow map[string]string

CSVRow based on csv file header

type Measure

type Measure struct {
	StationID                           string    // numer_sta
	Date                                time.Time // date
	SeaPressure                         *int      // pmer, in Pa
	PressureVariation                   *int      // tend, in Pa
	BarometricTrend                     *int      // cod_tend, code 0200
	WindDirection                       *int      // dd, in degrees for 10 min
	WindSpeed                           *float64  // ff, in m/s for 10 min
	Temperature                         *float64  // t, in K
	DewPoint                            *float64  // td, in
	Humidity                            *int      // u, in %
	HorizontalVisibility                *float64  // vv, in m
	PresentTime                         *int      // ww, code 4677
	PastTime1                           *int      // w1, code 4561
	PastTime2                           *int      // w2, code 4561
	TotalNebulosity                     *float64  // n, in %
	LowerLevelCloudNebulosity           *int      // nbas, in octa
	LowerLevelCloudHeight               *int      // hbas, in m
	LowerLevelCloudType                 *int      // cl, code 0513
	MiddleLevelCloudType                *int      // cm, code 0515
	HigherLevelCloudType                *int      // ch, code 0509
	PressureStation                     *int      // pres, in Pa
	BarometricLevel                     *int      // niv_bar, in Pa
	Geopotential                        *int      // geop, in m2/s2
	PressureVariation24Hours            *int      // tend24, in Pa
	MinimalTemperatureOverLast12Hours   *float64  // tn12, in K
	MinimalTemperatureOverLast24Hours   *float64  // tn24, in K
	MaximalTemperatureOverLast12Hours   *float64  // tx12, in K
	MaximalTemperatureOverLast24Hours   *float64  // tx24, in K
	MinimalGroundTemperatureOver12Hours *float64  // tminsol, in K
	TwMeasureMethod                     *int      // sw, code 3855
	WetBulbTemperature                  *float64  // tw, in K
	Last10MinutesGust                   *float64  // raf10, in m/s
	GustOverPeriod                      *float64  // rafper, in m/s
	GustPeriod                          *float64  // per, min
	GroundState                         *int      // etat_sol, code 0901
	SnowHeight                          *float64  // ht_neige, in m
	FreshSnowHeight                     *float64  // ssfrai, in m
	FreshSnowPeriod                     *float64  // perssfrai, in 1/10 hour
	PrecipitationOverLastHour           *float64  // rr1, in mm
	PrecipitationOverLast3Hours         *float64  // rr3, in mm
	PrecipitationOverLast6Hours         *float64  // rr6, in mm
	PrecipitationOverLast12Hours        *float64  // rr12, in mm
	PrecipitationOverLast24Hours        *float64  // rr24, in mm
	SpecialPhenomenon1                  *string   // phenspe1, code 3778
	SpecialPhenomenon2                  *string   // phenspe2, code 3778
	SpecialPhenomenon3                  *string   // phenspe3, code 3778
	SpecialPhenomenon4                  *string   // phenspe4, code 3778
	LevelCloudNebulosity1               *int      // nnuage1, in octa
	LevelCloudNebulosity2               *int      // nnuage2, in octa
	LevelCloudNebulosity3               *int      // nnuage3, in octa
	LevelCloudNebulosity4               *int      // nnuage4, in octa
	LevelCloudType1                     *int      // ctype1, code 0500
	LevelCloudType2                     *int      // ctype2, code 0500
	LevelCloudType3                     *int      // ctype3, code 0500
	LevelCloudType4                     *int      // ctype4, code 0500
	LevelBaseHeight1                    *int      // hnuage1, in m
	LevelBaseHeight2                    *int      // hnuage2, in m
	LevelBaseHeight3                    *int      // hnuage3, in m
	LevelBaseHeight4                    *int      // hnuage4, in m

}

Measure as defined in https://donneespubliques.meteofrance.fr/client/document/doc_parametres_synop_168.pdf Names are in english for code mapping Code list is available at https://library.wmo.int/pmb_ged/wmo_306-v1_1-2012_fr.pdf

func ParseMeasureCSV

func ParseMeasureCSV(in io.Reader) ([]Measure, error)

ParseMeasureCSV parses measures from a CSV file formated as https://donneespubliques.meteofrance.fr/client/document/doc_parametres_synop_168.pdf

type Station

type Station struct {
	ID        string
	Name      string
	Latitude  float64
	Longitude float64
	Altitude  float64
}

Station as defined in Synop

func ParseStationsCSV

func ParseStationsCSV(in io.Reader) ([]Station, error)

ParseStationsCSV parses stations from a CSV file formated as "https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Synop/postesSynop.csv"

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL