Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
brivas
ORCHESTRA-SST
Commits
5384a664
Commit
5384a664
authored
4 years ago
by
Beatriz Recinos
Browse files
Options
Download
Email Patches
Plain Diff
generalising animation
parent
e2f26730
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
8 deletions
+27
-8
scripts/plot_cci_buoy_error.py
scripts/plot_cci_buoy_error.py
+12
-4
sst_tools/workflow_sst.py
sst_tools/workflow_sst.py
+15
-4
No files found.
scripts/plot_cci_buoy_error.py
View file @
5384a664
...
...
@@ -37,6 +37,12 @@ start_day = int(sys.argv[3])
month
=
int
(
sys
.
argv
[
4
])
day_to_plot
=
int
(
sys
.
argv
[
5
])
# From SLURM ARRAY
lat_bnds
=
[
-
50
,
-
25
]
lon_bnds
=
[
100
,
180
]
extent
=
np
.
append
(
lon_bnds
,
lat_bnds
)
print
(
extent
)
# Define date arrays to process buoy data
start_date
=
datetime
(
year
=
year
,
month
=
start_month
,
day
=
start_day
)
end_date
=
datetime
(
year
=
year
,
month
=
month
,
day
=
day_to_plot
,
...
...
@@ -105,14 +111,15 @@ for hour in hours_list_to_plot:
plot_end_date
,
age_dic
,
sst
,
zonal_means
)
zonal_means
,
extent
=
extent
)
# Plotting
f
=
plt
.
figure
(
figsize
=
(
10
,
16
))
f
=
plt
.
figure
(
figsize
=
(
10
,
7
))
sns
.
set_style
(
"white"
)
ax
=
plt
.
axes
(
projection
=
crs
.
Mercator
())
ax
.
set_extent
(
[
-
90
,
-
30
,
-
65
,
-
25
]
,
crs
=
crs
.
PlateCarree
())
ax
.
set_extent
(
extent
,
crs
=
crs
.
PlateCarree
())
# Plot cci sst day
cci_to_plot
=
daily_sst_zonal_mean
.
isel
(
time
=
len
(
sst
.
time
)
-
1
)
...
...
@@ -143,7 +150,8 @@ for hour in hours_list_to_plot:
# \n ''cci-sst at buoy coords - cci-sst avg in a 2x2 gridbox \n '
weight
=
'bold'
)
ax
.
set_title
(
plot_end_date
)
f
.
suptitle
(
plot_end_date
)
#ax.set_title()
plot_name
=
str
(
int
(
year
))
+
'_'
+
f
"
{
str
(
int
(
month
)):
0
>
2
}
"
\
+
f
"
{
str
(
int
(
day_to_plot
)):
0
>
2
}
"
+
f
"
{
str
(
int
(
hour
)):
0
>
2
}
"
...
...
This diff is collapsed.
Click to expand it.
sst_tools/workflow_sst.py
View file @
5384a664
...
...
@@ -30,7 +30,8 @@ def process_hour_drift_from_start_to_end(df,
end_date
,
age
,
cci_data
,
cci_zonal_mean
):
cci_zonal_mean
,
extent
=
None
):
""" Gets buoy hourly data for selected dates, groups the data by date
and prepares extra sst averages for plotting.
...
...
@@ -40,9 +41,11 @@ def process_hour_drift_from_start_to_end(df,
start_date: start days to plot (datetime.obj)
end_date: end days and hours to plot (datetime.obj)
age: dictionary of dates to plot with the corresponding ages
(marker sizes) for the scatter plot.
(marker sizes) for the scatter plot.
cci_data: xarray containing cci sst temperature
cci_zonal_mean: xarray containing cci sst temperature zonal mean
extent: let and lat coordinates for the extension of the map array of four
[lon_w, lon_e, lat_s, lat_n]
Returns
-------
...
...
@@ -76,8 +79,16 @@ def process_hour_drift_from_start_to_end(df,
# Crop to plot lat and lon extend, this is not needed but is good for
# a speedy plot
day_df
=
day_df
[
day_df
[
'lon'
].
between
(
-
90
,
-
30
)
&
day_df
[
'lat'
].
between
(
-
65
,
-
25
)]
if
extent
is
None
:
day_df
=
day_df
else
:
assert
len
(
extent
)
==
4
lon_w
=
extent
[
0
]
lon_e
=
extent
[
1
]
lat_s
=
extent
[
2
]
lat_n
=
extent
[
3
]
day_df
=
day_df
[
day_df
[
'lon'
].
between
(
lon_w
,
lon_e
)
&
day_df
[
'lat'
].
between
(
lat_s
,
lat_n
)]
# It is important when using interp that you convert to xarray!
yy
=
xr
.
DataArray
(
day_df
.
lat
.
values
,
dims
=
'z'
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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