slider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const AvailableDatesURI = "https://rammb-slider.cira.colostate.edu/data/json/%s/%s/%s/available_dates.json"

AvailableDatesURI is the address for retrieving the latest dates for available images.

View Source
const ImageURI = "https://rammb-slider.cira.colostate.edu/data/imagery/%s/%s---%s/%s/%s/%02d/%03d_%03d.png"

ImageURI is the request address for images. It contains the following fields:

View Source
const LatestTimes5760URI = "https://rammb-slider.cira.colostate.edu/data/json/%s/%s/%s/latest_times_5760.json"

LatestTimes5760URI is the same as LatestTimesURI but with more times.

View Source
const LatestTimesURI = "https://rammb-slider.cira.colostate.edu/data/json/%s/%s/%s/latest_times.json"

LatestTimesURI is the address for retrieving the latest times for available images.

Variables

View Source
var CIRADustDEBRAProduct = &Product{
	ID:           "debra",
	FriendlyName: "Dust - DEBRA",
	Description:  "CIRA",
	Value:        "cira_debra_dust",
	ZoomAdjust:   2,
}

CIRA Dust DEBRA Product

View Source
var CIRAGeoColorProduct = &Product{
	ID:           "geocolor",
	FriendlyName: "GeoColor",
	Description:  "CIRA",
	Value:        "geocolor",
	ZoomAdjust:   1,
}

CIRA GeoColor Product

View Source
var CIRAProxyVisibleProduct = &Product{
	ID:           "proxy-visible",
	FriendlyName: "Proxy Visible",
	Description:  "CIRA",
	Value:        "cira_proxy_visible",
}

CIRA Proxy Visible Product

View Source
var CIRAShortwaveAlbedoProduct = &Product{
	ID:           "shortwave-albedo",
	FriendlyName: "Shortwave Albedo",
	Description:  "CIRA",
	Value:        "shortwave_albedo_cira",
	ZoomAdjust:   2,
}

CIRA Shortwave Albedo Product

View Source
var CIRASnowCloudLayersProduct = &Product{
	ID:           "snow-cloud-layers",
	FriendlyName: "Snow/Cloud-Layers",
	Description:  "CIRA",
	Value:        "cira_high_low_cloud_and_snow",
	ZoomAdjust:   1,
}

CIRA Snow/Cloud-Layers Product

View Source
var CIRASnowCloudProduct = &Product{
	ID:           "snow-cloud",
	FriendlyName: "Snow/Cloud",
	Description:  "CIRA",
	Value:        "cira_cloud_snow_discriminator",
	ZoomAdjust:   1,
}

CIRA Snow/Cloud Product

View Source
var CIRAVisibleAlbedoProduct = &Product{
	ID:           "visible-albedo",
	FriendlyName: "Visible Albedo",
	Description:  "CIRA",
	Value:        "visible_albedo_cira",
	ZoomAdjust:   2,
}

CIRA Visible Albedo Product

View Source
var GOES16Satellite = &Satellite{
	ID:           "goes-16",
	FriendlyName: "GOES-16",
	Description:  "East, 75.2W",
	Value:        "goes-16",
	Products: map[string]*Product{
		GOESBand1Product.ID:    GOESBand1Product,
		GOESBand2Product.ID:    GOESBand2Product,
		CIRAGeoColorProduct.ID: CIRAGeoColorProduct,
	},
	Sectors: map[string]*Sector{
		GOESCONUSSector.ID:      GOESCONUSSector,
		GOESFullDiskSector.ID:   GOESFullDiskSector,
		GOESMesoscale1Sector.ID: GOESMesoscale1Sector,
		GOESMesoscale2Sector.ID: GOESMesoscale2Sector,
	},
	ZoomLevels: GOESHimawariZoomLevels,
}

GOES-16 Satellite

GOES-17 Satellite

View Source
var GOESBand10Product = &Product{
	ID:           "band-10",
	FriendlyName: "Band 10",
	Description:  "7.3 µm 'Lower-level Water Vapor'",
	Value:        "band_10",
	ZoomAdjust:   2,
}

GOES Band 10 Product

View Source
var GOESBand11Product = &Product{
	ID:           "band-11",
	FriendlyName: "Band 11",
	Description:  "8.4 µm 'Cloud-Top Phase'",
	Value:        "band_11",
	ZoomAdjust:   2,
}

GOES Band 11 Product

View Source
var GOESBand12Product = &Product{
	ID:           "band-12",
	FriendlyName: "Band 12",
	Description:  "9.6 µm 'Ozone'",
	Value:        "band_12",
	ZoomAdjust:   2,
}

GOES Band 12 Product

