Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I made for loop of my data array of each long/lat point and I appended all result in one list as below :

out_list=[]
for i in ds.longitude.values:
    for j in ds.latitude.values:
        point = arr.sel(longitude=i,latitude=j)
        
        p_detrend = sm.tsa.tsatools.detrend(point, order=1,axis=0)
        out_list.append(p_detrend)

and my list as below : enter image description here and you can see there are many arrays and each one has long/lat . How to combine all arrays in one dataset by longitude and latitude ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
203 views
Welcome To Ask or Share your Answers For Others

1 Answer

maybe you could use dictionary instead, something like:

out_list = []

for i in ds.longitude.values:
    for j in ds.latitude.values:
        point = arr.sel(longitude=i,latitude=j)
        p_detrend = sm.tsa.tsatools.detrend(point, order=1,axis=0)

        result = {
            'longitude': i, 
            'latitude': j,
            'detrend_arr': p_detrend  
        }
        out_list.append(result)

then you may use pandas to convert into pd.DataFrame for other manipulation;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...