I gave this a second try and this time I managed to adjust it to what I want. But now I would like to know if I can get the range rate, azimuth rate and elevation rate as well.
import spiceypy
import numpy as np
from datetime import datetime, timezone
# ######################################################################## #
# Based on code by Greg Miller ([email protected]) 2019 #
# Released as public domain #
# https://astronomy.stackexchange.com/questions/33095/spice-alt-az-example #
# ######################################################################## #
spiceypy.furnsh('SPICE/Kernels/mk/metakernel.tm')
# Lat, Lon position of observer ------------------------------------------
'''
Here the coords are normal and in mytopo.tf they need to be:
lon_mytypo = -lon_normal
lat_mytypo = -(90-lat_normal)
'''
lat = np.radians(47.397490)
lon = np.radians(8.550440)
alt = 0.4995
# convert lat, lon to xyz ------------------------------------------------
obspos = spiceypy.georec(lon, lat, alt, 6378.1366, 1.0/298.25642)
# time of observation in UT ----------------------------------------------
et = spiceypy.datetime2et(datetime.now(timezone.utc))
# Get the xyz coordinates of the spacecraft relative to observer in MYTOPO frame (Correct for one-way light time and stellar aberration)
state_vector, light_time = spiceypy.spkcpo('JUICE', et, 'MYTOPO', 'OBSERVER', 'LT+S', obspos, 'EARTH', 'ITRF93')
# convert to polar coordinates
position = state_vector[0:3] # km
velocity = state_vector[3:6] # km/s
print(np.linalg.norm(velocity))
r, az, el = spiceypy.recazl(position, azccw=False, elplsz=True)
print(r, np.degrees(az), np.degrees(el))