pyephem calculation of Mars opposition via earth_distance - pyephem

I looped through all days in 2014 looking for the date with the smallest Earth-Mars distance. I expected this to occur on Mars opposition on Apr 8, 2014 but April 14 was the date with the lowest distance. Why?
date time mars.earth_distance (AU)
2014/4/1 00:00:00 0.636615
2014/4/2 00:00:00 0.633898
2014/4/3 00:00:00 0.631388
2014/4/4 00:00:00 0.629085
2014/4/5 00:00:00 0.626992
2014/4/6 00:00:00 0.625109
2014/4/7 00:00:00 0.623436
2014/4/8 00:00:00 0.621973
2014/4/9 00:00:00 0.620720
2014/4/10 00:00:00 0.619676
2014/4/11 00:00:00 0.618842
2014/4/12 00:00:00 0.618216
2014/4/13 00:00:00 0.617798
2014/4/14 00:00:00 0.617585
2014/4/15 00:00:00 0.617578
2014/4/16 00:00:00 0.617774
2014/4/17 00:00:00 0.618171
2014/4/18 00:00:00 0.618768
2014/4/19 00:00:00 0.619563
2014/4/20 00:00:00 0.620554
Similarly, the largest apparent size occurs on 12/15 and brightest magnitude occurs on Apr 12 rather than at opposition on Apr 8.

The moment of “opposition” is not the moment that a planet is closest or brightest, but is (if I recall) the moment when the elliptical longitude of the planet is 180° — exactly halfway across the sky, which is as far as possible — away from that of the Sun from the point of view of Earth.
If the planets traveled in perfect circles centered on the sun and at a uniform velocity, then the moment of opposition would also be the moment when the planet is closest and brightest. But since the planets are in elliptical orbits and move at a non-uniform rate, they can pass opposition but still be moving toward each other — or already be moving away from each other.
Magnitude is affected by both the phase of the planet and its distance, so we would expect the maximum magnitude to fall between the moment when the phase is greatest (at the moment of opposition) and the moment when the distance is smallest — and that is in fact what your numbers seem to indicate.

Related

Is there a way to apply week-over-week growth rates from prior year to current year data in Tableau?

I have a Dataset in Tableau with fields: Date, City, Sales. The data is for all days of 2022
I created Week - over - Week growth rates for 2022. My worksheet look like this:
Iso-Year (Date)
Iso Week (Date)
City
SUM(Sales)
2022 Growth %
2022
W01
New York
2500
0
2022
W01
Boston
400
0
2022
W01
Minnesota
1300
0
2022
W02
New York
2600
4%
2022
W02
Boston
200
-50%
2022
W02
Minnesota
1340
3.07%
2022
W03
New York
2400
-7.69%
2022
W03
Boston
800
200%
2022
W03
Minnesota
1200
-10.44%
The calculated field I used to get 2022 W-o-W growth %:
(SUM([Sales]) - LOOKUP(SUM([SALES]),-1)) / SUM([Sales])
I want to use the 2022 growth rate for a specific City and Iso-Week combination to the same City and Iso-week combination for 2023. As an example,
New York grew by 4% from W01 to W02 of 2022, so I'm looking to apply the same 4% to calculate Sales in W02 of 2023 (W01 2023 Sales * 1.04) and so on. Like this, I want to apply growth rates for those week and city combination of 2022 to calculate Sales for all future weeks of 2023. I already have my W01 2023 data to start with.
Iso-Year (Date)
Iso Week (Date)
City
SUM(Sales)*Growth
New Sales
2023
W01
New York
4000
4000
2023
W02
New York
4000*(1+4%)
4160
2023
W03
New York
4160*(1-7.69%)
3840
I cannot find a way to do this with my dataset. I cannot use FIXED function because I've used a table calculation in my calculated field for growth rate.
My struggle is that I'm using a Dataset provided to me by my organization and cannot modify the table logic. After I created the calculated field, I cannot use the 2022 growth % if I have 2023 data filtered in.
I have an option to create a custom data source but I do not think that the effort is worth for this.
Does anyone have an idea to make this possible?
I can provide more information if the description is not clear enough. Thanks a lot!

