-
+
+

Nasapy Documentation

+

nasapy is a Python wrapper for the nasa.gov API.

+
+

Contents

+
+
+

Installation

+

nasapy is most easily installed using pip.

+
pip install nasapy
+
+
+

The library can also be cloned or downloaded into a location of your choosing and then installed using the setup.py +file per the following:

+
git clone git@github.com:aschleg/nasapy.git
+cd nasapy
+python setup.py install
+
+
+
+
+

Examples and Usage

+

Although not strictly required to begin interacting with the NASA API, it is recommended to sign up +to receive an API access key that has a significantly higher usage limit available compared +to the demo key option. Many methods do not require an API key, but for those that do, it is typically a good option to +use a provided API key rather than the demo key. Using a received API key allows for 1,000 requests per hour, while the +demo key has 30 requests limit per hour and 50 requests per day.

+
+

Authentication

+

Assuming an API key was received after signing up, authentication to the NASA API happens when initializing the +Nasa class.

+
nasa = Nasa(key=key)
+
+
+

If using a demo key, the initialization does not require any parameters to be passed.

+
nasa = Nasa()
+
+
+
+
+

Remaining Requests Available

+

The limit_remaining attribute of the initialized Nasa class allows one to see the number of available +requests remaining.

+
nasa.limit_remaining
+
+
+
+
+

Examples

+

The following are some quick examples to get started.

+
+

Astronomy Picture of the Day

+
# Return today's picture of the day
+nasa.picture_of_the_day()
+# Return a previous date's picture of the day with the high-definition URL included.
+nasa.picture_of_the_day('2019-01-01', hd=True)
+
+
+
+
+

Mars Weather

+
# Return the most recent data for the previous seven Sols (Martian Days)
+nasa.mars_weather()
+
+
+
+
+

Asteroid Feed

+
# Get asteroids approaching Earth at the beginning of 2019.
+nasa.asteroid_feed(start_date='2019-01-01')
+
+
+
+
+

Get Asteroid Data

+
# Get entire asteroid data set.
+nasa.get_asteroids()
+# Get asteroid with ID 3542519
+nasa.get_asteroids(asteroid_id=3542519)
+
+
+
+
+

DONKI (Space Weather Database of Notifications, Knowledge and Information)

+
# Coronal Mass Ejection Event Data
+
+# View data from coronal mass ejection events from the last thirty days
+nasa.coronal_mass_ejection()
+# View all CME events from the beginning of 2019.
+nasa.coronal_mass_ejection(start_date='2019-01-01', end_date=datetime.datetime.today())
+
+# Geomagnetic Storm Event Data
+
+# Get geomagnetic storm events from the last thirty days.
+nasa.geomagnetic_storm()
+
+# Solar Flare Event Data
+
+# Get solar flare events from May of 2019
+nasa.solar_flare(start_date='2019-05-01', end_date='2019-05-31')
+
+# Solar Energetic Particle Data
+
+# Get data from April 2017
+nasa.solar_energetic_particle(start_date='2017-04-01', end_date='2017-04-30')
+
+# Magnetopause Crossing Data
+
+# Get data on magnetopause crossing events from 2018 to the current date.
+nasa.magnetopause_crossing(start_date='2018-01-01')
+
+# Radiation Belt Enhancement Data
+
+# Get data on radiation belt enhancement events from the last 30 days.
+nasa.radiation_belt_enhancement()
+
+# Hight Speed Stream Data
+
+# Get data on hight speed stream events from the beginning of September 2019.
+nasa.hight_speed_stream()
+
+# WSA Enlil-Simulation Data
+
+# Get data from the first simulation performed in 2019.
+wsa = n.wsa_enlil_simulation(start_date='2019-01-01')
+wsa[0]
+
+
+
+
+

EPIC (DSCOVR’s Earth Polychromatic Imaging Camera)

+
# Get EPIC data from the beginning of 2019.
+e = nasa.epic(date='2019-01-01')
+# Print the first result
+e[0]
+
+
+
+
+

Landsat Images for a given Latitude-Longitude

+
# Get imagery at latitude 1.5, longitude 100.75 and include the computed cloud score calculation.
+nasa.earth_imagery(lon=100.75, lat=1.5, cloud_score=True)
+
+# Get assets available beginning from 2014-02-01 at lat-lon 100.75, 1.5
+nasa.earth_assets(lat=100.75, lon=1.5, begin_date='2014-02-01')
+
+
+
+
+

Available Image data collected by the Mars rovers Curiosity, Discovery and Spirit.

+
# Return image data collected on Curiosity's 1000th sol.
+nasa.mars_rover(sol=1000)
+
+
+
+
+

Access GeneLab and Other Bioinformatics Databases

+
# Find Gene studies in the cgene database related to 'mouse liver'
+n.genelab_search(term='mouse liver')
+
+
+
+
+

CelesTrak Two-Line Element Set Records

+
# Retrieve available data for a specific satellite ID.
+tle(satellite_number=43553)
+
+
+
+
+

Search for Available Imagery and Audio from the images.nasa.gov API

+
# Search for media related to 'apollo 11' with 'moon landing' in the description of the items.
+r = media_search(query='apollo 11', description='moon landing')
+# Print the first returned media item from the resulting collection.
+r['items'][0]
+
+
+
+
+

Getting the Julian and Modified Julian Date

