'creating a new dataset from large datset xarray

I have a large dataset, with hourly data for an entire year. What I want to do is to create a new dataset with specific variables at sepcific distances from a point source and use all the data to create a box and wiskers plot.

The dataset has time, lon and lat and a concentration variable with multiple dimensions: Concentration[hours,lat, lon]

I want to create a dataset that loops through all of the times for different lat and lon and produce a concentration output for all time at each of these different locations, to then use it to create a box and wisker plot and to show the decreace of atmospheric concetration from a point source. I know the specific grids I am interested in but need help setting up the script.

EDIT:

I cropped the Global dataset and this is what the output currently looks like: time: (8761), latitude: (30), longitude: (30)

I tried using a for loop, but it would not allow me to loop over lat/lon...

for i in range(8761):
   print(Conc[i,:,:])

This lets me loop over all times and see the conc at all grids, but I want to instead of printing create a new ds, and also only loop through certains grids..

I wants a list that provides me 8761 concentrations values for each grid that I specify, and to keep all the data in one dataset so I can make a Box plot from this...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source