How does Unix Epoch time behave on a leap smeared clock?

Consider a machine whose time is smeared during a leap second with a noon-to-noon linear smear.
I'm wondering how the system clock provides accurate Epoch time during the smear period.
Example:
The leap second is scheduled at 31st dec of 2016.
On the machine, a Unix timestamp at 11:59:00 on 31st of December is 1483185540
At noon the smearing starts, which means the local clock of the system at 1:30 pm is already a few microseconds behind TAI and UTC. The Epoch timestamp should be 1483191000 (exactly 1 hour 31 minutes later), which is not accurate to TAI/UTC anymore since Epoch doesn't respect leap seconds
At 12pm UTC adds an extra second: 11:59:60 pm, the local smeared clock should continue normally
Till, at noon 1st of January global UTC and local UTC sync up again, the local Epoch clock is now an entire second behind global Epoch/TAI
How is this inaccuracy resolved? Does the local Epoch time skip a second once the system knows a leap second happened? Or how is this issue handled?
Does it depend on the implementation of the clock used to calculate the time? If so, how does GNU's coreutils date handle this?
The inaccuracy is not resolved. The Unix Time remains a count of seconds since 1970-01-01 00:00:00 UTC excluding the inserted leap seconds. This has the benefit of making the count of seconds easy to convert to {year, month, day, hour, minute, second} form.
It has the problem that the subtraction of two Unix Time time points that straddle a leap second insertion will result in a time duration that is one second less than reality.

Create subset and overall value line chart

This may sounds very simple but I am finding hard to get that. I have a data with value in one column and category in another column. i.e.,
Value Category Month
100 A Jan
300 A Feb
200 A Mar
459 B Jan
334 B Feb
765 B Mar
I am trying to use a line chart in tableau with Month on X axis and Value on Y-axis.Basically I am trying to add two lines, one for overall value for that particular month and another line for Category A alone for that particular month. Say for example the overall value for Jan as 559 and another line in same graph for category A for Jan as 100.
Though it sounds so basic, I find hard to achieve this. Should I create a calculated field for this or is there any simple method that works for this.
You'd want a dual axis probably to achieve this.
http://onlinehelp.tableau.com/current/pro/desktop/en-us/multiplemeasures_dualaxes.html
See: Dual axis chart from the same measure in Tableau
Then you can color one of the measures based upon the category. Make sure to synchronize axis.

Time axis based on the last 24 hours

I am trying to find a way to make my axis go from a certain time to the same time 24h later.
What I mean is that I am taking measurements for the last 24 hours and I want my axis to be limited and have certain ticks.
More specifically, I get measurements which start at 10am on the 1st of Nov and it finishes at 10am on the 2nd of Nov.
And i want my axis to go from 10 to 24 / 00 to 10 with 1h steps (ticks).
Any suggestions on how to do that are more than welcome.
Thanks a lot for your time.

Cumulative Days in Overlapping Date Ranges

I use Crystal Reports 11.
What I'd like to do is get a count of the unique days a student was enrolled in one of our many programs. If a student was enrolled in 3 programs in which the dates overlapped, I'd just want to count each day once and get a number.
Example using a student:
Algebra Jan 1 to Jan 10: 10 days
Science Jan 4 to Jan 11: 8 days
English Jan 9 to Jan 13: 4 days
I'd want the answer to be 13.
Good point. If they always over lap then this will work
Create a formula that finds maximum end date and the minimum start date based on patient. Then minus each formula.
i.e.: Maximum({xxx.enddate}, {xxx.patient}) - Minimum({xxx.startdate}, {xxx.patient})
If there are gaps between program dates, this won't work because it will include them.
Grouping the field by the patient name and Using
DistinctCount()
may be helpful.