-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from AugustinMortier/0.10.0
0.10.0
- Loading branch information
Showing
10 changed files
with
210 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .utils import config, json_calendar, json_climatology, json_map, workflow | ||
from .utils import config, calendar, climatology, map, l2b, workflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import json_calendar, json_climatology, json_map, config, workflow | ||
from . import calendar, climatology, map, l2b, config, workflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
from glob import glob | ||
|
||
import xarray as xr | ||
import pandas as pd | ||
from rich.progress import track | ||
|
||
def make_files(path_in: Path, path_out: Path, time_steps: int, progress_bar: bool) -> None: | ||
|
||
# list all AP files in path_in | ||
files = list(Path(path_in).glob("AP*nc")) | ||
|
||
for f in track(files, description=f"Reading AP files", disable=not progress_bar): | ||
|
||
ds = xr.open_dataset(f, decode_times=True, chunks=-1) | ||
# get unique id and extract yyyymmdd from first time step | ||
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=i) | ||
mmhh = pd.to_datetime(ds1t.time.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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.