Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: locating ultima thule

by atcroft (Abbot)
on Jan 04, 2019 at 07:10 UTC ( #1228007=note: print w/replies, xml ) Need Help??


in reply to locating ultima thule

I saw this post earlier, and my first thought was that the code posted here was not really that applicable to the issue at hand (it was, after all, scraping a Fourmilab page for a table that does not contain the object you seek, but only the "major" solar system objects, which, unless it is staying close to one of those objects, did not seem that applicable).

I installed several Astro::* modules, thinking one could pull the orbital elements from a source (such as the Wikipedia article on (486958) 2014 MU69 ("1110113Y", "Ultima Thule") to compute the position. While trying to get that to work, I ran across a reference in Astro::Coords::Elements to two sites to obtain orbital elements, http://cfa-www.harvard.edu/iau/Ephemerides/ (although that one no longer allows directory listing, and links you to https://minorplanetcenter.net/iau/mpc.html) and http://ssd.jpl.nasa.gov. When I looked at the latter, I found they provide a web interface (HORIZONS) to look up ephemerides (including the RA and DECL for a location for a particular time) for the object. Not necessarily doing-it-yourself, but sometimes an easier path can be a better one (for certain values of "easier" and "better").

Hope that helps.

Replies are listed 'Best First'.
Re^2: locating ultima thule
by Aldebaran (Deacon) on Jan 05, 2019 at 06:32 UTC
    it was, after all, scraping a Fourmilab page for a table that does not contain the object you seek, but only the "major" solar system objects, which, unless it is staying close to one of those objects, did not seem that applicable

    This is true indeed, and thanks for your comments. I looked at the module you posted and the long and short of it is I don't know how to track a single object in space, even possessing the physical values necessary. Nor did I find a perl way to tap into the services at the national jet lab. The ephemeris is the one way I know how to sort out the solar system. It's why I find this so extraordinary. How often do the Gods throw a Pluto Party, have all the titans show up, and leave only us behind to snap the pictures?

    Ultima Thule is essentially invisible from where we are. Its great fortune was being able to occult a star, allowing for predictions of its morphology, which I think is taken to mean composition and shape in this context. These were verified with the fly-by.

    I've marked where I think Ultima Thule is, but I can't get the page to load now, scratching my head as to why:

    a is /home/bob/2.scripts/pages/2.pp/template_stuff/aimages/a.png b is a.png a is /home/bob/2.scripts/pages/2.pp/template_stuff/aimages/b.png b is b.png Path::Tiny paths require defined, positive-length parts at template_st +uff/html7.pm line 126. $

    I've marked line 126 and don't see how the above could offend:

    sub put_page { use 5.011; use utils1; use Net::SFTP::Foreign; use Encode; use open OUT => ':encoding(UTF-8)', ':std'; use Data::Dumper; my ( $sftp, $rvars ) = (@_); my %vars = %$rvars; #load html file to server my $server_dir = $vars{"server_dir"}; say "server dir is $server_dir"; my $return1 = createDir( $server_dir, $sftp ); say "return1 is $return1"; $sftp->setcwd("/$server_dir") or warn "setcwd1 failed $!\n"; $sftp->put( $vars{html_file} ) or die "html put failed $!\n"; #load css file to server $sftp->setcwd("/css") or warn "setcwd2 failed $@\n"; my $path3 = path( $vars{css_path}, $vars{"css_file"} ); say "path3 is $path3"; my $remote_css = $vars{"css_file"}; $sftp->put( "$path3", $remote_css ) or warn "css put failed $@\n"; # upload images my $image_dir = $vars{"image_dir"}; say "image dir is $image_dir"; my $return2 = createDir( $image_dir, $sftp ); say "return2 is $return2"; $sftp->setcwd("/$image_dir") or warn "setcwd2 failed $!\n"; my $return3 = createDir( $vars{remote_dir}, $sftp ); say "return3 is $return3"; $sftp->setcwd( $vars{remote_dir} ) or warn "setcwd3 failed $!\n"; print $sftp->cwd(), "\n"; print Dumper $rvars; my $ref_content = $vars{refc}; my @AoA = @$ref_content; for my $i ( 0 .. $#AoA ) { my $a = path( $vars{to_images}, $AoA[$i][0] ); say "a is $a"; my $b = $a->basename; #line 126 say "b is $b"; $sftp->put( $a, $b ) or warn "AoA put failed $@\n"; } undef $sftp; return }

    Fishing for tips,

      Path::Tiny paths require defined, positive-length parts

      AFAICT that means that one of the paths involved in the operation was either undef or had zero length. It'd be best if you dump the elements of the paths involved, in this case I guess that'd be $vars{to_images} and $AoA[$i][0], and if you're unsure as to what's causing the problem, show the output here.

        show the output here

        I did figure out what is going wrong, but I don't know how to fix it. Let me start by showing the tail end of the page creation process, where this thing is going off the rails:

        first value is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages Use of uninitialized value in concatenation (.) or string at template_ +stuff/html7.pm line 127, <STDIN> line 2. array part is undefined!...initializing: a is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages/quux b is quux AoA put failed first value is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages Use of uninitialized value in concatenation (.) or string at template_ +stuff/html7.pm line 127, <STDIN> line 2. array part is undefined!...initializing: a is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages/quux b is quux AoA put failed return is 3.cw15.html $

        The offenders are create_page and put_page, who until recently, were part of main. Relegating them to be subroutines was great for legibility in main, but I seem to have developed issues. First of all, even though it tells me it fails every time, it gets a page on the net. The resulting page is weirdly-populated. ugly page

        My main data struture is a hash that I pass into all my subroutines:

        my $rvars = shift; my %vars = %$rvars;

        But then I want to create something with persistence, like:

        $vars{refc} = get_content($rvars); $rvars = \%vars; ## will same trick work?

        and then

        print "Put file to server(y/n)?: "; my $prompt2 = <STDIN>; chomp $prompt2; if ( $prompt2 eq ( "y" | "Y" ) ) { put_page( $sftp, $rvars ); }

        $ref_content's value is NULL, so this is not an effective pass.

        my $ref_content = $vars{refc}; my @AoA = @$ref_content; say "content----------"; print Dumper $ref_content; for my $i ( 0 .. $#AoA ) { say "first value is $vars{to_images} "; say "array part is $AoA[$i][0]"; if (!defined $AoA[$i][0]) { say "undefined!...initializing:"; $AoA[$i][0] = 'quux'; } my $a = path( $vars{to_images}, $AoA[$i][0] ); say "a is $a"; my $b = $a->basename; say "b is $b"; $sftp->put( $a, $b ) or warn "AoA put failed $@\n"; }

        It didn't always used to be this broken, so I'm happy to entertain suggestions....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1228007]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2020-09-22 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (129 votes). Check out past polls.

    Notices?