View Source
var GOESBand13Product = &Product{
	ID:           "band-13",
	FriendlyName: "Band 13",
	Description:  "10.3 µm 'Clean & IR Longwave Window'",
	Value:        "band_13",
	ZoomAdjust:   2,
}

GOES Band 13 Product

View Source
var GOESBand14Product = &Product{
	ID:           "band-14",
	FriendlyName: "Band 14",
	Description:  "11.2 µm 'IR Longwave Window'",
	Value:        "band_14",
	ZoomAdjust:   2,
}

GOES Band 14 Product

View Source
var GOESBand15Product = &Product{
	ID:           "band-15",
	FriendlyName: "Band 15",
	Description:  "12.3 µm '\"Dirty\" Longwave Window'",
	Value:        "band_15",
	ZoomAdjust:   2,
}

GOES Band 15 Product

View Source
var GOESBand16Product = &Product{
	ID:           "band-16",
	FriendlyName: "Band 16",
	Description:  "13.3 µm '\"CO2\" Longwave Infrared",
	Value:        "band_16",
	ZoomAdjust:   2,
}

GOES Band 16 Product

View Source
var GOESBand1Product = &Product{
	ID:           "band-1",
	FriendlyName: "Band 1",
	Description:  "0.47 µm 'Blue'",
	Value:        "band_01",
	ZoomAdjust:   1,
}

GOES Band 1 Product

View Source
var GOESBand2Product = &Product{
	ID:           "band-2",
	FriendlyName: "Band 2",
	Description:  "0.64 µm 'Red'",
	Value:        "band_02",
}

GOES Band 2 Product

View Source
var GOESBand3Product = &Product{
	ID:           "band-3",
	FriendlyName: "Band 3",
	Description:  "0.86 µm 'Veggie'",
	Value:        "band_03",
	ZoomAdjust:   1,
}

GOES Band 3 Product

View Source
var GOESBand4Product = &Product{
	ID:           "band-4",
	FriendlyName: "Band 4",
	Description:  "1.37 µm 'Cirrus'",
	Value:        "band_04",
	ZoomAdjust:   2,
}

GOES Band 4 Product

View Source
var GOESBand5Product = &Product{
	ID:           "band-5",
	FriendlyName: "Band 5",
	Description:  "1.6 µm 'Snow/Ice'",
	Value:        "band_05",
	ZoomAdjust:   1,
}

GOES Band 5 Product

View Source
var GOESBand6Product = &Product{
	ID:           "band-6",
	FriendlyName: "Band 6",
	Description:  "2.2 µm 'Cloud Particle Size'",
	Value:        "band_06",
	ZoomAdjust:   2,
}

GOES Band 6 Product

View Source
var GOESBand7Product = &Product{
	ID:           "band-7",
	FriendlyName: "Band 7",
	Description:  "3.9 µm 'Shortwave Window'",
	Value:        "band_07",
	ZoomAdjust:   2,
}

GOES Band 7 Product

View Source
var GOESBand8Product = &Product{
	ID:           "band-8",
	FriendlyName: "Band 8",
	Description:  "6.2 µm 'Upper-Level Tropospheric Water Vapor'",
	Value:        "band_08",
	ZoomAdjust:   2,
}

GOES Band 8 Product

View Source
var GOESBand9Product = &Product{
	ID:           "band-9",
	FriendlyName: "Band 9",
	Description:  "6.9 µm 'Mid-Level Tropospheric Water Vapor'",
	Value:        "band_09",
	ZoomAdjust:   2,
}

GOES Band 9 Product

View Source
var GOESCONUSSector = &Sector{
	ID:              "conus",
	FriendlyName:    "CONUS",
	Value:           "conus",
	CellSize:        625,
	CropRatioX:      1,
	CropRatioY:      .6,
	MaxZoomLevel:    4,
	MissingProducts: []*Product{},
}

GOES CONUS Sector

View Source
var GOESFullDiskSector = &Sector{
	ID:              "fd",
	FriendlyName:    "Full Disk",
	Value:           "full_disk",
	CellSize:        678,
	MaxZoomLevel:    5,
	MissingProducts: []*Product{},
}

GOES Full Disk Sector

View Source
var GOESHimawariZoomLevels = []*Zoom{
	{
		Level: 0,
		Scale: "16 km",
	},
	{
		Level: 1,
		Scale: "8 km",
	},
	{
		Level: 2,
		Scale: "4 km",
	},
	{
		Level: 3,
		Scale: "2 km",
	},
	{
		Level: 4,
		Scale: "1 km",
	},
	{
		Level: 5,
		Scale: ".5 km",
	},
	{
		Level: 6,
		Scale: ".25 km",
	},
	{
		Level: 7,
		Scale: ".125 km",
	},
}

