Script to extract object properties for location at time

Asked by Adam Tartanto

Does anyone have an example of a function which will return details of an object given the arguments 'location' and 'time'?

For example I would like to query the 'Az/Alt' for the moon as viewed from 40.7142° N, 74.0064° W, at '01:30:00 11/11/2020'

I am wanting to query a large set of locations and times, so need to automate the process.

I would also like to return other properties of objects - I have not been able to locate the syntax to retrieve object properties in the API docs. Maybe I'm missing something?

Any help much appreciated!

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Stellarium Edit question
Assignee:
No assignee Edit question
Solved by:
Khalid AlAjaji
Solved:
Last query:
Last reply:
Revision history for this message
Alexander Wolf (alexwolf) said :
#1

You must begin reading info about Stellarium's scripting engine from this start point for development version: http://www.stellarium.org/doc/head/scripting.html

If you need info about scripting engine for version 0.11.3 (as example), then you can use this address: http://www.stellarium.org/doc/0.11.3/scripting.html

For development version you need use that functions: core.setDate() [1], core.setObserverLocation() [2] and core.getObjectInfo() [3] . Also you need work with arrays and cycle "for" from ECMAScript.

[1] http://www.stellarium.org/doc/head/classStelMainScriptAPI.html#a8a059c2a5f9985d3da68b666ac2b40d9
[2] http://www.stellarium.org/doc/head/classStelMainScriptAPI.html#a3240f21e4fd2f444ddcfc282a333588a
[3] http://www.stellarium.org/doc/head/classStelMainScriptAPI.html#ad831d70086a1ad8f64d8377672fd143c

Revision history for this message
Best Khalid AlAjaji (kajaji) said :
#2

This is an example to retrieve moon info:

core.setObserverLocation( -74.00, 40.71, 0, 1, "MyLocation, MyCountry", "");
core.setDate("2020-11-11T04:30:00", "utc");
core.selectObjectByName("Moon", true);
core.wait(1);
LabelMgr.deleteAllLabels();
// get moon info
MoonData = core.getObjectInfo("Moon");
// extract Moon RA
MoonRA = MoonData["ra"];
// extract Moon altitude
MoonAlt = MoonData["altitude"];
// extract Moon visual magnitude
MoonVmag = MoonData["vmag"];
// parameters list
// altitude : apparent altitude angle in decimal degrees
// azimuth : apparent azimuth angle in decimal degrees
// altitude-geometric : geometric altitude angle in decimal degrees
// azimuth-geometric : geometric azimuth angle in decimal degrees
// ra : right ascension angle (current date frame) in decimal degrees
// dec : declenation angle in (current date frame) decimal degrees
// raJ2000 : right ascension angle (J2000 frame) in decimal degrees
// decJ2000 : declenation angle in (J2000 frame) decimal degrees
// glongJ2000 : galactic longitude (J2000 frame) in decimal degrees
// glatJ2000 : galactic latitude in (J2000 frame) decimal degrees
// vmag : visual magnitude
// vmage : visual magnitude (extincted)
// size : angular size in decimal degrees
// localized-name : localized name
core.wait(1);

label = LabelMgr.labelScreen("RA = " + MoonRA + ", Altitude = " + MoonAlt + ", Magnitude = " + MoonVmag, 20, 20, false, 30, "#aa0000");
LabelMgr.setLabelShow(label, true);
core.debug("RA = " + MoonRA + ", Altitude = " + MoonAlt + ", Magnitude = " + MoonVmag);

Revision history for this message
Adam Tartanto (adam-p-taranto) said :
#3

Thanks guys! Very helpful!

Revision history for this message
Adam Tartanto (adam-p-taranto) said :
#4

Thanks Khalid AlAjaji, that solved my question.

Revision history for this message
John (jonydeere) said :
#5

Khalid! Hi. Thanks for the example.

How can i make a script to:

1 - Set my position at 33º40'02'' S and 65º28'02'' W

Something Like this???? = core.setObserverLocation( -65.28,-33.40, 0, 1, "Villa Mercedes, San Luis", "Argentina");

What does it mean? ",0,1"

2 - Select two or more bodies (Like Jupiter and Uranus)
3 - And "draw" a circle with an "Angular Radius" of "xxºyy'zz'' with a color (like red)
and another circle with an "Angular Radius" of "xxºyy'zz'' with another color (like green)

in both selected bodies

This is the hardest part (I think)

What i realy whant to do is:

- Know when (exactly: Day, Hour, Minute, Second) other bodies of the solar system (Planet, moon, sun, etc) reach that angular distance or angular radius, from the body that i select.

Example:

- Select: Uranus and Jupiter
- The script draw the circles after asking me the angular radius.
- Then, as you progress in time, with the forward button, show the bodies of the solar system reaching exactly that angular radius.

The circles are just for visual information, no other.

It's for the studies of birds migration.