Используя datetime, создайте кортеж для получения определенного диапазона значений внутри массива с данными из файла CDF NASA. - PullRequest
0 голосов
/ 08 ноября 2019

Как видно из заголовка, я пытаюсь создать кортеж и использовать его для получения определенного диапазона значений x, y и z из файла CDA NASA. У меня есть объекты datetime для времени начала и окончания, и у меня возникли некоторые проблемы, и обычно я получаю сообщение об ошибке: «не могу сравнить datetime.datetime с var»,

'' '

####These are the arrays for the whole range of x, y and z values in arrays..

x = FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'][0:,0]
y = FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'][0:,1]
z = FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'][0:,2]


###These are the datetime values to be used as interval bounds..
### Filedate & n aren't impoortant, the point is these two datetiem objects will be used...

start_Time = Filedate - datetime.timedelta(hours = n)
end_Time = Filedate - datetime.timedelta(hours = n)

### This is the tuple, it needs to be full of datetime objects that will be used to set bounds
### to get a specific set of x,y and z values...

tloc = (FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'] >= start_Time,
        FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'] <= end_Time)                               


###Here im using the tuple to get the specific x,y and z values

orb_x = FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'][:,0:tloc]
orb_y = FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'][:,1:tloc]
orb_z = FGMdata['sc_pos_xyz_gse__C1_CP_FGM_SPIN'][:,2:tloc]


###Print statement im using to test values...
for x in orb_x:
    print x

'' '

...