使用日期时间,创建一个元组,以使用来自NASA CDF文件的数据获取数组内特定范围的值

就像标题中所说的那样,我正在尝试创建一个元组,并使用它从NASA CDF文件中获取特定范围的x,y和z值。我有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

'''

shinelqw 回答:使用日期时间,创建一个元组,以使用来自NASA CDF文件的数据获取数组内特定范围的值

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3140529.html

大家都在问