Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Moon states - I'm stuck

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

mcrossley wrote:and do you take the phase at midnight - start of the day, or end of the day, or mid-day, or mid-evening when perhaps most people will see the Moon :shock:.
Yes, it's non obvious: I suspect we should start at the first moment we are prepared to declare a new moon, it's logical enough to presume to call that day one. Day two would follow after the completion of day one, or new moon plus the lunar day length for day one (it is lunar day length we need isn't it? not earth day length? <shrug>)

To make matters worse I just found the most wonderful set of icons for this, and there's 41 of the little devils in there, but that is going too far and I also don't see why 41 images work that much better than 30? So, nice as they are, perhaps we'd better let that set pass us by! :lol:
Cheers,
Ian
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

mcrossley wrote:I'm not convinced that a <#moonday> tag will solve every thing, because the length of a lunation varies by a day or two. Better to create a series of images at set illumination percentages, and use the existing percentage tag. Otherwise things get slightly more complex.
I'm wanting to make it possible to show those images at about the right time for now. Cumulus would, in making a web tag, dictate the pace at which it's progressing through the sequence. So then the images reflect the output from your station as best they can and that is what I am trying to do. At present, I can roughly guess/deduce which 8 images to use out of the bunch and in time (as I learn more about it) that choice can and will be better made. However, far better to have the greater number of images to work with if that is possible, and I accept it may not be possible.

Now as to what you suggested; that sounds like making it even more complex, but I'd be happy to have a stab at modelling and rendering a set for that. How many do you envisage needing to suit your proposition?

Bearing in mind if it's not an automatically generated webtag then I have to have some means of changing the required image, some sort of script, that will need access to some file or other on the web page, and then I would have to retrieve an extra file every so often, read its content and set an image accordingly.

At present I just have Cumulus processing and sending one extra text file as it does it's normal web run. Using web tags I can simply include any extra data I need like that. Doing it externally, the program doing it would need to chose it's moment to do it's stuff.

Oh, and then the reading software (pagescraper plugin in Samurize) would have to grab it without there being a file lock on it too! Now maybe it's that I'm a novice but that's starting to sound pretty blooming complex! Of course I could be dead wrong about that, but that is just how it strikes me right now.
Cheers,
Ian
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Moon states - I'm stuck

Post by beteljuice »

Code: Select all

<script  type="text/javascript">
pic_no = Math.floor(((parseInt(<#MoonPercent>) + 103) / 6.66) % 30 );
</script> 
Near enough :lol: (don't ask the beteljuice logic)
Returns 0 (Full Moon) => 29 (immediately before Full Moon) [15 = New Moon] or perhaps the other way around depending on Steves logic :lol:

Test:

Code: Select all

<script  type="text/javascript">
for(j= -100; j <= 100 ; j = j+2) {
  pic_no = Math.floor(((parseInt(j) + 103) / 6.66) % 30 ) 
  document.write(j + '% > ' + pic_no + '<br />');
}
</script>
Outputs:

-100% > 0
-98% > 0
-96% > 1
-94% > 1
-92% > 1
-90% > 1
-88% > 2
-86% > 2
-84% > 2
-82% > 3
-80% > 3
-78% > 3
-76% > 4
-74% > 4
-72% > 4
-70% > 4
-68% > 5
-66% > 5
-64% > 5
-62% > 6
-60% > 6
-58% > 6
-56% > 7
-54% > 7
-52% > 7
-50% > 7
-48% > 8
-46% > 8
-44% > 8
-42% > 9
-40% > 9
-38% > 9
-36% > 10
-34% > 10
-32% > 10
-30% > 10
-28% > 11
-26% > 11
-24% > 11
-22% > 12
-20% > 12
-18% > 12
-16% > 13
-14% > 13
-12% > 13
-10% > 13
-8% > 14
-6% > 14
-4% > 14
-2% > 15
0% > 15
2% > 15
4% > 16
6% > 16
8% > 16
10% > 16
12% > 17
14% > 17
16% > 17
18% > 18
20% > 18
22% > 18
24% > 19
26% > 19
28% > 19
30% > 19
32% > 20
34% > 20
36% > 20
38% > 21
40% > 21
42% > 21
44% > 22
46% > 22
48% > 22
50% > 22
52% > 23
54% > 23
56% > 23
58% > 24
60% > 24
62% > 24
64% > 25
66% > 25
68% > 25
70% > 25
72% > 26
74% > 26
76% > 26
78% > 27
80% > 27
82% > 27
84% > 28
86% > 28
88% > 28
90% > 28
92% > 29
94% > 29
96% > 29
98% > 0
100% > 0

Of course if you want a rough MoonDay number, just add 1 to the code output ;)
Image
......................Imagine, what you will KNOW tomorrow !
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

beteljuice wrote:

Code: Select all

<script  type="text/javascript">
pic_no = Math.floor(((parseInt(<#MoonPercent>) + 103) / 6.66) % 30 );
</script> 
Near enough :lol:
Oddly I got a lot of that "near enough" happen when I was playing too! :lol:
beteljuice wrote: (don't ask the beteljuice logic)
I see! :P
beteljuice wrote: Returns 0 (Full Moon) => 29 (immediately before Full Moon) [15 = New Moon] or perhaps the other way around depending on Steves logic :lol:
Glad I'm not the only one who had that thought cross their mind! :P
beteljuice wrote: Of course if you want a rough MoonDay number, just add 1 to the code output ;)

:clap: Scoundrel! :bash: I felt bad/gulilty/embarrassed when I had to stoop to doing that. :lol:

Thanks for that. Now I got to work out how to make that usable. Bear in mind I never used java or anything like it before, so I have no idea where to point it, or how to get the trigger pulled, but hey, I'm a graphics guy now, not a coder, so that's to be expected. 8-)

I know it's got to work on the output from Cumulus which would already reside on the web site. It's then got to insert the result either back into the file it found it in, or make a file of it's own, on the web site, either way it's got to be downloadable for the other tools I am using.

Then I got to find a way to grab that from the web site, and set up the right image. That last bit is fairly easy to sort out, but as for the rest of it I have no idea! Not even the most basic of concepts. :?
Cheers,
Ian
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Moon states - I'm stuck

Post by beteljuice »

I know it's got to work on the output from Cumulus which would already reside on the web site. It's then got to insert the result either back into the file it found it in, or make a file of it's own, on the web site, either way it's got to be downloadable for the other tools I am using.
This is not good !
I suspect the 'page scraper' would NOT see any image or text created by the JavaScript, and would only be able to see the js itself.

You need to 'scrape' the MoonDay number or image from one of the many sites that provide that sort of thing through a server-side script (eg. php). Some sites allow it, other frown upon scrapers.

If your server allows php, it would be better for you to get a freebie script that returns exactly what you want and scrape-your-own :lol:

It's been interesting though

BTW - Isn't a lunar month less than 30 days ...
... so all this code is ...... only any good for a 30 image selection :clap:
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Moon states - I'm stuck

Post by steve »

beteljuice wrote:You need to 'scrape' the MoonDay number or image from one of the many sites that provide that sort of thing
I did wonder why this wasn't the solution in the first place. It seemed rather perverse to me to be getting Cumulus to upload this 'moon day' number to a web site, to then scrape it off the web site to a desktop app, when the figure is already available on the web.

I'm also somewhat bemused by this repeated suggestion that it would all be much simpler if Cumulus had a <#moonday> web tag. If it's hard to arrive at this number in the first place, where am I expected to get it from?
Steve
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

beteljuice wrote:This is not good !
I do agree! :)
beteljuice wrote:I suspect the 'page scraper' would NOT see any image or text created by the JavaScript, and would only be able to see the js itself.
That was exactly my suspicion to start with. Hence my preferring a <#lunarday> webtag, as that would actually be able to work. 8-)
beteljuice wrote:You need to 'scrape' the MoonDay number or image from one of the many sites that provide that sort of thing through a server-side script (eg. php). Some sites allow it, other frown upon scrapers.
Lucky thing is, it's my site, and I'm being very lenient with myself ;)
beteljuice wrote:If your server allows php, it would be better for you to get a freebie script that returns exactly what you want and scrape-your-own :lol:
Well yes, that's what I am doing so far. :)
beteljuice wrote:It's been interesting though
Yeah, there were even some interesting philosophical bits in there that kept on cropping up! :?
beteljuice wrote:BTW - Isn't a lunar month less than 30 days ...
generally about 29 and a bit maximum from most reports I've read so far. Can go as low as - ugh, senior moment, can't remember. :lol:
beteljuice wrote:... so all this code is ...... only any good for a 30 image selection :clap:
That's fine in this case. :)

I'm thinking I may have to scrap the idea and take out the images and replace them with one of a pine cone and another of seaweed, and then I could just pretend the whole Zambretti business does not exist either! :roll:
Cheers,
Ian
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Moon states - I'm stuck

Post by mcrossley »

beteljuice wrote:BTW - Isn't a lunar month less than 30 days ...
... so all this code is ...... only any good for a 30 image selection :clap:
That is what I was trying to say, basing your images on the day of the lunation is not a good idea as the length of a lunation varies. What you have done is translate the 100% into a 'standard' 30 day range of images. My suggestion is to base the images on the percentage illumination in the first place!
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

steve wrote:
beteljuice wrote:You need to 'scrape' the MoonDay number or image from one of the many sites that provide that sort of thing
I did wonder why this wasn't the solution in the first place.
I've found lots of sites that tell you how you might calculate it, many that offer calendars and charts, some that want you to sign up for all sorts of doubtful things along the way of getting to the number. I've not yet seen one that just comes up with the number as a matter of routine. And while I don't mind scraping my own site, scraping that of another almost always ends up becoming broken as some will go to extraordinary lengths to dislike the practice.
steve wrote: It seemed rather perverse to me to be getting Cumulus to upload this 'moon day' number to a web site, to then scrape it off the web site to a desktop app, when the figure is already available on the web.
Samurize can use the plugin to scrape from the web, but can't scrape from the machine, so I was simply being practical and doing the only thing that actually worked, perverse or otherwise. :lol:
steve wrote:I'm also somewhat bemused by this repeated suggestion that it would all be much simpler if Cumulus had a <#moonday> web tag. If it's hard to arrive at this number in the first place, where am I expected to get it from?
I had this idea in my head that you might have it already to be drawing the moon image from Cumulus as you do. I had no idea you had no idea what the lunar day was, I guess I assumed you might need to know that to draw what you do, but I now suspect that has to be a bad assumption on my part. :?
Cheers,
Ian
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Moon states - I'm stuck

Post by steve »

Flying Eye wrote:I had this idea in my head that you might have it already to be drawing the moon image from Cumulus as you do. I had no idea you had no idea what the lunar day was, I guess I assumed you might need to know that to draw what you do, but I now suspect that has to be a bad assumption on my part. :?
The moon image which Cumulus provides is a third-party component; I put it on the form and it just works. I get the 'percent illuminated' figure from an astronomical functions library which doesn't have a function for lunar day.
Steve
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

mcrossley wrote:
beteljuice wrote:BTW - Isn't a lunar month less than 30 days ...
... so all this code is ...... only any good for a 30 image selection :clap:
That is what I was trying to say, basing your images on the day of the lunation is not a good idea as the length of a lunation varies. What you have done is translate the 100% into a 'standard' 30 day range of images. My suggestion is to base the images on the percentage illumination in the first place!
That is why I originally asked you how many images you required. Since I'd be the one getting them to exist, I'd have to render them, but I'd have to know how many to render otherwise there is no reasonable way to make it happen.

However it now seems this is not going to be possible at all, because there is a data disconnect which I had not foreseen, and which appears to be insurmountable. I guess this makes the whole thing academic by now.

Anyway, thanks one and all for trying. :)
Cheers,
Ian
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

steve wrote:
Flying Eye wrote:I had this idea in my head that you might have it already to be drawing the moon image from Cumulus as you do. I had no idea you had no idea what the lunar day was, I guess I assumed you might need to know that to draw what you do, but I now suspect that has to be a bad assumption on my part. :?
The moon image which Cumulus provides is a third-party component; I put it on the form and it just works. I get the 'percent illuminated' figure from an astronomical functions library which doesn't have a function for lunar day.
Ah, right, thanks for the clarification, I understand now. :)

When I was coding (many moons ago!), I used to have a book that I sought out and purchased. It dealt with making astronomical calculations of all sorts, first in theory then as a sample code for BBC Basic, and of course that worked enough to show the principal and then a stab at the practice in each case.

It was very good and happily at a very reasonable price indeed! I'm going to guess it's out of print today and I can't even recall the name of it or the author by now, let alone if it's still to be unpacked form the last house move or whether it was lost. I shall keep my eyes peeled in case I find something of use though. I'm petty sure this one would have been in the book though, as it would have been a pretty basic building block that some of the more challenging stuff would have used for some of the trickier calculations.

UPDATE: well, I'll be damned! http://www.amazon.co.uk/Astronomy-Perso ... 355&sr=1-2 Still there, and still reasonable! :clap:
Cheers,
Ian
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Moon states - I'm stuck

Post by mcrossley »

Flying Eye wrote:That is why I originally asked you how many images you required. Since I'd be the one getting them to exist, I'd have to render them, but I'd have to know how many to render otherwise there is no reasonable way to make it happen.
Well that would be rather up to wouldn't it? Do you want the image to change for every 20% increment in illumination, or 10%, or 5%, or 1%!
When I did something like this I actually used the lunar selenic col-longitude (0-359 degrees) - because I was interested in the position of the terminator on the surface rather than the illuminated fraction - and created a pre-baked image for every 2 degrees - 180 images in all!
Flying Eye
Posts: 139
Joined: Tue 11 Jan 2011 10:29 pm
Weather Station: WH1081
Operating System: XpPro32SP3 & 7Home64SP1
Location: Buckinghamshire, England.
Contact:

Re: Moon states - I'm stuck

Post by Flying Eye »

mcrossley wrote:
Flying Eye wrote:That is why I originally asked you how many images you required. Since I'd be the one getting them to exist, I'd have to render them, but I'd have to know how many to render otherwise there is no reasonable way to make it happen.
Well that would be rather up to wouldn't it? Do you want the image to change for every 20% increment in illumination, or 10%, or 5%, or 1%!
When I did something like this I actually used the lunar selenic col-longitude (0-359 degrees) - because I was interested in the position of the terminator on the surface rather than the illuminated fraction - and created a pre-baked image for every 2 degrees - 180 images in all!
Wow! That's a bit too much for me these days; I'm a bear of small brain, and as a consequence have to keep it simple and realistic for my given abilities, which is why I was happy with the 30 images!

I'm pretty sure I am not clever enough by a pretty large margin for that sort of approach. And there you were a few posts back being concerned about things getting slightly more complex. Well, that certainly appears to have happened for me! :lol: I had better try to find another way. :roll:

Thanks for the thought though.
Cheers,
Ian
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Moon states - I'm stuck

Post by steve »

I've added a <#MoonAge> web tag in build 1016. No guarantees as to how accurate it is, but it should be 'close enough'.
Steve
Post Reply