+
# Return the modified Julian Date for the current time.
+julian_date()
+# Return the non-modified Julian Date for the current time.
+julian_date(modified=False)
+# Get the modified Julian Date for 2019-01-01 at midnight.
+julian_date(year=2019)
+
+
+
+
diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv index 80a67da..269fb6c 100644 --- a/docs/build/html/objects.inv +++ b/docs/build/html/objects.inv @@ -3,6 +3,6 @@ # Version: 0.2 # The remainder of this file is compressed using zlib. xڍn0 { -zf+4C  - ^ -Ʈ!k! ɰ'Xr#Cʦ{WMT"cECQ8h 0Ȝ0![L!dP:Vೣr-:W-5SU! \ No newline at end of file diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js index 47de26d..c3232a7 100644 --- a/docs/build/html/searchindex.js +++ b/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["api","index","versions"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:55},filenames:["api.rst","index.rst","versions.rst"],objects:{"":{Nasa:[0,0,1,""],close_approach:[0,1,1,""],fireballs:[0,1,1,""],julian_date:[0,1,1,""],media_asset_captions:[0,1,1,""],media_asset_manifest:[0,1,1,""],media_asset_metadata:[0,1,1,""],media_search:[0,1,1,""],mission_design:[0,1,1,""],nhats:[0,1,1,""],scout:[0,1,1,""],sentry:[0,1,1,""],tle:[0,1,1,""]},Nasa:{asteroid_feed:[0,1,1,""],coronal_mass_ejection:[0,1,1,""],earth_assets:[0,1,1,""],earth_imagery:[0,1,1,""],epic:[0,1,1,""],genelab_search:[0,1,1,""],geomagnetic_storm:[0,1,1,""],get_asteroids:[0,1,1,""],hight_speed_stream:[0,1,1,""],interplantary_shock:[0,1,1,""],magnetopause_crossing:[0,1,1,""],mars_rover:[0,1,1,""],mars_weather:[0,1,1,""],picture_of_the_day:[0,1,1,""],radiation_belt_enhancement:[0,1,1,""],solar_energetic_particle:[0,1,1,""],solar_flare:[0,1,1,""],techport:[0,1,1,""],wsa_enlil_simulation:[0,1,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"]},objtypes:{"0":"py:class","1":"py:method"},terms:{"01au":0,"05ld":0,"100th":0,"2048x2048":0,"2au":0,"boolean":0,"case":0,"class":0,"default":0,"export":0,"float":0,"function":[0,2],"new":0,"return":0,"true":0,"while":0,AND:0,Added:2,For:0,NOT:0,Near:2,The:0,Will:0,absolut:0,accept:0,access:0,accur:0,accurate_onli:0,activ:0,add:0,advanc:0,after:0,all:0,also:0,alt_max:0,alt_min:0,altern:0,altitud:0,analysi:0,angl:0,ani:0,anl:0,annot:0,anomali:0,apertur:0,api:[1,2],apollo:0,approach:0,approxim:0,april:0,arc:0,argonn:0,as11:0,asc:0,ascend:0,assess:2,asset:0,associ:0,asteroid:0,asteroid_fe:0,asteroid_id:0,astronom:0,astrononmi:0,atmospher:0,audio:0,avail:0,base:0,been:0,begin:0,begin_d:0,belt:0,between:0,bioinformat:0,biotechnolog:0,bodi:0,both:0,bright:0,brighter:0,burn:0,calcul:0,can:0,caption:0,captur:0,cassegrain:0,catalog:0,caus:0,ccd:0,celestrak:0,center:[],cere:0,certain:0,cgene:0,charg:0,chemcam:0,chronicl:0,chronolog:0,close:0,close_approach:0,closest:0,cloud:0,cloud_scor:0,cme:0,cneo:2,code:0,collect:0,color:0,combin:0,comet:0,comma:0,commun:0,complet:0,complete_data:0,complete_entri:0,compon:0,comprehens:0,comput:0,condit:0,conjunct:0,connect:0,contain:0,content:0,convert:0,coron:0,coronal_mass_eject:0,count:0,coupl:0,cover:0,criteria:0,cross:0,curios:0,current:0,daili:0,data:2,data_fil:0,dataset:0,date:0,date_max:0,date_min:0,datetim:0,ddthh:0,dec:0,decemb:0,defin:0,definit:0,degre:0,delimit:0,delta:0,delta_v:0,demo:0,demo_kei:0,denot:0,des:0,desc:0,descend:0,descript:0,design:0,desir:0,destin:0,detector:0,determin:0,devic:0,diamet:0,dict:0,dictionari:0,digit:0,dim:0,directli:0,disc:0,discoveri:0,dist_max:0,dist_min:0,distanc:0,distribut:0,document:0,done:0,download:0,dscovr:0,durat:0,each:0,earlier:0,earlieset:0,earth:2,earth_asset:0,earth_dat:0,earth_imageri:0,ebi:0,ebi_prid:0,effect:0,either:0,eject:0,empti:0,encod:0,end:0,end_dat:0,endpoint:0,energet:0,energi:0,energy_max:0,energy_min:0,enhanc:0,entir:0,eph_start:0,eph_step:0,eph_stop:0,ephemeri:0,equal:0,equat:0,ero:0,estim:0,european:0,evalu:0,event:0,everi:0,exact:0,exampl:0,exclud:0,exist:0,explor:0,express:0,fals:0,ffield:0,fhaz:0,field:0,file:0,filter:0,find:0,firebal:0,first:0,flare:0,flight:0,follow:0,forecast:0,format:0,four:0,fov_dec:0,fov_diam:0,fov_ra:0,fov_vmag:0,frac:0,from:0,front:0,full:0,fullnam:0,fvalu:0,gene:0,genelab_search:0,gener:0,geo:0,geomagnet:0,geomagnetic_storm:0,get:0,get_asteroid:0,given:0,gov:0,greater:0,h_max:0,h_min:0,half:0,half_angl:0,has:0,have:0,health:0,height:0,high:0,hight:0,hight_speed_stream:0,histori:1,hour:0,http:0,human:0,iau:0,identif:0,imag:[],impact:[0,2],impact_e_max:0,impact_e_min:0,includ:0,infin:0,initi:[0,2],insensit:0,instead:0,institut:0,instrument:0,intellig:0,interact:0,interfac:0,interplantari:0,interplantary_shock:0,interpret:0,invalid:0,ip_min:0,item:0,its:0,jang_et_al_catalog:0,januari:0,jet:0,joul:0,jpl:0,json:0,julian:0,julian_d:0,kei:0,keyword:0,kiloton:0,kind:0,known:0,laboratori:0,lagrang:0,land:0,lander:0,landsat:0,larg:0,last:0,last_obs_dai:0,last_upd:0,lat:0,later:0,latitud:0,launch:0,least:0,less:0,letter:0,limit:0,line:[],linkag:0,list:0,liver:0,locat:0,lon:0,longer:0,longitud:0,lower:0,lunar:0,machin:0,magnetopaus:0,magnetopause_cross:0,magnitud:0,mahli:0,mai:0,maintain:0,make:0,manifest:0,map:0,mardi:0,mars_rov:0,mars_weath:0,martian:0,mass:0,mast:0,match:0,maximum:0,media:0,media_asset_capt:0,media_asset_manifest:0,media_asset_metadata:0,media_search:0,media_typ:0,messeng:0,metadata:0,metagenom:0,method:[],mg_rast:0,midnight:0,minimum:0,minit:0,minut:0,mission:0,mission_design:0,mjd0:0,model:0,modifi:0,month:0,moon:0,more:0,most:0,mous:0,mpc:0,much:0,multipl:0,must:0,n_orbit:0,name:0,nasa_id:0,nasapi:0,nation:0,natur:0,navcam:0,ncbi:0,nea:0,nea_comet:0,neg:0,neo:0,nhat:0,nih:0,nih_geo_gs:0,non:0,none:0,note:0,now:0,number:0,object:2,obs_cod:0,observ:0,observatori:0,occ:0,omnibu:0,onc:0,one:0,onli:0,oper:0,opportun:0,option:0,orbit:0,orbit_class:0,orbit_condition_cod:0,order:0,other:[],otherwis:0,output:0,over:0,overal:0,p20uvyk:0,page:0,pair:0,palermo:0,pancam:0,paramet:0,pars:0,particl:0,particular:0,pass:0,peak:0,per:0,percentag:0,perform:0,period:0,perspect:0,pha:0,photograph:0,picture_of_the_dai:0,pixel:0,pleas:0,plot:0,plot_base64:0,point:0,posit:0,prepend:0,previou:0,pride:0,primari:0,print:0,prior:0,probabl:0,project:0,project_id:0,propos:0,propuls:0,proteom:0,provid:[0,2],provision:0,ps_min:0,publish:0,python:0,queri:0,radiat:0,radiation_belt_enhanc:0,rang:0,rapid:0,rast:0,readabl:0,recalcul:0,receiv:0,recent:0,record:0,refer:1,regist:0,rel:0,relat:0,relationship:0,releas:2,remov:0,repreent:[],repres:0,req_alt:0,req_loc:0,req_vel:0,req_vel_comp:0,request:0,requir:0,research:0,resolut:0,resourc:0,respons:0,restrict:0,result:0,retriev:0,return_format:0,revers:0,rhaz:0,risk:2,rotat:0,sampl:0,satellite_numb:0,scale:0,scienc:0,scientist:0,score:0,scout:0,search:[],search_satellit:0,second:0,secondari:0,secondary_cr:0,see:0,select:0,sentri:[0,2],separ:0,septemb:0,serv:0,set:[],seven:0,shock:0,should:0,simul:0,sinc:0,sixteen:0,size:0,small:0,sol:0,solar:[],solar_energetic_particl:0,solar_flar:0,sort:0,spacerock:0,span:0,specfic:0,specif:0,specifi:0,speed:0,spirit:0,spk:0,srt:0,sstr:0,stai:0,standard:0,start:0,start_dat:0,step:0,stereo:0,stop:0,store:0,storm:0,str:0,stream:0,string:0,subsystem:0,suit:0,summari:0,sun:0,suppli:0,support:0,swrc:0,swrc_catalog:0,system:2,systemat:0,take:0,taken:0,target:0,tde:0,team:0,technolog:0,telescop:0,temporari:0,term:0,than:0,thi:0,thirti:0,those:0,three:0,time:0,titl:0,todai:0,tof_max:0,tof_min:0,tool:0,total:0,transfer:0,transit:0,type:0,uniqu:0,unit:0,unnumb:0,updat:0,upper:0,url:0,used:0,using:0,utc:0,v_inf_max:0,v_inf_min:0,v_rel_max:0,v_rel_min:0,valu:0,vel_comp:0,vel_max:0,vel_min:0,veloc:0,version:[0,1],videograph:0,view:0,webpag:0,webservic:0,well:0,were:0,where:0,wherea:0,which:0,width:0,window:0,winslow_messenger_icme_catalog:0,within:0,without:0,would:0,wrap:2,wsa:0,wsa_enlil_simul:0,xml:0,year:0,year_end:0,year_start:0,yyyi:0},titles:["API Reference","Contents","Version History"],titleterms:{Near:0,api:0,astronomi:0,camera:0,center:0,cneo:0,content:1,dai:0,data:0,databas:0,donki:0,dynam:0,earth:0,element:0,epic:0,genelab:0,histori:2,imag:0,imageri:0,inform:0,insight:0,knowledg:0,librari:0,line:0,mar:0,method:0,nasa:0,notif:0,object:0,other:0,photo:0,pictur:0,polychromat:0,refer:0,rover:0,satellit:0,search:0,set:0,solar:0,space:0,ssd:0,studi:0,system:0,techport:0,tle:0,two:0,version:2,video:0,weather:0,wrapper:0}}) \ No newline at end of file +Search.setIndex({docnames:["api","index","versions"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:55},filenames:["api.rst","index.rst","versions.rst"],objects:{"":{Nasa:[0,0,1,""],close_approach:[0,1,1,""],fireballs:[0,1,1,""],julian_date:[0,1,1,""],media_asset_captions:[0,1,1,""],media_asset_manifest:[0,1,1,""],media_asset_metadata:[0,1,1,""],media_search:[0,1,1,""],mission_design:[0,1,1,""],nhats:[0,1,1,""],scout:[0,1,1,""],sentry:[0,1,1,""],tle:[0,1,1,""]},Nasa:{asteroid_feed:[0,1,1,""],coronal_mass_ejection:[0,1,1,""],earth_assets:[0,1,1,""],earth_imagery:[0,1,1,""],epic:[0,1,1,""],genelab_search:[0,1,1,""],geomagnetic_storm:[0,1,1,""],get_asteroids:[0,1,1,""],hight_speed_stream:[0,1,1,""],interplantary_shock:[0,1,1,""],magnetopause_crossing:[0,1,1,""],mars_rover:[0,1,1,""],mars_weather:[0,1,1,""],picture_of_the_day:[0,1,1,""],radiation_belt_enhancement:[0,1,1,""],solar_energetic_particle:[0,1,1,""],solar_flare:[0,1,1,""],techport:[0,1,1,""],wsa_enlil_simulation:[0,1,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"]},objtypes:{"0":"py:class","1":"py:method"},terms:{"01au":0,"05ld":0,"1000th":1,"100th":0,"2048x2048":0,"2_09":0,"2au":0,"boolean":0,"case":0,"class":[0,1],"default":0,"export":0,"float":0,"function":[0,2],"new":0,"return":[0,1],"true":[0,1],"while":[0,1],AND:0,Added:2,For:0,NOT:0,Near:2,The:[0,1],Using:1,Will:0,absolut:0,accept:0,access:0,accur:0,accurate_onli:0,activ:0,add:0,advanc:0,after:[0,1],align:0,all:[0,1],allow:1,also:[0,1],alt_max:0,alt_min:0,altern:0,although:1,altitud:0,analysi:0,angl:0,ani:[0,1],anl:0,annot:0,anomali:0,apertur:0,api:2,apollo:[0,1],approach:[0,1],approeach:0,appropri:0,approxim:0,april:[0,1],arc:0,argonn:0,as11:0,asc:0,ascend:0,aschleg:1,assess:2,asset:[0,1],associ:0,assum:1,asteroid:0,asteroid_fe:[0,1],asteroid_id:[0,1],astronom:0,astrononmi:0,atmospher:0,attribut:1,audio:0,avail:0,base:0,been:0,begin:[0,1],begin_d:[0,1],belt:[0,1],between:0,bioinformat:0,biotechnolog:0,bodi:0,both:0,bright:0,brighter:0,burn:0,calcul:[0,1],calendar:0,can:[0,1],caption:0,captur:0,cassegrain:0,catalog:0,caus:0,ccd:0,celestrak:0,center:[],cere:0,certain:0,cgene:[0,1],charg:0,chemcam:0,choos:1,chronicl:0,chronolog:0,clone:1,close:0,close_approach:0,closest:0,cloud:[0,1],cloud_scor:[0,1],cme:[0,1],cneo:2,code:0,collect:0,color:0,column:0,com:1,combin:0,comet:0,comma:0,commun:0,compar:1,complet:0,complete_data:0,complete_entri:0,compon:0,comprehens:0,comput:[0,1],condit:0,conjunct:0,connect:0,contain:0,content:0,convert:0,coron:[0,1],coronal_mass_eject:[0,1],correspond:0,count:0,coupl:0,cover:0,criteria:0,cross:[0,1],curios:0,current:[0,1],daili:0,data:2,data_fil:0,dataset:0,date:0,date_max:0,date_min:0,datetim:[0,1],ddthh:0,dec:0,decemb:0,defin:0,definit:[0,1],degre:0,delimit:0,delta:0,delta_v:0,demo:[0,1],demo_kei:0,denot:0,des:0,desc:0,descend:0,descript:[0,1],design:0,desir:0,destin:0,detector:0,determin:0,devic:0,diamet:0,dict:0,dictionari:0,digit:0,dim:0,directli:0,disc:0,discoveri:0,dist:0,dist_max:0,dist_min:0,distanc:0,distribut:0,document:0,doe:1,done:0,download:[0,1],dscovr:0,durat:0,each:0,earlier:0,earlieset:0,earth:2,earth_asset:[0,1],earth_dat:0,earth_imageri:[0,1],easili:1,ebi:0,ebi_prid:0,effect:0,either:0,eject:[0,1],empti:0,encod:0,end:0,end_dat:[0,1],endpoint:0,energet:[0,1],energi:0,energy_max:0,energy_min:0,enhanc:[0,1],enlil:1,entir:[0,1],eph_start:0,eph_step:0,eph_stop:0,ephemeri:0,equal:0,equat:0,ero:0,estim:0,european:0,evalu:0,event:[0,1],everi:0,exact:0,exampl:0,exclud:0,exist:0,explor:0,express:0,fals:[0,1],ffield:0,fhaz:0,field:0,file:[0,1],filter:0,find:[0,1],firebal:0,first:[0,1],flag:0,flare:[0,1],flight:0,follow:[0,1],font:0,forecast:0,format:0,four:0,fov_dec:0,fov_diam:0,fov_ra:0,fov_vmag:0,frac:0,from:0,front:0,full:0,fullnam:0,fvalu:0,gene:[0,1],genelab_search:[0,1],gener:0,geo:0,geomagnet:[0,1],geomagnetic_storm:[0,1],get:0,get_asteroid:[0,1],git:1,github:1,given:0,good:1,gov:0,greater:0,h_max:0,h_min:0,half:0,half_angl:0,happen:1,has:[0,1],have:0,health:0,height:0,high:[0,1],higher:1,hight:[0,1],hight_speed_stream:[0,1],histori:1,hour:[0,1],http:0,human:0,iau:0,identif:0,imag:[],impact:[0,2],impact_e_max:0,impact_e_min:0,includ:[0,1],infin:0,initi:[0,1,2],insensit:0,instead:0,institut:0,instrument:0,intellig:0,interact:[0,1],interfac:0,interplantari:0,interplantary_shock:0,interpret:0,invalid:0,ip_min:0,item:[0,1],its:0,jang_et_al_catalog:0,januari:0,jet:0,joul:0,jpl:0,json:0,julian:0,julian_d:[0,1],kei:[0,1],keyword:0,kiloton:0,kind:0,known:0,laboratori:0,lagrang:0,land:[0,1],lander:0,landsat:0,larg:0,last:[0,1],last_obs_dai:0,last_upd:0,lat:[0,1],later:0,latitud:0,launch:0,lead:0,least:0,less:0,letter:0,librari:1,limit:[0,1],limit_remain:1,line:[],linkag:0,list:0,liver:[0,1],locat:[0,1],lon:[0,1],longer:0,longitud:0,lower:0,lunar:0,machin:0,mag:0,magnetopaus:[0,1],magnetopause_cross:[0,1],magnitud:0,mahli:0,mai:[0,1],maintain:0,make:0,mani:1,manifest:0,map:0,mardi:0,mars_rov:[0,1],mars_weath:[0,1],martian:[0,1],mass:[0,1],massless:0,mast:0,match:0,maximum:0,media:[0,1],media_asset_capt:0,media_asset_manifest:0,media_asset_metadata:0,media_search:[0,1],media_typ:0,messeng:0,metadata:0,metagenom:0,method:1,mg_rast:0,midnight:[0,1],minimum:0,minit:0,minut:0,mission:0,mission_design:0,mjd0:0,model:0,modifi:0,monospac:0,month:0,moon:[0,1],more:0,most:[0,1],mous:[0,1],mpc:0,much:0,multipl:0,must:0,n_orbit:0,name:0,nasa_id:0,nasapi:0,nation:0,natur:0,navcam:0,ncbi:0,nea:0,nea_comet:0,neg:0,neo:0,nhat:0,nih:0,nih_geo_gs:0,nomin:0,non:[0,1],none:0,note:0,now:0,number:[0,1],object:2,obs_cod:0,observ:0,observatori:0,occ:0,omnibu:0,onc:0,one:[0,1],onli:0,oper:0,opportun:0,option:[0,1],orbit:0,orbit_class:0,orbit_condition_cod:0,orbit_id:0,order:0,other:[],otherwis:0,output:0,over:0,overal:0,p20uvyk:0,page:0,pair:0,palermo:0,pancam:0,paramet:[0,1],pars:0,particl:[0,1],particular:0,pass:[0,1],peak:0,per:[0,1],percentag:0,perform:[0,1],period:0,perspect:0,pha:0,photograph:0,picture_of_the_dai:[0,1],pip:1,pixel:0,pleas:0,plot:0,plot_base64:0,point:0,posit:0,prepend:0,previou:[0,1],pride:0,primari:0,print:[0,1],prior:0,probabl:0,project:0,project_id:0,propos:0,propuls:0,proteom:0,provid:[0,1,2],provision:0,ps_min:0,publish:0,python:[0,1],queri:[0,1],quick:1,radiat:[0,1],radiation_belt_enhanc:[0,1],rang:0,rapid:0,rast:0,rather:1,readabl:0,recalcul:0,receiv:[0,1],recent:[0,1],recommend:1,record:0,refer:1,regist:0,rel:0,relat:[0,1],relationship:0,releas:2,remov:0,repreent:[],repres:0,req_alt:0,req_loc:0,req_vel:0,req_vel_comp:0,request:0,requir:[0,1],research:0,resolut:0,resourc:0,respons:0,restrict:0,result:[0,1],retriev:[0,1],return_format:0,revers:0,rhaz:0,risk:2,rotat:0,sampl:0,satellit:1,satellite_numb:[0,1],scale:0,scienc:0,scientist:0,score:[0,1],scout:0,search:[],search_satellit:0,second:0,secondari:0,secondary_cr:0,see:[0,1],select:0,sentri:[0,2],separ:0,septemb:[0,1],serv:0,set:[],setup:1,seven:[0,1],sg344:0,shock:0,should:0,sigma:0,sign:1,significantli:1,simul:[0,1],sinc:0,sixteen:0,size:0,small:0,sol:[0,1],solar:1,solar_energetic_particl:[0,1],solar_flar:[0,1],some:1,sort:0,spacerock:0,span:0,specfic:0,specif:[0,1],specifi:0,speed:[0,1],spirit:0,spk:0,srt:0,sstr:0,stai:0,standard:0,start:[0,1],start_dat:[0,1],step:0,stereo:0,stop:0,store:0,storm:[0,1],str:0,stream:[0,1],strictli:1,string:0,studi:1,subsystem:0,suit:0,summari:0,sun:0,suppli:0,support:0,swrc:0,swrc_catalog:0,system:2,systemat:0,t_sigma_f:0,tabl:0,take:0,taken:0,target:0,tde:0,team:0,technolog:0,telescop:0,temporari:0,term:[0,1],than:[0,1],thi:0,thirti:[0,1],those:[0,1],three:0,time:[0,1],titl:0,tle:1,todai:[0,1],tof_max:0,tof_min:0,tool:0,total:0,transfer:0,transit:0,type:0,typic:1,uncertainti:0,uniqu:0,unit:0,unnumb:0,updat:0,upper:0,url:[0,1],use:1,used:0,using:[0,1],utc:0,v_inf:0,v_inf_max:0,v_inf_min:0,v_rel:0,v_rel_max:0,v_rel_min:0,valu:0,vel_comp:0,vel_max:0,vel_min:0,veloc:0,version:[0,1],videograph:0,view:[0,1],webpag:0,webservic:0,well:0,were:0,when:1,where:0,wherea:0,which:0,width:0,window:0,winslow_messenger_icme_catalog:0,within:0,without:0,would:0,wrap:2,wrapper:1,wsa:[0,1],wsa_enlil_simul:[0,1],xml:0,year:[0,1],year_end:0,year_start:0,your:1,yyyi:0,zero:0},titles:["API Reference","Nasapy Documentation","Version History"],titleterms:{Near:0,access:1,api:[0,1],asteroid:1,astronomi:[0,1],audio:1,authent:1,avail:1,bioinformat:1,camera:[0,1],celestrak:1,center:0,cneo:0,collect:1,content:1,curios:1,dai:[0,1],data:[0,1],databas:[0,1],date:1,discoveri:1,document:1,donki:[0,1],dscovr:1,dynam:0,earth:[0,1],element:[0,1],epic:[0,1],exampl:1,feed:1,from:1,genelab:[0,1],get:1,given:1,gov:1,histori:2,imag:[0,1],imageri:[0,1],inform:[0,1],insight:0,instal:1,julian:1,knowledg:[0,1],landsat:1,latitud:1,librari:0,line:[0,1],longitud:1,mar:[0,1],method:0,modifi:1,nasa:[0,1],nasapi:1,notif:[0,1],object:0,other:[0,1],photo:0,pictur:[0,1],polychromat:[0,1],record:1,refer:0,remain:1,request:1,rover:[0,1],satellit:0,search:[0,1],set:[0,1],solar:0,space:[0,1],spirit:1,ssd:0,studi:0,system:0,techport:0,tle:0,two:[0,1],usag:1,version:2,video:0,weather:[0,1],wrapper:0}}) \ No newline at end of file diff --git a/docs/source/api.rst b/docs/source/api.rst index da411ba..e5ff1d8 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -11,7 +11,7 @@ API Reference Class object containing the methods for interacting with NASA API endpoints that require an API key. - :param key: The generated API key received from the NASA API. Registering for an API key can be done on the `NASA API webpage `_. If :code:`None`, a 'DEMO_KEY' with a much more restricted access limited is used. + :param key: The generated API key received from the NASA API. Registering for an API key can be done on the `NASA API webpage `_. If :code:`None`, a 'DEMO_KEY' with a much more restricted access limit is used. Astronomy Picture of the Day ++++++++++++++++++++++++++++ @@ -473,6 +473,26 @@ and `Center for Near-Earth Object Studies `_ APIs. # Get close-approach data for asteroid 433 Eros within 0.2AU from the years 1900 to 2100. >>> nasapy.close_approach(des='433', date_min='1900-01-01', date_max='2100-01-01', dist_max=0.2) + Each close-approach record is a list containing the following fields in the corresponding order: + + * des - primary designation of the asteroid or comet (e.g., 443, 2000 SG344) + * orbit_id - orbit ID + * jd - time of close-approach (JD Ephemeris Time) + * cd - time of close-approeach (formatted calendar date/time) + * dist - nominal approach distance (au) + * dist_min - minimum (3-sigma) approach distance (au) + * dist_max - maximum (3-sigma) approach distance (au) + * v_rel - velocity relative to the approach body at close approach (km/s) + * v_inf - velocity relative to a massless body (km/s) + * t_sigma_f - 3-sigma uncertainty in the time of close-approach (formatted in days, hours, and minutes; days are not included if zero; example “13:02” is 13 hours 2 minutes; example “2_09:08” is 2 days 9 hours 8 minutes) + * body - name of the close-approach body (e.g., Earth) + + - only output if the body query parameters is set to ALL + * h - absolute magnitude H (mag) + * fullname - formatted full-name/designation of the asteroid or comet + + - optional - only output if requested with the appropriate query flag + - formatted with leading spaces for column alignment in monospaced font tables .. method:: fireballs([date_min=None][, date_max=None][, energy_min=None][, energy_max=None][, impact_e_min=None][, impact_e_max=None][, vel_min=None][, vel_max=None][, alt_min=None][, alt_max=None][, req_loc=False][, req_alt=False][, req_vel=False][, req_vel_comp=False][, vel_comp=False][, sort='date'][, limit=None]) diff --git a/docs/source/index.rst b/docs/source/index.rst index 01d6d47..b3b8a33 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,5 +1,8 @@ +Nasapy Documentation +==================== +:code:`nasapy` is a Python wrapper for the `nasa.gov API `_. Contents ======== @@ -8,4 +11,213 @@ Contents :maxdepth: 1 api.rst - versions.rst \ No newline at end of file + versions.rst + +Installation +============ + +:code:`nasapy` is most easily installed using :code:`pip`. + +.. code-block:: console + + pip install nasapy + +The library can also be cloned or downloaded into a location of your choosing and then installed using the `setup.py` +file per the following: + +.. code-block:: console + + git clone git@github.com:aschleg/nasapy.git + cd nasapy + python setup.py install + +Examples and Usage +================== + +Although not strictly required to begin interacting with the NASA API, it is recommended to sign up +to receive an `API access key `_ that has a significantly higher usage limit available compared +to the demo key option. Many methods do not require an API key, but for those that do, it is typically a good option to +use a provided API key rather than the demo key. Using a received API key allows for 1,000 requests per hour, while the +demo key has 30 requests limit per hour and 50 requests per day. + +Authentication +-------------- + +Assuming an API key was received after signing up, authentication to the NASA API happens when initializing the +:code:`Nasa` class. + +.. code-block:: python + + nasa = Nasa(key=key) + +If using a demo key, the initialization does not require any parameters to be passed. + +.. code-block:: python + + nasa = Nasa() + +Remaining Requests Available +---------------------------- + +The :code:`limit_remaining` attribute of the initialized :code:`Nasa` class allows one to see the number of available +requests remaining. + +.. code-block:: python + + nasa.limit_remaining + +Examples +-------- + +The following are some quick examples to get started. + +Astronomy Picture of the Day +++++++++++++++++++++++++++++ + +.. code-block:: python + + # Return today's picture of the day + nasa.picture_of_the_day() + # Return a previous date's picture of the day with the high-definition URL included. + nasa.picture_of_the_day('2019-01-01', hd=True) + +Mars Weather +++++++++++++ + +.. code-block:: python + + # Return the most recent data for the previous seven Sols (Martian Days) + nasa.mars_weather() + +Asteroid Feed ++++++++++++++ + +.. code-block:: python + + # Get asteroids approaching Earth at the beginning of 2019. + nasa.asteroid_feed(start_date='2019-01-01') + +Get Asteroid Data ++++++++++++++++++ + +.. code-block:: python + + # Get entire asteroid data set. + nasa.get_asteroids() + # Get asteroid with ID 3542519 + nasa.get_asteroids(asteroid_id=3542519) + +DONKI (Space Weather Database of Notifications, Knowledge and Information) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Coronal Mass Ejection Event Data + + # View data from coronal mass ejection events from the last thirty days + nasa.coronal_mass_ejection() + # View all CME events from the beginning of 2019. + nasa.coronal_mass_ejection(start_date='2019-01-01', end_date=datetime.datetime.today()) + + # Geomagnetic Storm Event Data + + # Get geomagnetic storm events from the last thirty days. + nasa.geomagnetic_storm() + + # Solar Flare Event Data + + # Get solar flare events from May of 2019 + nasa.solar_flare(start_date='2019-05-01', end_date='2019-05-31') + + # Solar Energetic Particle Data + + # Get data from April 2017 + nasa.solar_energetic_particle(start_date='2017-04-01', end_date='2017-04-30') + + # Magnetopause Crossing Data + + # Get data on magnetopause crossing events from 2018 to the current date. + nasa.magnetopause_crossing(start_date='2018-01-01') + + # Radiation Belt Enhancement Data + + # Get data on radiation belt enhancement events from the last 30 days. + nasa.radiation_belt_enhancement() + + # Hight Speed Stream Data + + # Get data on hight speed stream events from the beginning of September 2019. + nasa.hight_speed_stream() + + # WSA Enlil-Simulation Data + + # Get data from the first simulation performed in 2019. + wsa = n.wsa_enlil_simulation(start_date='2019-01-01') + wsa[0] + +EPIC (DSCOVR's Earth Polychromatic Imaging Camera) +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Get EPIC data from the beginning of 2019. + e = nasa.epic(date='2019-01-01') + # Print the first result + e[0] + +Landsat Images for a given Latitude-Longitude ++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Get imagery at latitude 1.5, longitude 100.75 and include the computed cloud score calculation. + nasa.earth_imagery(lon=100.75, lat=1.5, cloud_score=True) + + # Get assets available beginning from 2014-02-01 at lat-lon 100.75, 1.5 + nasa.earth_assets(lat=100.75, lon=1.5, begin_date='2014-02-01') + +Available Image data collected by the Mars rovers Curiosity, Discovery and Spirit. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Return image data collected on Curiosity's 1000th sol. + nasa.mars_rover(sol=1000) + +Access GeneLab and Other Bioinformatics Databases ++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Find Gene studies in the cgene database related to 'mouse liver' + n.genelab_search(term='mouse liver') + +CelesTrak Two-Line Element Set Records +++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Retrieve available data for a specific satellite ID. + tle(satellite_number=43553) + +Search for Available Imagery and Audio from the images.nasa.gov API ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Search for media related to 'apollo 11' with 'moon landing' in the description of the items. + r = media_search(query='apollo 11', description='moon landing') + # Print the first returned media item from the resulting collection. + r['items'][0] + +Getting the Julian and Modified Julian Date ++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: python + + # Return the modified Julian Date for the current time. + julian_date() + # Return the non-modified Julian Date for the current time. + julian_date(modified=False) + # Get the modified Julian Date for 2019-01-01 at midnight. + julian_date(year=2019) diff --git a/nasapy/api.py b/nasapy/api.py index 1a560f5..9b007b4 100644 --- a/nasapy/api.py +++ b/nasapy/api.py @@ -19,7 +19,7 @@ class Nasa(object): ---------- key : str, default None The generated API key received from the NASA API. Registering for an API key can be done on the `NASA API - webpage `_. If :code:`None`, a 'DEMO_KEY' with a much more restricted access limited + webpage `_. If :code:`None`, a 'DEMO_KEY' with a much more restricted access limit is used. Attributes @@ -1886,9 +1886,32 @@ def close_approach(date_min='now', date_max='+60', dist_min=None, dist_max='0.05 Examples -------- # Get all close-approach object data in the year 2019 with a maximum approach distance of 0.01AU. - >>> nasapy.close_approach(date_min='2019-01-01', date_max='2019-12-31', dist_max=0.01) + >>> close_approach(date_min='2019-01-01', date_max='2019-12-31', dist_max=0.01) # Get close-approach data for asteroid 433 Eros within 0.2AU from the years 1900 to 2100. - >>> nasapy.close_approach(des='433', date_min='1900-01-01', date_max='2100-01-01', dist_max=0.2) + >>> close_approach(des='433', date_min='1900-01-01', date_max='2100-01-01', dist_max=0.2) + + Notes + ----- + Each close-approach record is a list containing the following fields in the corresponding order: + + * des - primary designation of the asteroid or comet (e.g., 443, 2000 SG344) + * orbit_id - orbit ID + * jd - time of close-approach (JD Ephemeris Time) + * cd - time of close-approeach (formatted calendar date/time) + * dist - nominal approach distance (au) + * dist_min - minimum (3-sigma) approach distance (au) + * dist_max - maximum (3-sigma) approach distance (au) + * v_rel - velocity relative to the approach body at close approach (km/s) + * v_inf - velocity relative to a massless body (km/s) + * t_sigma_f - 3-sigma uncertainty in the time of close-approach (formatted in days, hours, and minutes; + days are not included if zero; example “13:02” is 13 hours 2 minutes; example “2_09:08” is 2 days 9 hours 8 + minutes) + * body - name of the close-approach body (e.g., Earth) + * only output if the body query parameters is set to ALL + * h - absolute magnitude H (mag) + * fullname - formatted full-name/designation of the asteroid or comet + * optional - only output if requested with the appropriate query flag + * formatted with leading spaces for column alignment in monospaced font tables """ url = 'https://ssd-api.jpl.nasa.gov/cad.api' @@ -2060,6 +2083,39 @@ def fireballs(date_min=None, date_max=None, energy_min=None, energy_max=None, im # Get data from the beginning of 2019 >>> nasapy.fireballs(date_min='2019-01-01') + Notes + ----- + Each returned record is provided as an element of the object and each record is a list of fields corresponding to + the fields below. The names of each field contained in the returned results in each record can also be found in the + 'fields' key of the returned dictionary. + + * date - date/time of peak brightness (GMT) + * lat - latitude at peak brightness (degrees) + * lon - longitude at peak brightness (degrees) + * lat-dir - latitude direction (“N” or “S”) + * lon-dir - latitude direction (“E” or “W”) + * alt - altitude above the geoid at peak brightness (km) + * vel - velocity at peak brightness (km/s) + * energy - approximate total radiated energy (1010 joules) + * impact-e - approximate total impact energy (kt) + * vx - pre-entry estimated velocity (Earth centered X component, km/s) + * vy - pre-entry est. velocity (Earth centered Y component, km/s) + * vz - pre-entry est. velocity (Earth centered Z component, km/s) + + Note that many fields can be undefined (null) in a particular data record. The only fields which are guaranteed + to be defined are `date`, `energy`, and `impact-e`. Where the location is known, all four related fields + (`lat`, `lat-dir`, `lon`, and `lon-dir`) are defined. Where the location is not known (reported), all four location + fields will be null. + + The date is reported as a string in `YYYY-MM-DD hh:mm:ss` format. Both `lat` and `lon` are reported as strings in + decimal degrees. The `lat-dir` field will be either N or S (or null). Similarly, the `lon-dir` field will be either + E or W (or null). The `alt` field is reported as a string in decimal km and is referenced to the Earth geoid. The + `vel` field is reported as a string in decimal km/s. Total radiated energy is reported in the `energy` field as a + string in decimal joules × 1010 (for example, a reported value of 3.6 is 3.6 × 1010 joules). Impact energy is + reported in the `impact-e` field in units of kilotons (kt). + + All fields are relative to the fireball’s peak-brightness event. + """ url = 'https://ssd-api.jpl.nasa.gov/fireball.api'