GOESHimawariZoomLevels zoom level is a common zoom level list for both GOES and Himawari satellites.

View Source
var GOESMesoscale1Sector = &Sector{
	ID:              "ms1",
	FriendlyName:    "Mesoscale 1",
	Value:           "mesoscale_01",
	CellSize:        500,
	MaxZoomLevel:    2,
	MissingProducts: []*Product{},
}

GOES Mesoscale 1 Sector

View Source
var GOESMesoscale2Sector = &Sector{
	ID:              "ms2",
	FriendlyName:    "Mesoscale 2",
	Value:           "mesoscale_02",
	CellSize:        500,
	MaxZoomLevel:    2,
	MissingProducts: []*Product{},
}

GOES Mesoscale 2 Sector

Himawari-8 Satellite

View Source
var HimawariFullDiskSector = &Sector{
	ID:              "fd",
	FriendlyName:    "Full Disk",
	Value:           "full_disk",
	CellSize:        688,
	MaxZoomLevel:    5,
	MissingProducts: []*Product{},
}

Himawari Full Disk Sector

View Source
var HimawariJapanSector = &Sector{
	ID:           "japan",
	FriendlyName: "Japan",
	Value:        "japan",
	CellSize:     750,
	MaxZoomLevel: 3,
	MissingProducts: []*Product{
		CIRAGeoColorProduct,
	},
}

Himawari Japan Sector

View Source
var HimawariMesoscale1Sector = &Sector{
	ID:           "ms1",
	FriendlyName: "Japan",
	Value:        "japan",
	CellSize:     750,
	MaxZoomLevel: 3,
	MissingProducts: []*Product{
		CIRAGeoColorProduct,
	},
}

Himawari Mesoscale 1 Sector

Satellites contains all of the available and included satellites.

View Source
var SplitWindowDifferenceProduct = &Product{
	ID:           "split-window-difference",
	FriendlyName: "Split Window Difference",
	Description:  "10.3 µm - 12.3 µm ",
	Value:        "split_window_difference_10_3-12_3",
	ZoomAdjust:   2,
}

Split Window Difference Product

Functions

func AnimateGIF added in v0.3.0

func AnimateGIF(images []image.Image, delay int, style LoopStyle) (*gif.GIF, error)

AnimateGIF animates the supplied images into a GIF image. This will convert RGB images to a 256-color palette due to the GIF color limit of 256. This will likely result in some down-sampling of your image colors.

func AvailableDates

func AvailableDates(satellite *Satellite, sector *Sector, product *Product) ([]int, error)

AvailableDates returns the list of dates that SLIDER has available data for as ints in the form of YYYYMMDD.

func CreateLoop

func CreateLoop(opts *LoopOptions) error

CreateLoop creates a new loop with the options specified in the provided LoopOptions.

func DownloadImage

func DownloadImage(request *ImageRequest) (image.Image, error)

DownloadImage downloads an individual image cell from SLIDER.

func LatestTimes

func LatestTimes(satellite *Satellite, sector *Sector, product *Product, count int) ([]int, error)

LatestTimes returns the list of timestamps that SLIDER has available data for as ints in the form of YYYYMMDDhhmmss.

func SaveGIF

func SaveGIF(output string, img *gif.GIF) (string, error)

SaveGIF encodes the GIF data into a .gif file. The .gif extension will be added automatically. If a file with the same name exists an incrementing number will be appended to the end of the file name.

func SelectTimestamps

func SelectTimestamps(times []int, opts *LoopOptions) ([]time.Time, error)

SelectTimestamps selects the desired timestamps from the list of int timestamps returned by SLIDER. Timestamps are returned in sorted chronological order.

Types

type ImageRequest

type ImageRequest struct {
	Date             string
	Satellite        string
	Sector           string
	Product          string
	ImageTimestamp   string
	ZoomLevel        int
	SectionXPosition int
	SectionYPosition int
}

ImageRequest contains the parameters required to request an individual image cell from SLIDER.

type LoopOptions

type LoopOptions struct {
	// Satellite is the satellite to request imagery from.
	Satellite *Satellite
	// Sector is the sector to request imagery for.
	Sector *Sector
	// Product is the product to request imagery for.
	Product *Product
	// LoopStyle is the animation style of the output animation.
	Loop LoopStyle
	// NumberOfImages is the number of frames in the output animation.
	NumberOfImages int
	// Speed is the interval between frames. A higher number increases the delay between frames.
	Speed int
	// ZoomLevel is the zoom level to request imagery for. Increasing ZoomLevel increases the output animation
	// resolution and therefore filesize.
	ZoomLevel int
	// TimeStep is the interval between image capture times in minutes.
	TimeStep int
	// BeginTime is the desired capture time of the first image in the loop.
	BeginTime time.Time
	// EndTime is the desired capture time of the last image in the loop.
	EndTime time.Time
	// OutputDirectory is the directory to save output animations in.
	OutputDirectory string
	// AllowStaleImages allows imagery that is over one year old to be included in animations. Disallowing this old
	// imagery by default helps to prevent old images from being accidentally included in loops.
	AllowStaleImages bool
	// contains filtered or unexported fields
}

