-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for using local data files? #6
Comments
Hi @tuckermcclure ! In fact, there is a way, but it is not documented and we can develop a nicer API. I created a new project with the following files:
[deps]
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
SpaceIndices = "5a540a4e-639f-452a-b107-23ea09ed4d36"
The three last files were obtained from the respective websites. Now, we need to change the using Scratch
using SpaceIndices
# Make sure we do not have any cache in the scratch space.
Scratch.clear_scratchspaces!()
# Use the local files instead the URLs.
local_dir = dirname(@__FILE__)
SpaceIndices.urls(::Type{SpaceIndices.Celestrak}) = ["file://$local_dir/SW-ALL.csv"]
SpaceIndices.urls(::Type{SpaceIndices.JB2008}) = [
"file://$local_dir/DTCFILE.txt"
"file://$local_dir/SOLFSMY.txt"
]
SpaceIndices.init() I got the following by running this script: julia> include("test.jl")
[ Info: Downloading the file 'DTCFILE.txt' from 'file:///Users/ronan.arraes/tmp/my_project/DTCFILE.txt'...
[ Info: Downloading the file 'SOLFSMY.txt' from 'file:///Users/ronan.arraes/tmp/my_project/SOLFSMY.txt'...
[ Info: Downloading the file 'SW-ALL.csv' from 'file:///Users/ronan.arraes/tmp/my_project/SW-ALL.csv'...
julia> space_index(Val(:F10obs), DateTime("2024-01-01"))
146.2 I really think we can improve this but I have no idea of a good API for the general case. |
Hi @ronisbr, and thanks for your reply! Ok, got it. You're reassigning the To brainstorm on a potential API for this, I think something like this would work well for my use cases:
I recognize that's a big change from the way While we're here, it would also be pretty cool to put the relevant indices data files into a Julia package that's updated every two weeks or so. That could be directly in |
Hi @tuckermcclure ! I had an idea! What if we create a keyword
It would be awesome! However, we will need something to constantly update the files (some are daily). I am not sure how can we do this safely. |
Sounds good to me!
I think if you want bleeding edge, you should just pull the files like today, but if you want a predictable environment at a slower pace than daily updates, the |
Perfect! I will implemente that.
I fully agree. I will investigate the best way to do this, if this can be automated, and if it will require big changes. EDIT: As I learned from JuliaSlack, using Artifacts for this type of task is not good. A new version will have a new hash and I will need to update this package every day. |
@tuckermcclure Done! Now you can do: SpaceIndices.init(SpaceIndices.Celestrak; filepaths = ["./SW-All.csv"]) |
Btw @tuckermcclure, can you please test the |
Wow, so fast! I barely had time to get out my meetings before this was done. I'll give this a shot. |
This seems to work fine for the files on my end. I know some things have changed recently. Do I understand correctly that |
Yes! This file has everything in a much easier format to handle. |
Thank you! This is very helpful. |
Perfect! I will tag a new version. |
This package is very helpful. We use it in our simulation. One key thing is that, given a fixed Manifest.toml file, our sims should always produce the same results. When space indices are updated, that requirement is violated. That is, you can run a simulation and then re-run that exact same simulation, and if the space indices happen to have been updated, you may get different results, and that's very bad for us.
Back in v0.10, I was calling this:
(We added the data files directly to a package we use so that they were essentially version-controlled just like any other package.)
Looking through the source code, I don't see any equivalent way to pass in paths for those files today. Am I missing anything?
The text was updated successfully, but these errors were encountered: