Skip to content

Commit

Permalink
Revert "Updated gfs2 and hrrr3 class"
Browse files Browse the repository at this point in the history
  • Loading branch information
cuill authored Jan 12, 2024
1 parent ac3bcfc commit 3ee787e
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 557 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: 9 additions & 15 deletions examples/Sflux/gen_sflux_gfs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
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 @@ -23,19 +20,16 @@
logging.getLogger('pyschism').setLevel(log_level)

if __name__ == "__main__":

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

#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')
pscr = '/sciclone/pscr/lcui01/GFS/'
rnday = 5
record = 1

hgrid = Hgrid.open('../../static/hgrid.gr3', crs='epsg:4326')
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')

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')
30 changes: 6 additions & 24 deletions examples/Sflux/gen_sflux_hrrr3.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
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 @@ -22,24 +17,11 @@

if __name__ == "__main__":
t0 = time()

#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)

rnday = 1
record = 1
startdate = nearest_cycle()
hgrid = Hgrid.open('../../static/hgrid.gr3', crs='epsg:4326')

pscr='/sciclone/pscr/lcui01/HRRR/'
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!')
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')
Loading

0 comments on commit 3ee787e

Please sign in to comment.