Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jared Rennie
nclimgrid_daily_plots
Commits
93f8fec4
Commit
93f8fec4
authored
Aug 31, 2021
by
Jared Rennie
Browse files
AWS version needed to check for scaled vs prelim data
parent
25b2fed6
Changes
1
Hide whitespace changes
Inline
Side-by-side
plot_nclimgrid_daily-AWS.py
View file @
93f8fec4
...
@@ -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
(
"
\t
SUCCESS!
\n
"
)
# Get Lat/Lons
# Get Lat/Lons
nclimgrid_lats
=
data_monthly
.
lat
.
values
nclimgrid_lats
=
data_monthly
.
lat
.
values
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment