11 for file_path
in sys
.argv
[1:-1]:
13 print('Reading NetCDF file',file_path
)
14 ds
= xr
.open_dataset(file_path
)
17 pm25_vars
.append(ds
["tr17_1"].isel(bottom_top
=0))
19 # Get the other variables, Times, longitude, latitude
20 times_vars
.append(ds
["Times"])
21 lon_vars
.append(ds
["XLONG"])
22 lat_vars
.append(ds
["XLAT"])
24 print('Concatenating the data variables along the time dimension')
26 pm25
= xr
.concat(pm25_vars
, dim
="Time")
28 times
= xr
.concat(times_vars
, dim
="Time")
30 lon
= xr
.concat(lon_vars
, dim
="Time")
32 lat
= xr
.concat(lat_vars
, dim
="Time")
34 del pm25_vars
, times_vars
, lon_vars
, lat_vars
36 ds_new
= xr
.Dataset({'pm25':pm25
,'Times':times
,'XLONG':lon
,'XLAT':lat
})
38 print('Creating new NetCDF file',new
)