dankelley / ephemeris

query a server for epheremis data
https://dankelley.github.io/ephemeris/index.html
0 stars 0 forks source link

should read the header of the query result #2

Closed dankelley closed 3 years ago

dankelley commented 3 years ago

I'll do this when I get a few minutes to fiddle. There are two motivations:

  1. If I had done it from the get-go, I would not have wasted time trying to figure out why the sun angles were wrong in Issue #1, which turned out to be a result of my query was giving the Mercury angles.

  2. We could get non-failure for queries that deliver different columnar structures. (At the moment, I am specify column names, and they are wrong for some queries.)

dankelley commented 3 years ago

I've coded a start for this, so now we get, for example. Note that I am not actually using the inferred column names to name columns in the object, because users find it tricky to enter such names.

Since the information is valuable, though, I think I may make the default debug argument be TRUE. I'll think about this, and about how to reframe those column names more simply (right now, simply removing the trailing unit seem sensible).

E <- ephemeris::ephemeris(debug=TRUE)
#> https://ssp.imcce.fr/webservices/miriade/api/ephemcc.php?-name=p:Sun&-type=&-ep="2020-12-28&nbsp;12h"&-long=0&-lat=0&-nbd=5&-step=1d&-tscale=UTC&-observer=@500&-theory=INPOP&-teph=1&-tcoor=1&-rplane=1&-oscelem=astorb&-mime=text/csv&-from=R/ephemeris 
#> Object: Sun
#> QueryNames: "Date UTC", "RA (h)", "DEC (deg)", "Dobs (au)", "VMag (mag)", "dRAcosDEC (arcsec/min)", "dDEC (arcsec/min)", "RV (km/s)"

Created on 2020-12-28 by the reprex package (v0.3.0)

dankelley commented 3 years ago

I've done this in commit cc0d5c1152581ef31d77f0c8afd07397a7b47df0, as demonstrated below.

library(ephemeris)
ephemeris()
#>                      Date              RA            DEC      Dobs   VMag
#> 1 2020-12-28T00:00:00.000 +18 27 58.42274 -23 16 51.2515 0.9833559 -26.78
#> 2 2020-12-29T00:00:00.000 +18 32 24.17368 -23 13 39.5471 0.9833236 -26.78
#> 3 2020-12-30T00:00:00.000 +18 36 49.70775 -23 09 59.9399 0.9832976 -26.78
#> 4 2020-12-31T00:00:00.000 +18 41 14.99638 -23 05 52.5390 0.9832780 -26.78
#> 5 2021-01-01T00:00:00.000 +18 45 40.01175 -23 01 17.4661 0.9832648 -26.78
#>   dRAcosDEC   dDEC       RV    RAdec    DECdec       time
#> 1     2.544 0.1234 -0.06146 18.46623 -23.28090 2020-12-28
#> 2     2.543 0.1428 -0.05055 18.54005 -23.22765 2020-12-29
#> 3     2.542 0.1622 -0.03947 18.61381 -23.16665 2020-12-30
#> 4     2.541 0.1814 -0.02833 18.68750 -23.09793 2020-12-31
#> 5     2.539 0.2006 -0.01721 18.76111 -23.02152 2021-01-01
ephemeris(debug=TRUE)
#> https://ssp.imcce.fr/webservices/miriade/api/ephemcc.php?-name=p:Sun&-type=&-ep="2020-12-28&nbsp;12h"&-long=0&-lat=0&-nbd=5&-step=1d&-tscale=UTC&-observer=@500&-theory=INPOP&-teph=1&-tcoor=1&-rplane=1&-oscelem=astorb&-mime=text/csv&-from=R/ephemeris 
#> headerEnd:  3 
#> Object: Sun
#> QueryNames: "Date UTC", "RA (h)", "DEC (deg)", "Dobs (au)", "VMag (mag)", "dRAcosDEC (arcsec/min)", "dDEC (arcsec/min)", "RV (km/s)"
#> col.names: "Date", "RA", "DEC", "Dobs", "VMag", "dRAcosDEC", "dDEC", "RV"
#>                      Date              RA            DEC      Dobs   VMag
#> 1 2020-12-28T00:00:00.000 +18 27 58.42274 -23 16 51.2515 0.9833559 -26.78
#> 2 2020-12-29T00:00:00.000 +18 32 24.17368 -23 13 39.5471 0.9833236 -26.78
#> 3 2020-12-30T00:00:00.000 +18 36 49.70775 -23 09 59.9399 0.9832976 -26.78
#> 4 2020-12-31T00:00:00.000 +18 41 14.99638 -23 05 52.5390 0.9832780 -26.78
#> 5 2021-01-01T00:00:00.000 +18 45 40.01175 -23 01 17.4661 0.9832648 -26.78
#>   dRAcosDEC   dDEC       RV    RAdec    DECdec       time
#> 1     2.544 0.1234 -0.06146 18.46623 -23.28090 2020-12-28
#> 2     2.543 0.1428 -0.05055 18.54005 -23.22765 2020-12-29
#> 3     2.542 0.1622 -0.03947 18.61381 -23.16665 2020-12-30
#> 4     2.541 0.1814 -0.02833 18.68750 -23.09793 2020-12-31
#> 5     2.539 0.2006 -0.01721 18.76111 -23.02152 2021-01-01

Created on 2020-12-28 by the reprex package (v0.3.0)