12 for file_path
in sys
.argv
[1:-1]:
14 print('Reading NetCDF file',file_path
)
15 ds
= xr
.open_dataset(file_path
)
18 pm25_vars
.append(ds
["tr17_1"].isel(bottom_top
=0))
20 # Get the other variables, Times, longitude, latitude
21 times_vars
.append(ds
["Times"])
22 lon_vars
.append(ds
["XLAT"])
23 lat_vars
.append(ds
["XLONG"])
25 print('Concatenating the data variables along the time dimension')
26 pm25
= xr
.concat(pm25_vars
, dim
="Time")
27 times
= xr
.concat(times_vars
, dim
="Time")
28 lon
= xr
.concat(lon_vars
, dim
="Time")
29 lat
= xr
.concat(lat_vars
, dim
="Time")
31 del pm25_vars
, times_vars
, lon_vars
, lat_vars
33 ds_new
= xr
.Dataset({'pm25':pm25
,'times':times
,'lon':lon
,'lat':lat
})
35 print('Creating new NetCDF file')