WDS desde MySQL

Avatar de Usuario
acafar
Moderador
Moderador
Mensajes: 3715
Registrado: 13 Sep 2005, 23:00
Ubicación: OJ287

WDS desde MySQL

Mensaje sin leerpor acafar » 23 Sep 2012, 01:39

Hola,

Ya sabemos que para consultar el Washington Double Star Catalog basta con ir a la página http://ad.usno.navy.mil/wds/

Sin embargo a veces es conveniente tener el catálogo en un formato más manejable. Nuestro compañero Nachote nos ofrece con este fin el catálogo en formato Excel:
http://www.asociacionhubble.org/portal/ ... sexcel.zip

este formato es estupendo para filtrar dobles por condiciones, ordenar, buscar, etc. Sin embargo puede que alguno quiera cacharrear aún más con el catálogo y conozca el lenguaje de bases de datos relacionales SQL. Con este fin voy a poner por aquí los pasos para obtener el catálogo dentro del entorno MySQL:

1) Bajarse el catálogo en formato texto, disponible en: http://ad.usno.navy.mil/wds/Webtextfile ... b_summ.txt. Digamos que grabamos el fichero en nuestro ordenador con nombre "wds.txt".

2) Dentro de MySQL creamos la tabla que contendrá el WDS:

Código: Seleccionar todo

create table wds ( coord2000 char(10), discoverer_number char(7), components char(5), date_first decimal(4), date_last decimal(4), number_obs decimal(4), pa_first decimal(3), pa_last decimal(3), sep_first decimal(4,1), sep_last decimal(4,1), mag_first decimal(4,2), mag_second decimal(4,2), spectral char(9), pm_first_ra decimal(3), pm_first_dec decimal(3), pm_second_ra decimal(3), pm_second_dec decimal(3), durch char(8), notes char(4), coord_2000_arcsecond char(18) );
los atributos siguen la descripción del catálogo disponible en: http://ad.usno.navy.mil/wds/Webtextfile ... format.txt. No he creado claves porque temo que se pierdan datos.

3) finalmente importar el fichero de texto sobre la tabla. Yo he utilizado la siguiente instrucción desde MySQL:

Código: Seleccionar todo

LOAD DATA LOCAL INFILE 'wds.txt' INTO TABLE wds (@var1) SET coord2000 =substr(@var1,1,10), discoverer_number =substr(@var1,11,7), components =substr(@var1,18,5), date_first =substr(@var1,24,4), date_last =substr(@var1,29,4), number_obs =substr(@var1,34,4), pa_first =substr(@var1, 39,3), pa_last =substr(@var1, 43,3), sep_first =substr(@var1, 47,5), sep_last =substr(@var1, 53,5), mag_first =substr(@var1, 59,5), mag_second =substr(@var1, 65,5), spectral = substr(@var1, 71,9), pm_first_ra = substr(@var1, 81,4), pm_first_dec = substr(@var1, 85,4), pm_second_ra = substr(@var1, 90,4), pm_second_dec = substr(@var1, 94,4), durch = substr(@var1, 99,8), notes = substr(@var1, 108,4), coord_2000_arcsecond= substr(@var1, 113,18);
Ahora ya se puede consultar el catálogo con SQL. Por ejemplo, para obtener un listado de dobles STF con separación entre 10 y 20 segundos y magnitud 7 o más brillantes:

Código: Seleccionar todo

select coord_2000_arcsecond coord, discoverer_number id, pa_last 'ángulo', sep_last 'sep.', mag_first 'mag. A' , mag_second 'mag. B' from wds where substr(discoverer_number,1,3)='STF' and sep_last >=10 and sep_last<=20 and mag_first<=7 and mag_second<=7;
y obtenemos:

Código: Seleccionar todo

+--------------------+---------+---------+------+--------+--------+ | coord | id | ángulo | sep. | mag. A | mag. B | +--------------------+---------+---------+------+--------+--------+ | 021052.83+390222.4 | STF 222 | 36 | 16.6 | 6.05 | 6.71 | | 030052.18+522106.5 | STF 331 | 85 | 11.9 | 5.21 | 6.17 | | 033120.76+273418.5 | STF 401 | 270 | 11.4 | 6.58 | 6.93 | | 040751.38+621948.4 | STF 485 | 305 | 17.9 | 6.91 | 6.94 | | 043201.84+535439.0 | STF 550 | 308 | 10.3 | 5.78 | 6.82 | | 053515.82-052314.3 | STF 748 | 132 | 12.9 | 6.55 | 5.06 | | 053516.46-052323.1 | STF 748 | 62 | 13.2 | 5.06 | 6.38 | | 053525.98-055435.6 | STF 752 | 138 | 10.8 | 2.90 | 7.00 | | 053844.77-023600.2 | STF 762 | 84 | 12.8 | 3.76 | 6.56 | | 062346.10+043534.2 | STF 900 | 31 | 12.3 | 4.42 | 6.64 | | 072252.06+551653.3 | STF1062 | 316 | 14.7 | 5.76 | 6.71 | | 074529.14-144125.7 | STF1138 | 340 | 16.7 | 6.00 | 6.73 | | 121809.57-035655.6 | STF1627 | 195 | 20.0 | 6.55 | 6.90 | | 125601.67+381906.2 | STF1692 | 229 | 19.1 | 2.85 | 5.52 | | 132355.42+545531.5 | STF1744 | 152 | 14.7 | 2.23 | 3.88 | | 141329.00+514723.8 | STF1821 | 236 | 13.6 | 4.53 | 6.62 | | 153840.08-084729.4 | STF1962 | 189 | 11.7 | 6.44 | 6.49 | | 180009.07+800013.7 | STF2308 | 231 | 18.7 | 5.70 | 6.00 | | 180749.56+260604.4 | STF2280 | 183 | 14.2 | 5.81 | 5.84 | | 204639.50+160727.4 | STF2727 | 280 | 12.1 | 4.36 | 5.03 | | 215201.02+554748.3 | STF2840 | 196 | 18.1 | 5.64 | 6.42 | | 231906.51-132730.4 | STF2998 | 352 | 12.3 | 5.27 | 6.97 | +--------------------+---------+---------+------+--------+--------+
Saludos,

rafa

MigL
Mensajes: 1342
Registrado: 12 Abr 2006, 23:00
Ubicación: Valladolid [pasito a pasito]
Contactar:

Re: WDS desde MySQL

Mensaje sin leerpor MigL » 28 Sep 2012, 21:32

Muy buen aporte, Rafa.

Gracias por compartirlo :thumbup:
73s. Miguel L.
Rfr 90mm/900mm + 3-6mm AFoV 50º + 7mm AFoV 70º + 9mm AFoV 32º + 10mm AFoV 45º + 16mm AFoV 45º + 8-24mm AFoV 42-70º
http://bit.ly/VLLforecast-png >>> forecast.png
CL

pleiva
Mensajes: 429
Registrado: 18 Abr 2006, 23:00
Ubicación: Campofrío - Huelva

Re: WDS desde MySQL

Mensaje sin leerpor pleiva » 02 Oct 2012, 20:33

Genial Rafa :hello1:
TMB 130/1200 APO f/9,25 sobre EQ6-PRO

Volver a “Estrellas dobles”