-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLv0_scp.py
44 lines (33 loc) · 1.33 KB
/
Lv0_scp.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon May 27 10:17am 2019
Program for scp (secure copy protocol) - to copy files from ciri onto the hard drive
"""
from __future__ import division, print_function
import numpy as np
import Lv0_dirs
import os
import subprocess
Lv0_dirs.global_par()
def scp(obsid):
"""
To securely copy the files from ciri onto /Volumes/Samsung_T5/NICER-data/
obsid - Observation ID of the object of interest (10-digit str)
"""
if type(obsid) != str:
raise TypeError("ObsID should be a string!")
obsid_dir = '[email protected]:/nfs/ciri/nicer/decrypted/' + obsid
nicer_dir = Lv0_dirs.NICER_DATADIR
if os.path.isdir(nicer_dir+obsid): #to prevent duplicate files ; not likely to be the case, but just in case...
subprocess.run(['rm','-r',nicer_dir+obsid])
subprocess.run(['scp','-r',obsid_dir,nicer_dir])
subprocess.run(['rm','-r',nicer_dir + obsid + '/auxil/ni' + str(obsid) + '.cat'])
return
if __name__ == "__main__":
#obsids = ['203420020' + str(i) for i in range(1,6)] + ['103419010' + str(i) for i in range(1,5)] + ['1034200' + str(i) for i in range(201,241)]
obsids = ['201001023' + str(i) for i in range(6,7)]
for i in range(len(obsids)):
scp(obsids[i])
##### for i in range(11,25):
## scp('10600601' + str(i)) WORKED.