Documentation
¶
Overview ¶
Package celestialdata finds and fetches the files astronomy archives hold for a patch of sky. Each archive has its own adapter package. The adapter knows how its archive is laid out and what it holds near a position.
This package holds the parts the adapters share. Fetch brings a product home.
Index ¶
- Constants
- func EndsIn(suffix string) func(link string) bool
- func Fetch(get web.Web, product *Product, into string) (string, error)
- func Refuse(format string, args ...any) error
- func Refused() error
- func Span(value, pixel, step, length float64) (centre, half float64)
- type Adapter
- func (adapter *Adapter) Fail(format string, args ...any) error
- func (adapter *Adapter) Files(folder string, keep func(link string) bool, id, about string) ([]*Product, error)
- func (adapter *Adapter) Footprint() *Patch
- func (adapter *Adapter) Links(folder string) ([]string, error)
- func (adapter *Adapter) Name() string
- func (adapter *Adapter) Product(id, file, url string, size int64, about string) (*Product, error)
- func (adapter *Adapter) Reaches(near *Near) bool
- func (adapter *Adapter) Refuse(format string, args ...any) error
- func (adapter *Adapter) Web() web.Web
- func (adapter *Adapter) Wrap(err error) error
- type Archive
- type ByName
- type File
- type Fixed
- type Frame
- type Galactic
- type Measured
- type Near
- type Patch
- type Position
- type Product
Constants ¶
const Unsized = 0
Unsized is a product's size when the archive does not say it ahead. It's defined: NewProduct takes none as not known.
Variables ¶
This section is empty.
Functions ¶
func EndsIn ¶
EndsIn keeps the links that end in a suffix, as a file's type: EndsIn ".fits" for Files keeps a folder's FITS files.
func Fetch ¶
Fetch brings a product's file into the folder into and returns its path. It makes the folder when it is missing.
It never replaces a file. It refuses when a file is already there under the name. It refuses a .part already there too, since that may be another fetch's.
The bytes go to a .part file of its own first. That file takes the name only once its length is what the server and the product said. For a gzip file the stream must also read to its end. Its own .part is removed when anything fails.
func Refuse ¶
Refuse is a refusal that says why, as fmt.Errorf writes it. It wraps Refused, so the adapters' refusals are found as this package's are.
func Refused ¶
func Refused() error
Refused is wrapped by each of the refusals here. NewProduct and Fetch refuse a name that is not one plain file name. Fetch refuses when a file or a .part is already there under the name.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the base every archive's adapter is built on: its name, as the command line takes it, the web it asks through, and, for a survey of one part of the sky, its footprint. An adapter holds one, so its products, refusals and errors carry its name without its typing it.
func Named ¶
Named is an adapter by a name with no web of its own, for one that asks through a host it is given or asks nothing. It refuses a name that is not one word.
func NewAdapter ¶
NewAdapter is an adapter by a name, asking through get. It refuses a name that is not one word and a missing web.
func NewField ¶
NewField is an adapter by a name, asking through get, for a survey that covers one part of the sky, patch. A circle that does not reach it is asked nothing. It refuses what NewAdapter does, and a missing patch.
func (*Adapter) Fail ¶
Fail is an error that begins with the adapter's name and says what went wrong, as fmt.Errorf writes it, %w and all.
func (*Adapter) Files ¶
func (adapter *Adapter) Files(folder string, keep func(link string) bool, id, about string) ([]*Product, error)
Files is the files a folder's page lists that keep holds, each as a product of one id and one about. A link that is not one plain file name leads out of the folder; it is not the folder's, and is passed over.
func (*Adapter) Footprint ¶
Footprint is the part of the sky a field covers, or nil for an adapter that is not a field.
func (*Adapter) Links ¶
Links is the links on a folder's page, in the order written, their entities read; an error begins with the adapter's name.
func (*Adapter) Product ¶
Product is one file the archive holds, with the adapter's name for the archive and a few words on what it is, none when about is empty.
id is the archive's own name for what the file belongs to; file is its name, one plain file name; url is where it is kept; size is its length in bytes, Unsized when the archive does not say.
It refuses an empty address, a name that is not one plain file name, and a size below none.
func (*Adapter) Reaches ¶
Reaches is whether a circle reaches a field's footprint. An adapter that is not a field reaches every circle.
func (*Adapter) Refuse ¶
Refuse is a refusal that begins with the adapter's name and says why, as fmt.Errorf writes it. It wraps Refused, as Refuse does.
type Archive ¶
type Archive interface {
// Name is the adapter's name as the command line takes it: one word.
Name() string
// Find is what the archive holds near a position.
Find(near *Near) ([]*Product, error)
}
Archive is one archive's adapter.
type ByName ¶
ByName is an archive that is asked only when it is named, never with every archive. Fixed is one.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is one file a fixed archive holds, described ahead. NewFile makes one; NewFixed makes it a product.
type Fixed ¶
type Fixed struct {
// contains filtered or unexported fields
}
Fixed is an archive whose files are known ahead, wherever on the sky or the earth they are asked for: a whole-earth image, a library, a map. It is asked only by name, never with every archive, since what it holds does not depend on the circle.
func NewFixed ¶
NewFixed is an archive by a name whose files are described ahead. Each is made a product as Adapter.Product makes one, so an adapter has no refusal of its own to handle. It refuses a name that is not one word, no files, and a file Product refuses.
func (*Fixed) ByNameOnly ¶
ByNameOnly says the archive is asked only when it is named.
type Galactic ¶
type Galactic struct {
// contains filtered or unexported fields
}
Galactic is a place on the sky in galactic longitude and latitude, in degrees.
type Measured ¶
type Measured struct {
// contains filtered or unexported fields
}
Measured is a numbers file an adapter keeps beside its code, read. Its numbers are read from the archive's own files, such as the header cards that say where an image lies.
func NewMeasured ¶
NewMeasured reads a numbers file's bytes. When the file will not read, why is kept and each Get gives it.
func (*Measured) Circle ¶
Circle is the circle three of the numbers name. They are a right ascension, a declination and a radius in degrees. Numbers that are missing are an error. So is a circle that is not one.
func (*Measured) Footprint ¶
Footprint is the patch an image covers in a frame. It is read from the image's header cards. They are kept as numbers named for the image and the card, such as palpha-naxis1.
The first axis is longitude and the second latitude. In ICRS a step along the first axis is a step on the sky. So the reach in right ascension is wider by one over the cosine of the declination.
type Near ¶
type Near struct {
// contains filtered or unexported fields
}
Near is a circle on the sky: a centre and a radius in degrees.
func NewNear ¶
NewNear is the circle of a radius round a centre. It refuses a missing centre, and a radius that is not a size a circle on the sky can have.
func (Near) Reaches ¶
Reaches is whether some of the circle may fall in the patch. It errs only by saying yes.
Each degree of longitude is shorter by the cosine of the latitude. So the circle's reach in longitude is taken where the circle comes nearest a pole. Circles round a pole reach every longitude.
type Patch ¶
type Patch struct {
// contains filtered or unexported fields
}
Patch is a box of sky in a frame. It has a centre and how far it reaches either side of it along each axis. The reach is in that frame's degrees.
func NewPatch ¶
NewPatch is the box round a centre in a frame. It refuses a frame it does not know, a centre off the sky and a reach that is below nothing or not a number.
func (*Patch) Moved ¶
Moved is the same box centred on another longitude, its reach in longitude grown by more. Surveys whose tiles are all one size give each tile's box from one tile's this way.
More below nothing grows it by nothing. Longitudes that are not a number leave a box only circles round a pole reach, as they reach every longitude.
type Position ¶
type Position struct {
// contains filtered or unexported fields
}
Position is a place on the sky, in ICRS degrees.
func NewPosition ¶
NewPosition is the place at a right ascension and declination. It refuses numbers that are not on the sky.
type Product ¶
type Product struct {
// contains filtered or unexported fields
}
Product is one file an archive holds.
func Found ¶
Found is a find of one product, or of none and why. It takes what an adapter's Product gives. So an adapter that names one file hands a refusal on with no branch of its own.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bluemarble fetches NASA's Blue Marble Next Generation, the whole earth's land and sea in true colour, a composite of a month of MODIS images, laid on a plain grid of longitude and latitude.
|
Package bluemarble fetches NASA's Blue Marble Next Generation, the whole earth's land and sea in true colour, a composite of a month of MODIS images, laid on a plain grid of longitude and latitude. |
|
Package cardiff finds the Hi-GAL PPMAP results kept at Cardiff.
|
Package cardiff finds the Hi-GAL PPMAP results kept at Cardiff. |
|
Package cds names cutouts from the hips2fits service at the Centre de Données astronomiques de Strasbourg.
|
Package cds names cutouts from the hips2fits service at the Centre de Données astronomiques de Strasbourg. |
|
Package chandra finds Chandra's primary data products near a place on the sky.
|
Package chandra finds Chandra's primary data products near a place on the sky. |
|
Package chroma finds the colourways in jane's chroma repository on GitHub: the .css files of its colourways/sources folder, on its main branch.
|
Package chroma finds the colourways in jane's chroma repository on GitHub: the .css files of its colourways/sources folder, on its main branch. |
|
cmd
|
|
|
celestial-data
command
Command celestial-data finds and fetches what astronomy archives hold near a place on the sky.
|
Command celestial-data finds and fetches what astronomy archives hold near a place on the sky. |
|
Package gaia is the adapter for ESA's Gaia archive: rows of Gaia DR3's gaia_source, as FITS, asked as a job of the archive's TAP service.
|
Package gaia is the adapter for ESA's Gaia archive: rows of Gaia DR3's gaia_source, as FITS, asked as a job of the archive's TAP service. |
|
internal
|
|
|
replay
Package replay answers an adapter's questions with what an archive really said.
|
Package replay answers an adapter's questions with what an archive really said. |
|
Package irsa finds what NASA's infrared archive at IPAC holds near a place on the sky.
|
Package irsa finds what NASA's infrared archive at IPAC holds near a place on the sky. |
|
Package mast finds the files of the HST/NICMOS Paschen-alpha survey of the Galactic Centre.
|
Package mast finds the files of the HST/NICMOS Paschen-alpha survey of the Galactic Centre. |
|
Package naturalearth fetches and reads Natural Earth's land: the outlines of the land at a scale of 1:50 million, as GeoJSON.
|
Package naturalearth fetches and reads Natural Earth's land: the outlines of the land at a scale of 1:50 million, as GeoJSON. |
|
Package nustar finds NuSTAR's cleaned event files near a place on the sky.
|
Package nustar finds NuSTAR's cleaned event files near a place on the sky. |
|
Package sarao finds the files of SARAO's MeerKAT mosaic of the Galactic Centre: its total intensity at 1.28 GHz, its spectral index and that index's error.
|
Package sarao finds the files of SARAO's MeerKAT mosaic of the Galactic Centre: its total intensity at 1.28 GHz, its spectral index and that index's error. |
|
Package skyview asks NASA's SkyView for whole-sky maps: any of its surveys resampled onto one image of the sky in galactic longitude and latitude, on a plain grid, as FITS.
|
Package skyview asks NASA's SkyView for whole-sky maps: any of its surveys resampled onto one image of the sky in galactic longitude and latitude, on a plain grid, as FITS. |
|
Package tap asks a Table Access Protocol service one question in ADQL and waits for the answer.
|
Package tap asks a Table Access Protocol service one question in ADQL and waits for the answer. |
|
Package usgs fetches and reads the USGS Spectral Library Version 7: the measured reflectance of minerals, soils, water, plants and made things, from the ultraviolet into the infrared.
|
Package usgs fetches and reads the USGS Spectral Library Version 7: the measured reflectance of minerals, soils, water, plants and made things, from the ultraviolet into the infrared. |
|
Package votable reads a VOTable.
|
Package votable reads a VOTable. |
|
Package web is the one way celestial-data reaches an archive: a GET, a HEAD and a POST.
|
Package web is the one way celestial-data reaches an archive: a GET, a HEAD and a POST. |