-
Notifications
You must be signed in to change notification settings - Fork 2
/
mvn_kp_download_template_file.pro
54 lines (47 loc) · 2.08 KB
/
mvn_kp_download_template_file.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;+
; :Name: mvn_kp_download_template_file
;
; Copyright 2017 Regents of the University of Colorado. All Rights Reserved.
; Released under the MIT license.
; This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
; Verify current version before use at: https://lasp.colorado.edu/maven/sdc/public/pages/software.html
; :Author: Bryan Harter
;
;
; :Description:
; Download KP data template file from the SDC into
; toolkit installation directory.
;
pro mvn_kp_download_template_file
;; Get MAVEN Science Data Center connection information
spec = mvn_kp_config(/template_file_location)
;; Get location to safe file locally
install_result = routine_info('mvn_kp_download_template_file',/source)
install_directory = strsplit(install_result.path,'mvn_kp_download_template_file.pro',/extract,/regex)
if !version.os_family eq 'unix' then begin
install_directory = install_directory+'read_lib/'
endif else begin
install_directory = install_directory+'read_lib\'
endelse
;; Get connection & execute GET query for template file list
netURL = mvn_kp_get_temp_connection(spec.host, spec.port, spec.username, spec.password, spec.url_scheme, spec.authentication)
file_names = mvn_kp_execute_neturl_query(netURL, spec.url_path+'/TemplateList', '', /not_sdc_connection)
if size(file_names, /TYPE) ne 7 then begin
print, "Problem downloading template file."
print, "If not connected to the internet, then this is to be expected"
return
endif
for i = 0,n_elements(file_names)-1 do begin
file_and_path = install_directory[0] + file_names[i]
return_value = mvn_kp_execute_neturl_query(netURL, spec.url_path+'/'+file_names[i], '', filename=file_and_path, /not_sdc_connection)
endfor
if size(return_value, /TYPE) ne 7 then begin
print, "Problem downloading template file."
print, "If not connected to the internet, then this is to be expected"
endif else begin
print, "Downloaded updated version of template files: "
for i=0,n_elements(file_names)-1 do begin
print, file_names[i]
endfor
endelse
end