Commit 93f8fec4 authored by Jared Rennie's avatar Jared Rennie
Browse files

AWS version needed to check for scaled vs prelim data

parent 25b2fed6
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
# Import Modules # Import Modules
import numpy as np import numpy as np
import numpy.ma as ma
import s3fs import s3fs
import sys, time, datetime, math, calendar import sys, time, datetime, math, calendar
...@@ -41,6 +40,9 @@ from cartopy.feature import ShapelyFeature ...@@ -41,6 +40,9 @@ from cartopy.feature import ShapelyFeature
from shapely.geometry import mapping from shapely.geometry import mapping
from metpy.plots import USCOUNTIES from metpy.plots import USCOUNTIES
import warnings
warnings.filterwarnings("ignore")
# Declare User Directories # Declare User Directories
main_directory="." main_directory="."
dataset_directory=main_directory+'/input_nclimgrid' dataset_directory=main_directory+'/input_nclimgrid'
...@@ -102,12 +104,21 @@ s3 = s3fs.S3FileSystem(anon=False) ...@@ -102,12 +104,21 @@ s3 = s3fs.S3FileSystem(anon=False)
# Get Specific File Based on Inputs # Get Specific File Based on Inputs
aws_year="%04i" % (int(year)) aws_year="%04i" % (int(year))
aws_month="%02i" % (int(month)) aws_month="%02i" % (int(month))
aws_url='s3://noaa-nclimgrid-daily-pds/beta/by-month/'+aws_year+'/'+aws_month+'/'+element+'-'+aws_year+aws_month+'-grd-prelim.nc' aws_version='prelim'
aws_url='s3://noaa-nclimgrid-daily-pds/beta/by-month/'+aws_year+'/'+aws_month+'/'+element+'-'+aws_year+aws_month+'-grd-'+aws_version+'.nc'
# Read in Data # Read in Data
aws_file=s3.open(aws_url)
print('READING IN nClimGrid DATA FROM AWS: ',aws_url) print('READING IN nClimGrid DATA FROM AWS: ',aws_url)
try:
aws_file=s3.open(aws_url)
except:
aws_version='scaled'
aws_url='s3://noaa-nclimgrid-daily-pds/beta/by-month/'+aws_year+'/'+aws_month+'/'+element+'-'+aws_year+aws_month+'-grd-'+aws_version+'.nc'
print('FAILED, TRYING THIS URL: ',aws_url)
aws_file=s3.open(aws_url)
data_monthly = xr.open_dataset(aws_file) data_monthly = xr.open_dataset(aws_file)
print("\tSUCCESS!\n")
# Get Lat/Lons # Get Lat/Lons
nclimgrid_lats=data_monthly.lat.values nclimgrid_lats=data_monthly.lat.values
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment