Skip to content

Commit

Permalink
Merge pull request #114 from schism-dev/feature/hrrr3
Browse files Browse the repository at this point in the history
Updated gfs2 and hrrr3 class
  • Loading branch information
cuill authored Jan 12, 2024
2 parents 7565c6f + fa75669 commit ac3bcfc
Show file tree
Hide file tree
Showing 6 changed files with 557 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.x' ]
python-version: ['3.8', '3.9', '3.x' ]
steps:
- name: checkout repository
uses: actions/checkout@v2
Expand Down
24 changes: 15 additions & 9 deletions examples/Sflux/gen_sflux_gfs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
from time import time
import multiprocessing as mp
import logging
import pathlib

import numpy as np
import pandas as pd
from matplotlib.transforms import Bbox

from pyschism.mesh.hgrid import Hgrid
from pyschism.forcing.nws.nws2.gfs2 import GFS
from pyschism.dates import nearest_cycle


logging.basicConfig(
format="[%(asctime)s] %(name)s %(levelname)s: %(message)s",
force=True,
Expand All @@ -20,16 +23,19 @@
logging.getLogger('pyschism').setLevel(log_level)

if __name__ == "__main__":

t0 = time()
startdate = datetime(2021, 10, 13)

pscr = '/sciclone/pscr/lcui01/GFS/'
rnday = 5
record = 1
#now = datetime.now()
#last_cycle = np.datetime64(pd.DatetimeIndex([now-timedelta(hours=2)]).floor('6H').values[0], 'h').tolist()
#start = (last_cycle - timedelta(days=1)).replace(hour=0)
start = datetime(2023, 10, 1)
rnday = 10
#record = 5
#outdir = path = pathlib.Path('./GFS_2023')

hgrid = Hgrid.open('../../static/hgrid.gr3', crs='epsg:4326')

gfs = GFS(start_date=startdate, rnday=rnday, pscr=pscr, record=record, bbox=hgrid.bbox)

print(f'It took {(time()-t0)/60} mins to process {rnday} days, {record*24} records/day')
pscr = '/sciclone/pscr/lcui01/GFS/'
gfs = GFS(level=1, pscr=pscr, bbox=hgrid.bbox)
gfs.write(start_date=start, rnday=rnday, air=True, prc=True, rad=True)

print(f'It took {(time()-t0)/60} mins to process {rnday} days')
30 changes: 24 additions & 6 deletions examples/Sflux/gen_sflux_hrrr3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from datetime import datetime, timedelta
from time import time
import logging
import pathlib

import numpy as np
import pandas as pd
from matplotlib.transforms import Bbox

from pyschism.mesh.hgrid import Hgrid
from pyschism.forcing.nws.nws2.hrrr3 import HRRR
Expand All @@ -17,11 +22,24 @@

if __name__ == "__main__":
t0 = time()
rnday = 1
record = 1
startdate = nearest_cycle()
hgrid = Hgrid.open('../../static/hgrid.gr3', crs='epsg:4326')

#now = datetime.now()
#last_cycle = np.datetime64(pd.DatetimeIndex([now-timedelta(hours=2)]).floor('6H').values[0], 'h').tolist()
#print(last_cycle)

#start = (last_cycle - timedelta(days=1)).replace(hour=0)
#end = last_cycle + timedelta(days=2)

#rndelta = end -start
#rnday = rndelta.total_seconds() / 86400.
start = datetime(2023, 10, 26)
rnday = 2
hgrid = Hgrid.open('./hgrid.gr3', crs='epsg:4326')
#outdir = path = pathlib.Path('./HRRR_2017_2')
#bbox = Bbox.from_extents(-162, 60.79, -143, 69.1)


pscr='/sciclone/pscr/lcui01/HRRR/'
hrrr = HRRR(start_date=startdate, rnday=rnday, pscr=pscr, record=record, bbox=hgrid.bbox)
print(f'It took {(time()-t0)/60} mins to process {rnday} days, {record*24} files/day')
hrrr = HRRR(level=2, region='alaska', pscr=pscr, bbox=bbox)
hrrr.write(start_date=start, rnday=rnday, air=True, prc=True, rad=True)
print(f'It took {(time()-t0)/60} mins to process {rnday} days!')
Loading

0 comments on commit ac3bcfc

Please sign in to comment.