-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update_backup_gfs_downloader' into main
- Loading branch information
Showing
10 changed files
with
263 additions
and
140 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
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
19 changes: 19 additions & 0 deletions
19
flash_flood_pipeline/data_download/utils/extract_lat_lon.py
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,19 @@ | ||
import numpy as np | ||
|
||
|
||
def extract_lat_lon(ds): | ||
""" | ||
Create 2D arrays with latitudes and longitudes from netCDF dataset variables. | ||
ds - netCDF dataset | ||
Returns latvar, lonvar | ||
""" | ||
latvar = ds.variables["lat"][:] | ||
lat_dim = len(latvar) | ||
|
||
lonvar = ds.variables["lon"][:] | ||
lon_dim = len(lonvar) | ||
|
||
latvar = np.stack([latvar for _ in range(lon_dim)], axis=0) | ||
lonvar = np.stack([lonvar for _ in range(lat_dim)], axis=1) | ||
return latvar, lonvar |
Oops, something went wrong.