LoopOptions are the config options used to create a new loop.

func LoopOptsFromURL added in v0.3.0

func LoopOptsFromURL(uri string) (*LoopOptions, error)

type LoopStyle

type LoopStyle int

LoopStyle is the animation direction of the images, for example forward or backward.

const (
	// ForwardLoop animates loops with images in chronological order.
	ForwardLoop LoopStyle = iota
	// ReverseLoop animates loops in reverse order from ForwardLoop
	ReverseLoop
	// RockLoop animates the loop forward first then in reverse. Note that using the RockLoop style will cause
	// animation file sizes to be nearly twice the size has a forward and reverse loops due there being twice the
	// number of frames.
	RockLoop
)

type Product

type Product struct {
	// ID is the shorthand string used on the command-line and in the config for this product
	ID string
	// FriendlyName is the friendly human-readable name for this product
	FriendlyName string
	// Description is a short description of the product details
	Description string
	// Value is the string sent to SLIDER for this product when requesting images
	Value string
	// ZoomAdjust is the number of zoom levels to remove from available zoom levels for this product.
	ZoomAdjust int
}

Product contains all of the information for a single product captured by a weather satellite.

type Satellite

type Satellite struct {
	// ID is the value sent in the request to SLIDER
	ID string
	// FriendlyName is the friendly human-readable name for this satellite
	FriendlyName string
	// Description is a short description of the satellite details
	Description string
	// Value is the string sent to SLIDER for this satellite when requesting images
	Value string
	// Sectors contains a list of available sectors for this Satellite keyed by ID.
	Sectors map[string]*Sector
	// Products contains a list of available products for this satellite keyed by ID.
	Products map[string]*Product
	// ZoomLevels is the list of available zoom levels or resolutions for this satellite
	ZoomLevels []*Zoom
}

Satellite contains all of the information for a single weather satellite and all of it's sectors and products.

func (*Satellite) ValidProduct added in v0.3.0

func (s *Satellite) ValidProduct(product *Product) bool

ValidProduct returns true if the provided product is available for this satellite.

func (*Satellite) ValidSector

func (s *Satellite) ValidSector(sector *Sector) bool

ValidSector returns true if the provided sector is available for this satellite.

func (*Satellite) ValidSectorProduct

func (s *Satellite) ValidSectorProduct(sector *Sector, product *Product) bool

ValidSectorProduct returns true if the provided sector and products are available for this satellite AND the product is not included in the sector's MissingProducts list. Generally this is the method that should be used to validate that sectors and products are available for the satellite.

type Sector

type Sector struct {
	// ID is the shorthand string used on the command-line and in the config
	ID string
	// FriendlyName is a longer string with a human-readable name for the sector
	FriendlyName string
	// Value is the string for this sector sent to SLIDER when requesting images
	Value string
	// CellSize is the size of each cell tile in pixels
	CellSize int
	// CropRatioX is the amount to crop the image on the X-axis from 0 to 1
	CropRatioX float32
	// CropRatioY is the amount to crop the image on the X-axis from 0 to 1
	CropRatioY float32
	// MaxZoomLevel is the max zoom level or resolution that this is available for this sector.
	MaxZoomLevel int
	// MissingProducts is a list of satellite products that are unavailable for this sector (typically due to the lack
	// of data availability).
	MissingProducts []*Product
}

Sector contains all of the information for a single sector captured by a weather satellite.

func (*Sector) ProductMissing added in v0.3.0

func (s *Sector) ProductMissing(product *Product) bool

ProductMissing returns true if the provided product is present in the MissingProducts list.

func (*Sector) XSize added in v0.3.0

func (s *Sector) XSize(zoom *Zoom) int

XSize is the number of pixels along the X-axis after the image is cropped

func (*Sector) YSize added in v0.3.0

func (s *Sector) YSize(zoom *Zoom) int

YSize is the number of pixels along the Y-axis after the image is cropped

type Zoom

type Zoom struct {
	Level int
	Scale string
}

Zoom contains information for a single zoom level or resolution.

func (*Zoom) NumCells added in v0.3.0

func (z *Zoom) NumCells() int

NumCells is the number of cells along each axis of the image. Cell X/Y axis origin (0,0) is the upper-left-hand corner of the image.

Jump to

Keyboard shortcuts

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