Added datafiles to package and removed KAIPYHOME

This commit is contained in:
Nikhil Rao
2025-06-05 10:41:34 -04:00
parent d54333f5da
commit 963a1ab2f0
5 changed files with 18 additions and 18 deletions

1
MANIFEST.in Normal file
View File

@@ -0,0 +1 @@
include kaipy/satcomp/sc_helio.json

View File

@@ -2,6 +2,7 @@
import datetime
import os
import sys
import importlib.resources as pkg_resources
# Import supplemental modules.
from astropy.coordinates import SkyCoord
@@ -16,6 +17,7 @@ from sunpy.coordinates import frames
# Import project modules.
import kaipy.kaiTools as kaiTools
import kaipy.satcomp.scutils as scutils
from kaipy.satcomp import satcomp
# """Simple utilitiles for fetching data from CDAWeb.
@@ -34,6 +36,8 @@ import kaipy.satcomp.scutils as scutils
# Format string for CDAWeb datetime strings.
CDAWEB_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
# Get the sc_helio.json file from the package and return a temporary file path.
sc_helio_json_path = pkg_resources.files(satcomp).joinpath("sc_helio.json")
def fetch_satellite_geographic_position(spacecraft, when):
"""Fetch the geographic position of a satellite at a specified time.
@@ -433,9 +437,7 @@ def fetch_helio_spacecraft_HGS_trajectory(spacecraft, t_start, t_end, mjdc):
Tuple[np.array, np.array, np.array]: Cartesian coordinates (x, y, z) of the spacecraft in the HGS frame.
"""
# Read the CDAWeb spacecraft database.
spacecraft_data_file = os.path.join(
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
)
spacecraft_data_file = sc_helio_json_path
sc_info = scutils.getScIds(spacecraft_data_file=spacecraft_data_file)
# Create the CDAWeb connection.
@@ -507,9 +509,7 @@ def fetch_helio_spacecraft_trajectory(sc_id, t_start, t_end):
Tuple[np.array, np.array, np.array]: Cartesian coordinates (x, y, z) of the spacecraft in the HGS frame.
"""
# Read the CDAWeb spacecraft database.
sc_metadata_path = os.path.join(
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
)
sc_metadata_path = sc_helio_json_path
sc_metadata = scutils.getScIds(spacecraft_data_file=sc_metadata_path)
# Create the CDAWeb connection.
@@ -545,9 +545,7 @@ def ingest_helio_spacecraft_trajectory(sc_id, sc_data, MJDc):
z (dm.dmarray): The z-coordinate in the GH(MJDc) frame.
"""
# Read the CDAWeb spacecraft database.
sc_metadata_path = os.path.join(
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
)
sc_metadata_path = sc_helio_json_path
sc_metadata = scutils.getScIds(spacecraft_data_file=sc_metadata_path)
# Determine the coordinate system used by the CDAWeb ephemeris.

View File

@@ -18,6 +18,7 @@ Mike Wiltberger
import argparse
from argparse import RawTextHelpFormatter
import os
import importlib.resources as pkg_resources
# Third-party modules
import numpy as np
@@ -28,7 +29,7 @@ import kaipy.kaiH5 as kaiH5
import kaipy.kaiViz as kv
import kaipy.kaiTools as kaiTools
import kaipy.satcomp.scutils as scutils
from kaipy import satcomp
# Program constants.
@@ -55,9 +56,7 @@ default_numSeg = 1
default_path = os.getcwd()
# Path to file of heliospheric spacecraft metadata.
helio_sc_metadata_path = os.path.join(
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
)
helio_sc_metadata_path = pkg_resources.files(satcomp).joinpath("sc_helio.json")
def create_command_line_parser():

View File

@@ -60,6 +60,7 @@ Eric Winter (eric.winter@jhuapl.edu)
import argparse
import os
import subprocess
import importlib.resources as pkg_resources
# Import supplemental modules.
import astropy.time
@@ -78,6 +79,7 @@ import kaipy.gamhelio.heliosphere as hsph
import kaipy.kaiH5 as kh5
import kaipy.kaiTools as ktools
import kaipy.kaiViz as kv
from kaipy import satcomp
from kaipy.satcomp import scutils
@@ -106,9 +108,7 @@ default_movie_format = "mp4"
valid_movie_formats = ("gif", "mp4")
# Path to spacecraft metadata file.
sc_metadata_path = os.path.join(
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
)
sc_metadata_path = pkg_resources.files(satcomp).joinpath("sc_helio.json")
# Figure sizes by plot type, (width, height) in inches.
figure_sizes = {
@@ -124,7 +124,7 @@ figure_sizes = {
# List of colors to use for spacecraft position dots.
SPACECRAFT_COLORS = list(mpl.colors.TABLEAU_COLORS.keys())
def create_command_line_parser():
"""
Create the command-line argument parser.

View File

@@ -9,7 +9,9 @@ setup(
url='https://bitbucket.org/aplkaiju/kaipy/src/master/',
packages=find_packages(),
include_package_data=True,
package_data={'kaipy': ['scripts/*', 'scripts/*/*']},
package_data={'kaipy': ['scripts/*', 'scripts/*/*'],
'kaipy.satcomp': ['sc_helio.json']
},
python_requires='>=3.9,<=3.13',
install_requires=[
'alive_progress',