Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pyicon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fraser William Goldsworth
pyicon
Commits
1d0837f3
Commit
1d0837f3
authored
1 month ago
by
Fraser William Goldsworth
Committed by
Fraser William Goldsworth
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
epdates to allow ccrs projection objects
parent
9a6469c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyicon/quickplots/pyicon_quickplots.py
+10
-25
10 additions, 25 deletions
pyicon/quickplots/pyicon_quickplots.py
with
10 additions
and
25 deletions
pyicon/quickplots/pyicon_quickplots.py
+
10
−
25
View file @
1d0837f3
...
...
@@ -5,20 +5,6 @@ import numpy as np
# --- reading data
from
netCDF4
import
Dataset
,
num2date
import
datetime
<<<<<<<
HEAD
=======
# --- plotting
import
matplotlib.pyplot
as
plt
import
matplotlib
from
matplotlib
import
ticker
#import my_toolbox as my
import
cartopy
import
cartopy.crs
as
ccrs
from
cartopy.mpl.ticker
import
LongitudeFormatter
,
LatitudeFormatter
import
cmocean
# --- debugging
from
ipdb
import
set_trace
as
mybreak
>>>>>>>
190700
b
(
pyicon_quickplots
.
py
:
Allow
for
saving
timeseries
data
with
dates
outside
of
1678
-
2262
date
range
by
converting
the
time
coordinates
which
is
used
for
saving
netcdf
data
to
a
cftime
object
.)
import
pyicon
as
pyic
import
xarray
as
xr
import
cftime
...
...
@@ -380,7 +366,6 @@ def qp_timeseries(IcD, fname, vars_plot,
omit_last_file
=
True
,
use_tave_int_for_ts
=
False
,
fpath_ref_data_atm
=
''
,
do_plot_atm_ref_ts
=
False
,
do_djf
=
False
,
do_jja
=
False
,
mode_ave
=
[
'
mean
'
],
...
...
@@ -427,7 +412,7 @@ def qp_timeseries(IcD, fname, vars_plot,
# --- prepare time averaging
times_plot
=
np
.
copy
(
times
)
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
# save times for validation with ERA5/CERES/GPM
times_exp
=
np
.
copy
(
times
)
if
ave_freq
>
0
:
...
...
@@ -435,7 +420,7 @@ def qp_timeseries(IcD, fname, vars_plot,
nskip
=
times
.
size
%
ave_freq
if
nskip
>
0
:
times
=
times
[:
-
nskip
]
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
# save times for validation with ERA5/CERES/GPM
times_exp
=
times_exp
[:
-
nskip
]
# define time bounds for correct time averaging
...
...
@@ -534,7 +519,7 @@ def qp_timeseries(IcD, fname, vars_plot,
data
=
data
.
max
(
axis
=
0
)
# --- read corresponding ERA5/CERES/GPM data
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
# get name of reference data set
if
'
era5
'
in
fpath_ref_data_atm
:
refname
=
'
ERA5
'
...
...
@@ -670,7 +655,7 @@ def qp_timeseries(IcD, fname, vars_plot,
# --- modify data if var_fac or var_add are given
data
*=
var_fac
data
+=
var_add
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
data_ref
*=
var_fac
data_ref
+=
var_add
...
...
@@ -678,11 +663,11 @@ def qp_timeseries(IcD, fname, vars_plot,
times_plot
=
times_plot
[
slice
(
lstart
,
lend
)]
data
=
data
[
slice
(
lstart
,
lend
)]
dtsum
=
dtsum
[
slice
(
lstart
,
lend
)]
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
data_ref
=
data_ref
[
slice
(
lstart
,
lend
)]
# --- define labels
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
label1
=
'
exp
'
label2
=
'
era5
'
if
'
ceres
'
in
fpath_ref_data_atm
:
...
...
@@ -696,7 +681,7 @@ def qp_timeseries(IcD, fname, vars_plot,
label
=
labels
[
mm
]
# --- finally plotting
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
hl1
,
=
ax
.
plot
(
times_plot
,
data
,
color
=
'
blue
'
,
label
=
label1
)
hl2
,
=
ax
.
plot
(
times_plot
,
data_ref
,
color
=
'
black
'
,
label
=
label2
)
else
:
...
...
@@ -726,7 +711,7 @@ def qp_timeseries(IcD, fname, vars_plot,
ax
.
set_title
(
title
)
# --- legend
if
len
(
vars_plot
)
>
1
or
(
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
)
:
if
len
(
vars_plot
)
>
1
or
fpath_ref_data_atm
!=
''
:
ax
.
legend
()
# --- vertical lines indicating time frame
...
...
@@ -739,7 +724,7 @@ def qp_timeseries(IcD, fname, vars_plot,
if
do_write_data_range
:
ind
=
(
times_plot
>=
t1
)
&
(
times_plot
<=
t2
)
data_mean
=
(
data
[
ind
]
*
dtsum
[
ind
]).
sum
()
/
dtsum
[
ind
].
sum
()
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
data_ref_mean
=
(
data_ref
[
ind
]
*
dtsum
[
ind
]).
sum
()
/
dtsum
[
ind
].
sum
()
try
:
refname
=
'
era5
'
...
...
@@ -768,7 +753,7 @@ def qp_timeseries(IcD, fname, vars_plot,
FigInf
=
dict
()
Dhandles
=
dict
()
Dhandles
[
'
ax
'
]
=
ax
if
do_plot_atm_ref_ts
and
fpath_ref_data_atm
!=
''
:
if
fpath_ref_data_atm
!=
''
:
Dhandles
[
'
hl1
'
]
=
hl1
Dhandles
[
'
hl2
'
]
=
hl2
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment