Hi! I want to visualize the moon path of each day and month and study about it. Is there any grasshopper plugin for me to study about it? I found the Nightingale plugin. But I don’t know how to start. I’m sorry, I’m super new to the grasshopper.
Search the forum before starting a thread.
Hello
to start Nightingale you must download it on Food4Rhino, or via package manager. Then install it.
Try components … read the help …
And if it doesn’t work, you could use some code to generate position in the sky
This doesn’t seem to complex to port in Grasshopper
What term should they have searched for?
Really? Combinations of “moon earth orbit”, among other words.
Add the word “grasshopper” if using Google.
I have been looking for the same thing only nightingale out there but doesn’t work for me on rhino 7 or 6 the only component that loads is the construct sky component. The orbit gh script only shows the moon orbit and not it’s position in the sky relative to the location. I would also be interested
if you find out anything about this
Getting the moon’s position (azimuth and altitude?) relative to any location (latitude / longitude?) and any date/time is quite complex, akin to navigation at sea but reversed. There are many sources online: Moon Phases Visualized – Moon Location
Or on your phone:
Why in Grasshopper?
P.S. Sky Map on an Android phone is amazing but makes me wonder if it works without cell service? Which leads to the question “What about REST APIs for moon data?”, and sure enough, it exists:
https://docs.astropy.org/en/stable/api/astropy.coordinates.get_moon.html
Seems possible that a GH app could make REST calls to these services for the hard work, leaving GH to handle the “presentation layer” in the form of a geometric model of some kind?
Hi Joseph,
using your link about moon phase, and the link about C# I implemented it.
Using a date and a location on earth in Longitude and Latitude it could place the sun and the moon relative to the XY plane. Y is North, X is East.
By default it show the moon phase if you use the Top view. It seems to work. It just doesn’t use earth to make eclipse on the moon.
17th of March
25th of March
2nd of April
moon planets relative positions LEGACY.gh (40.7 KB)
WOW I’m impressed. Can’t wait to try it but wifi is down here, might tether my phone to see this. Cool!
When seeing the script you will not be so impressed, it is far simplier than most of your forum definition.
The tool on github was simple to put in Grasshopper (I just changes some deg2rad
and rad2deg) and it outputs azimuth and elevation of moon, sun and planets relative to a position so it was easy to use with grasshopper polar coordinates.
Then some orient in order to have moon and sun as if we were looking at the moon.
It allows to show no too badly eclipse. Scales and perspective are not good as I use top view, so I sheet a bit but it is possible to see the sun approaching.
I didn’t look in the detail but as in France there is 1 to 2 hour between UTC it could lead to the different hour for the maximum eclipse
Hi @Childe_Erick
I’m calculating my own calendar based on the moon, since I’m sailing in the tidal North Sea. Here the “day” is defined by the tides and currents of the moon. Therefore I call my calendar Moonday and the months start at new moon and looks like this
The black curve is the moon path (from right to left) and you can see that it is not exactly on the ecliptic (path of the sun). Also there are all other planets (not labelled in this picture) which are useful for astronavigation.
I’m not sure what you mean by “moon path of each day”? If have something like the analemma of the sun in mind then you can do this for the moon as well but you’ll have to correct the time frame, because a moon-day (from transit to transit) is slightly longer than a sun-day.
If you really want to study all that then I’d suggest an astronomical library like for example Pyephem which you can directly use with Rhino V8 and Python 3.
Jess
Au contraire, mon frère, I don’t understand all of it yet but am extremely impressed. In particular, the difference between ‘Relative’ and ‘Top’? I can see the difference but don’t understand it yet.
Apparently there are no REST calls in this code? Everything is in the C# code? Wow.
I immediately found myself wanting to change the date/time selector - so I did. This is crude but makes it easy to calculate the second date for the date range. Keeping it short (7 to 30 days) makes it easier to see the effect of moving the ‘Interpolation’ slider (blue group).
Would also be nice to set lat / lon by selecting a nearby city, but these are trivial things.
Well done
Looks very useful!
https://rhodesmill.org/pyephem/
https://rhodesmill.org/pyephem/quick.html#stars-and-cities
Not in Package Manager though, can you describe the installation process?
If you want to see a location on earth without plugin you can use this script.
earth texture no plugin.gh (14.6 KB)
Image of earth from
I had it installed with: pip install ephem
but this may also work in the _ScriptEditor:
# r: ephem
import ephem
Took me awhile to figure this out… but I got it. Was thinking of picking a city by name to get lat / lon.
Could probably hack your GH file (earth texture no plugin.gh) to pick a spot on this globe to get lat / lon but that might just be knobs for setting lat / lon directly. Yep. Cool though, thanks.
Your Material C# component generates this error in R7: (later, it went away?)
- Warning (CS0618): ‘Rhino.Render.RenderMaterial.CreateBasicMaterial(Rhino.DocObjects.Material)’ is obsolete: ‘Use CreateBasicMaterial(DocObjects.Material material, RhinoDoc doc) instead’ (line 81)
P.S. The error comes and goes when I close and reopen the file.
the current method needs 2 arguments replace line 81 with this.
var renderMaterial = Rhino.Render.RenderMaterial.CreateBasicMaterial(material, this.RhinoDocument);
Thanks. I almost had it from the error message hint but missed the this.RhinoDocument
syntax.
earth texture_2024Mar11a.gh (11.2 KB)
I found a source of lat/lon values for cities of the world here:
Their “Basic” data is free as a 4.6 MB .csv file with 44,691 cities that must be downloaded for this model.
One of the biggest obstacles for a “user-friendly” UI was the sheer size of the list. 240 countries makes a tediously long Value List and some of the lists of cities are bigger. 522 cities in California, for example. So I came up with a way to load pages into Value List components, which is still tedious but seems to work.
The left side of the canvas reads and “pre-processes” the .csv file using standard GH components:
The right side of the canvas uses Python to sort and filter lists. The UX action is in the blue group with pairs of Value List components, one to page through the list (yellow groups) and another to choose Country, “State” and City. The lat/lon of the selected city appears in the green group.
cities_2024Mar13d.gh (37.2 KB)
PageVL.py (320 Bytes)
I tried to consolidate each purple group on the right into a single cluster, then a pair of clusters and finally as is with the PVL (Populate Value List) bits separate because they wouldn’t work inside of clusters.
Most of this would not be needed if long Value Lists responded to pg up and pg dn keys, but it’s all a bit too much for practical use in GH code anyway. Still, if only…
there also is a list of more than 100 cities in Pyephem: pyephem/ephem/cities.py at master · brandon-rhodes/pyephem · GitHub
And if you want to know the location of a place out in the woods or at sea you can right click on google maps and copy the coordinates: