Package: vinvelivaanilai
vinvelivaanilaiVinveli - Space, Vaanilai - Weather (in Tamil)This project collects space weather data from ftp.swpc.noaa.gov for your useCurrently the project supports the following indices for a complete year/quarter:DGD (Daily Geomagnetic Data)DSD (Daily Solar Data)DPD (Daily Particle Data)All of the above are daily indices and are accessible atftp://ftp.swpc.noaa.gov/pub/indices/old_indices/.It also supports strorage and propagation of TLEs, OMMs which are fetched fromhttps://celestrak.com/.We went with celestrak because their license permits storage, modification and
redistribution of the data (permissive) as against Space-Track who have a
non-permissive license (which would make this project illegal).Feel free toread this blogby LSF to learn more.The project structure is like so:vinvelivaanilai
├──orbit
│├──predict_orbit.py(usesTLEs/OMMstopredict/propagateorbit)│└──tle_fetch.py(fetchesTLEsfromcelestrak)├──space_weather
│├──sw_extractor.py(extractsspace-weatherdatafromSWPCfiles)│└──sw_file_fetch.py(fetchesfileswiththeindicesfromSWPC)└──storage├──idb_config.py(configurationofinfluxdb)├──retrieve.py(retrievesdatafrominfluxdb)├──store.py(pushesdatatoinfluxdb)└──docker-compose.yml(fireupinfluxdb)InstallationYou can install vinvelivaanilai using pippipinstallvinvelivaanilaiIt is recommended that you install the project in a virtual environment as it
is still under development.To create a virtual environment and install in it, run:python-mvenv.venvsource.venv/bin/activate
pythom-mpipinstallvinvelivaanilaiTo install an editable version of the master branch:gitclonehttps://gitlab.com/librespacefoundation/polaris/vinvelivaanilai.gitcdvinvelivaanilai
pipinstall-e.UsageFor fetching indices from SWPC(.venv)$python

>>>fromvinvelivaanilai.space_weather.sw_file_fetchimportfetch_indices

>>>fromvinvelivaanilai.space_weather.sw_extractorimportextract_data_regex

>>>importdatetime

>>>start_date=datetime.datetime(year=2018,month=1,day=30)>>>final_date=datetime.datetime(year=2019,month=2,day=28)>>>fetch_indices("DGD",start_date,final_date)>>>df=extract_data_regex("DGD","2018_DGD.txt")>>>dfFredericksburgAFredericksburgK0-3FredericksburgK3-6...PlanetaryK15-18PlanetaryK18-21PlanetaryK21-24
Date...2018-01-01833...1112018-01-02411...1212018-01-03301...1112018-01-04310...0212018-01-05512...112........................2018-12-27522...1132018-12-281944...3432018-12-29922...2222018-12-30713...3222018-12-31732...101[365rowsx27columns]For using influxdb, you need to start the docker-container using the
docker-compose file in storage$cdvinvelivaanilai/storage$docker-composeup-dCreatingnetwork"storage_default"withthedefaultdriverCreatingstorage_influxdb_beta_1...doneFor fetching TLEs/OMMs from celestrak and propagating orbits(.venv)$python

>>>fromvinvelivaanilai.orbitimporttle_fetch,predict_orbit

>>>fromdatetimeimportdatetime,timedelta# Both stores data and serves df>>>omms=tle_fetch.fetch_latest_omm_from_celestrak("/tmp/cubesats.csv","cubesat","w")>>>ommsOBJECT_NAMEOBJECT_IDMEAN_MOTIONECCENTRICITY...REV_AT_EPOCHBSTARMEAN_MOTION_DOTMEAN_MOTION_DDOT
EPOCH...2020-07-0220:09:35.571520CUTE-1(CO-55)2003-031E14.2224480.001022...882280.0000353.400000e-0702020-07-0300:17:05.416000CUBESATXI-IV(CO-57)2003-031J14.2183090.001031...882180.0000322.800000e-0702020-07-0220:43:32.275264CUBESATXI-V2005-043F14.6377980.001577...782860.0000247.700000e-0702020-07-0219:03:35.927776CUTE-1.7+APDII(CO-65)2008-021C14.8848280.001464...660220.0000201.340000e-0602020-07-0217:06:36.440128AAUSAT-II2008-021F14.9508250.001206...661690.0000252.140000e-060..............................2020-07-0214:26:08.321344ATL-12019-084G15.7993810.002551...32840.0002654.997300e-0402020-07-0221:36:40.737664SMOG-P2019-084J15.8156920.002411...32900.0002785.654500e-0402020-07-0305:09:12.485440DUCHIFAT-32019-089C14.9907690.000771...30660.0000201.690000e-0602020-07-0212:57:28.828000ORBITALFACTORY2(OF-2)2019-071C15.3339890.001350...23440.0000357.820000e-0602020-07-0300:59:05.703136M2PATHFINDER2020-037E14.9119920.001170...34-0.000007-1.220000e-060[178rowsx16columns]>>>epoch_time=datetime(year=2020,month=6,day=27,hour=11)# We are resetting the index because we need the column EPOCH to be present# while propagating orbit. Both r and v have units. You can remove the unit by using .value>>>predict_orbit.get_position_velocity_from_omm(epoch_time,omms.reset_index()){'t':datetime.datetime(2020,6,27,11,0),'r':<Quantity[6759.32081709,1754.29279972,1761.88153199]km>,'v':<Quantity[2.0339923,-0.66798429,-7.12138608]km/s>}>>>fromvinvelivaanilai.storageimportstore,retrieve

>>>omms_old=tle_fetch.fetch_from_celestrak_csv("/tmp/cubesats.csv")>>>measurement_name="cubesats">>>bucket_name="cubesat_omms">>>store.dump_to_influxdb(omms_old,measurement_name,bucket_name)>>>start_date=datetime.now()-timedelta(days=1)>>>final_date=datetime.now()>>>retrieve.fetch_from_influxdb(start_date,end_date,measurement_name,bucket_name)ARG_OF_PERICENTERBSTARCLASSIFICATION_TYPE...OBJECT_NAMERA_OF_ASC_NODEREV_AT_EPOCH
EPOCH...2020-07-0305:28:10.223104+00:0060.31840.000013U...BRITE-PL2(HEWELIUSZ)277.2914318122020-07-0305:17:42.263584+00:0052.76980.000015U...NEE-01PEGASO283.9268388012020-07-0305:09:12.485440+00:00202.46340.000020U...DUCHIFAT-35.211630662020-07-0304:55:49.973728+00:00158.28700.000046U...E-ST@R-II296.0163229812020-07-0304:50:30.544288+00:0021.52910.000070U...KRAKSAT258.59975693........................2020-07-0221:30:20.461888+00:007.81410.000094U...SPACEBEE-1259.2951137572020-07-0221:27:51.441760+00:0068.16320.000019U...AEROCUBE5C97.161843582020-07-0221:23:07.163296+00:00358.62170.000072U...MIRATA96.5183141502020-07-0221:19:51.643552+00:00265.91390.000039U...NAYIF-1(EO-88)252.2250187902020-07-0221:19:31.777600+00:0073.65340.000026U...LUCKY-7146.04575490[85rowsx16columns]To know more about any vinvelivaanilai module, use the default python
help function and call the module.CreditsA big shout-out to the following projects:celestrakhttps://celestrak.com/poliastrohttps://github.com/poliastro/poliastroorbit-predictorhttps://github.com/satellogic/orbit-predictorSWPChttps://www.swpc.noaa.gov/and the following people for guiding me:Hugh (@SaintAardvark)Red (@redsharpbyte)Xabi (@crespum)Patrick (@DL4PD)Juan Luis (@astrojuanlu)Work in progresspip installation supportTLE extraction and orbit propogationGEOA data extractionSPE (Space Proton Event) data extraction (*)(*) Some proton events are already covered in DPD data.