Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ ax.legend()
### Handling Local Sidereal Time

Using the `in_lst()` method of the output DataFrame, you can convert its time index to the local sidereal time (LST).
Here is a example script that shows JST on the bottom axis and LST on the top axis:
Here is an example that shows JST on the bottom axis and LST on the top axis:

```python
import azely
Expand All @@ -126,11 +126,11 @@ ax_jst.set_ylabel('Elevation (deg)')
ax_jst.set_ylim(0, 90)
ax_jst.grid(which='both')
ax_jst.legend()
ax_jst.margins(0)

# plot invisible elevation for the LST axis
df.in_lst().el.plot(ax=ax_lst, alpha=0)
ax_lst.xaxis.set_major_formatter(DateFormatter('%H:%M'))
ax_jst.margins(0)
ax_lst.margins(0)
```

Expand Down
28 changes: 14 additions & 14 deletions azely/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def calc(
source = {"location": source, "object": source, "time": source}

if isinstance(location, dict):
location_ = Location(**location)
location = Location(**location)
elif isinstance(location, str):
location_ = get_location(
location = get_location(
location,
google_api=google_api,
ipinfo_api=ipinfo_api,
Expand All @@ -178,9 +178,9 @@ def calc(
)

if isinstance(object, dict):
object_ = Object(**object)
object = Object(**object)
elif isinstance(object, str):
object_ = get_object(
object = get_object(
object,
sep=sep,
timeout=timeout,
Expand All @@ -190,32 +190,32 @@ def calc(
)

if isinstance(time, dict):
time_ = Time(**time)
time = Time(**time)
elif isinstance(time, str):
time_ = get_time(
time = get_time(
time,
sep=sep,
append=append.get("time", True),
overwrite=overwrite.get("time", False),
source=source.get("time", AZELY_CACHE),
)
time_ = replace(time_, timezone=str(location_.timezone))
time = replace(time, timezone=str(location.timezone))

skycoord = object_.skycoord(
skycoord = object.skycoord(
ObsTime(
time_.index.tz_convert(None),
location=location_.earthlocation,
time.index.tz_convert(None),
location=location.earthlocation,
)
).altaz

azel = AzEl(
index=time_.index,
index=time.index,
data={
"az": skycoord.az, # type: ignore
"el": skycoord.alt, # type: ignore
},
)
azel.location = location_
azel.object = object_
azel.time = time_
azel.location = location
azel.object = object
azel.time = time
return azel
Loading