Astronomical calculations + FITS file I/O - coordinate transforms, photometry, cosmology, dust extinction, sidereal time
Installing and Loading
INSTALL astro FROM community;
LOAD astro;
Example
SELECT astro_angular_separation(10.68, 41.27, 83.82, -5.39) AS separation_deg;
About astro
The astro extension adds 62 functions (59 scalar + 3 FITS table functions) to DuckDB: coordinate transforms (equatorial / galactic frames, RA/Dec to XYZ), angular separation, photometry (magnitude/flux, distance modulus, absolute magnitude), CCM89 + O'Donnell 1994 dust extinction with UBVRIJHK bands, cosmological distances (luminosity, comoving), celestial body models (stars, brown dwarfs, planets, black holes, asteroids), Keplerian orbital mechanics, 3D octree spatial sectors, sidereal time / observation planning (GMST, LMST, hour angle, equatorial to horizontal alt/az conversion), and FITS file I/O (fits_hdus, fits_header, read_fits via cfitsio) for reading astronomical catalogs and images directly from SQL.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| astro_absolute_mag | scalar | NULL | NULL | |
| astro_altaz_from_radec | scalar | NULL | NULL | |
| astro_angular_separation | scalar | NULL | NULL | |
| astro_body_asteroid | scalar | NULL | NULL | |
| astro_body_black_hole | scalar | NULL | NULL | |
| astro_body_brown_dwarf | scalar | NULL | NULL | |
| astro_body_planet_gas_giant | scalar | NULL | NULL | |
| astro_body_planet_ice_giant | scalar | NULL | NULL | |
| astro_body_planet_rocky | scalar | NULL | NULL | |
| astro_body_star_main_sequence | scalar | NULL | NULL | |
| astro_body_star_neutron | scalar | NULL | NULL | |
| astro_body_star_white_dwarf | scalar | NULL | NULL | |
| astro_color_excess | scalar | NULL | NULL | |
| astro_comoving_distance | scalar | NULL | NULL | |
| astro_const_AU | scalar | NULL | NULL | |
| astro_const_G | scalar | NULL | NULL | |
| astro_const_L_sun | scalar | NULL | NULL | |
| astro_const_M_earth | scalar | NULL | NULL | |
| astro_const_M_sun | scalar | NULL | NULL | |
| astro_const_R_earth | scalar | NULL | NULL | |
| astro_const_R_sun | scalar | NULL | NULL | |
| astro_const_c | scalar | NULL | NULL | |
| astro_const_ly | scalar | NULL | NULL | |
| astro_const_pc | scalar | NULL | NULL | |
| astro_const_sigma_sb | scalar | NULL | NULL | |
| astro_distance_modulus | scalar | NULL | NULL | |
| astro_dyn_gravity_accel | scalar | NULL | NULL | |
| astro_extinction_alambda | scalar | NULL | NULL | |
| astro_extinction_av | scalar | NULL | NULL | |
| astro_extinction_band | scalar | NULL | NULL | |
| astro_flux_deredden | scalar | NULL | NULL | |
| astro_flux_to_mag | scalar | NULL | NULL | |
| astro_frame_transform_pos | scalar | NULL | NULL | |
| astro_frame_transform_vel | scalar | NULL | NULL | |
| astro_gmst | scalar | NULL | NULL | |
| astro_hour_angle | scalar | NULL | NULL | |
| astro_jd_from_timestamp | scalar | NULL | NULL | |
| astro_lmst | scalar | NULL | NULL | |
| astro_luminosity_distance | scalar | NULL | NULL | |
| astro_mag_deredden | scalar | NULL | NULL | |
| astro_mag_to_flux | scalar | NULL | NULL | |
| astro_orbit_make | scalar | NULL | NULL | |
| astro_orbit_mean_motion | scalar | NULL | NULL | |
| astro_orbit_period | scalar | NULL | NULL | |
| astro_orbit_position | scalar | NULL | NULL | |
| astro_orbit_velocity | scalar | NULL | NULL | |
| astro_radec_to_xyz | scalar | NULL | NULL | |
| astro_sector_bounds | scalar | NULL | NULL | |
| astro_sector_center | scalar | NULL | NULL | |
| astro_sector_id | scalar | NULL | NULL | |
| astro_sector_parent | scalar | NULL | NULL | |
| astro_unit_AU | scalar | NULL | NULL | |
| astro_unit_M_earth | scalar | NULL | NULL | |
| astro_unit_M_sun | scalar | NULL | NULL | |
| astro_unit_length_to_m | scalar | NULL | NULL | |
| astro_unit_ly | scalar | NULL | NULL | |
| astro_unit_mass_to_kg | scalar | NULL | NULL | |
| astro_unit_pc | scalar | NULL | NULL | |
| astro_unit_time_to_s | scalar | NULL | NULL | |
| fits_hdus | table | NULL | NULL | |
| fits_header | table | NULL | NULL | |
| read_fits | table | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.