Skip to content

Commit

Permalink
make 30 minute batch l2b files
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustinMortier committed Oct 18, 2024
1 parent 3899d07 commit f56b9a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
18 changes: 9 additions & 9 deletions aprofiles/cli/utils/l2b.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def make_files(path_in: Path, path_out: Path, time_steps: int, progress_bar: boo
unique_id = f"{ds.attrs['wigos_station_id']}_{ds.attrs['instrument_id']}"
yyyymmdd = str(ds.time.data[0].astype('M8[D]')).replace('-','')

# we just work with n latest time steps
start_idx = max(0, ds.time.size - time_steps)

for i in range(start_idx, ds.time.size):
ds1t = ds.isel(time=slice(i,i+1))
mmhh = pd.to_datetime(ds1t.time[0].data).strftime('%H%M')
file_name = Path(path_out, f"L2B_{unique_id}{yyyymmdd}{mmhh}.nc")
ds1t.to_netcdf('out.nc')
os.rename('out.nc',file_name)
# we just work with the 6 latest time steps, that is 30 min worth of data
start_idx = max(0, ds.time.size - 6)
ds30min = ds.isel(time=slice(start_idx,ds.time.size))
mmhh = pd.to_datetime(ds30min.time[0].data).strftime('%H%M')

# write output file
file_name = Path(path_out, f"L2B_{unique_id}{yyyymmdd}{mmhh}.nc")
ds30min.to_netcdf('out.tmp')
os.rename('out.tmp',file_name)
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

:material-history:{ style="text-align: center; font-size: xx-large; display: block" }

## 0.10.2
Oct 18, 2024

- make 30 minutes batch L2b files

## 0.10.1
Oct 10, 2024

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aprofiles"
version = "0.10.1"
version = "0.10.2"
description = "Analysis of atmospheric profilers measurements"
authors = ["augustinm <[email protected]>"]
license = "GPL-3.0"
Expand Down

0 comments on commit f56b9a2

Please sign in to comment.