Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Emanuele Emili
DA-tools
Compare revisions
68797b7aef77edbc6848801afed5a747c376e24f...1eb3ae41e607846809c8b52d154b7a961c07e462
Commits (2)
Time series plot for AOD instruments
· 4fdedf0c
Emanuele Emili
authored
Jan 22, 2024
4fdedf0c
Merge branch 'main' of
https://earth.bsc.es/gitlab/eemili/da-tools
· 1eb3ae41
Emanuele Emili
authored
Jan 22, 2024
1eb3ae41
Hide whitespace changes
Inline
Side-by-side
obs/AOD_instr.py
View file @
1eb3ae41
...
...
@@ -285,14 +285,18 @@ class AODInstrument(BaseInstrument):
def
Average
(
self
,
**
kwargs
):
avgmsk
=
self
.
TimeAveragerMask
()
avgmsk
=
self
.
TimeAveragerMask
(
**
kwargs
)
self
.
avgaod
=
{
wv
:
np
.
ma
.
empty
((
self
.
avgtime
.
size
),
dtype
=
self
.
aod
[
wv
].
dtype
)
\
for
wv
in
self
.
wllist
}
self
.
stdaod
=
{
wv
:
np
.
ma
.
empty
((
self
.
avgtime
.
size
),
dtype
=
self
.
aod
[
wv
].
dtype
)
\
for
wv
in
self
.
wllist
}
for
wv
in
self
.
wllist
:
self
.
avgaod
[
wv
][:]
=
np
.
ma
.
masked
for
it
in
range
(
self
.
avgtime
.
size
):
if
avgmsk
[
it
].
any
():
self
.
avgaod
[
wv
][
it
]
=
np
.
ma
.
mean
(
self
.
aod
[
wv
][
avgmsk
[
it
]])
if
avgmsk
[
it
].
any
():
self
.
avgaod
[
wv
][
it
]
=
np
.
ma
.
mean
(
self
.
aod
[
wv
][
avgmsk
[
it
]])
self
.
stdaod
[
wv
][
it
]
=
np
.
ma
.
std
(
self
.
aod
[
wv
][
avgmsk
[
it
]])
def
PlotObsHisto
(
self
,
outdir
=
"./"
,
outNameSuffix
=
''
,
**
kwargs
):
...
...
@@ -467,7 +471,7 @@ class AODInstrument(BaseInstrument):
ax
.
set_ylabel
(
"%s"
%
(
self
.
units
[
wv
]))
ax
.
plot
(
self
.
avgtime
.
astype
(
datetime
),
self
.
avgaod
[
wv
],
color
=
'royalblue'
,
\
ls
=
'-'
,
lw
=
2
,
marker
=
None
,
label
=
None
,
markersize
=
4.0
)
ls
=
None
,
lw
=
None
,
marker
=
'o'
,
label
=
None
,
markersize
=
4.0
)
if
'yrange'
in
lkwargs
:
ax
.
set_ylim
(
lkwargs
[
'yrange'
][
"min"
],
lkwargs
[
'yrange'
][
"max"
])
...
...
obs/baseinstr.py
View file @
1eb3ae41
...
...
@@ -412,14 +412,15 @@ class BaseInstrument(object):
An averager to compute timeseries (spatial averages)
It returns the selector to the caller
"""
freq
=
1
if
'AvgTimeSerFreq'
in
kwargs
:
freq
=
kwargs
[
'AvgTimeSerFreq'
]
tstart
=
self
.
time
.
compressed
().
min
().
astype
(
datetime
)
tstart
=
datetime
(
tstart
.
year
,
tstart
.
month
,
tstart
.
day
,
tstart
.
hour
)
tend
=
self
.
time
.
compressed
().
max
().
astype
(
datetime
)
tend
=
datetime
(
tend
.
year
,
tend
.
month
,
tend
.
day
,
tend
.
hour
,
59
,
59
)
# Fixed to hourly frequency for now, make it changeable afterwards
avgtimestep
=
timedelta
(
hours
=
1
)
self
.
avgtime
=
np
.
ma
.
array
([
tstart
+
avgtimestep
/
2
+
time
delta
(
hours
=
dt
)
for
dt
in
\
avgtimestep
=
timedelta
(
hours
=
freq
)
self
.
avgtime
=
np
.
ma
.
array
([
tstart
+
avgtimestep
/
2
+
avg
time
step
*
i
for
i
in
\
range
(
int
((
tend
-
tstart
).
total_seconds
()
/
\
avgtimestep
.
total_seconds
()
+
1
))],
dtype
=
self
.
np_typetime
)
self
.
avgnobs
=
np
.
ma
.
zeros
(
self
.
avgtime
.
size
)
...
...
obs/convertobs_examples.py
View file @
1eb3ae41
...
...
@@ -252,19 +252,26 @@ if __name__ == "__main__":
# SLTSR files from Calum
Convert
(
"SLSTR"
,
"VIIRS_AOD"
,
DefPeriod
(
'2020060
1
'
,
'2020060
2
'
),
"/esarchive/scratch/ekarnezi/CMUG_project/obsfinal/dust"
,
'/home/eemili/data/SLSTR'
,
wavelength
=
[
550
],
makeplots
=
(
'ObsLoc'
,
'ObsHisto'
,
'ObsOnMap'
),
ObsOnMapOpt
=
{
'range'
:{
'min'
:
0
,
'max'
:
2
},
'markersize'
:
0.5
}
)
#
Convert("SLSTR","VIIRS_AOD",
#
DefPeriod('2020060
2
','2020060
3
'),
#
"/esarchive/scratch/ekarnezi/CMUG_project/obsfinal/dust",
#
'/home/eemili/data/SLSTR',
#
wavelength=[550],
#
makeplots=('ObsLoc','ObsHisto','ObsOnMap'),
#
ObsOnMapOpt={'range':{'min':0,'max':2},'markersize':0.5}
#
)
# PlotObs("SLSTR","VIIRS_AOD",
# '/home/eemili/data/SLSTR/HDAT+20200601',
# outputdir="/home/eemili/data/SLSTR/plots",
# ObsOnMapOpt={'range':{'min':0,'max':1.0}})
PlotObsTimeSeries
(
"SLSTR"
,
"VIIRS_AOD"
,
'/home/eemili/data/SLSTR'
,
TimeBnd
=
DefPeriod
(
'20200601'
,
'20200603'
),
outputdir
=
"/home/eemili/data/SLSTR/plots-timeser"
,
AvgTimeSerFreq
=
3
,
ObsOnMapOpt
=
{
'range'
:{
'min'
:
0
,
'max'
:
1.0
}})
# Old SOFRID L2 data example
# MocageAscii2Hdf5("IASI-SOFRID","IntQtyInstrument", \
...
...