Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CTDAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Tsurata, Aki
CTDAS
Commits
6ebe6c9b
Commit
6ebe6c9b
authored
14 years ago
by
Peters, Wouter
Browse files
Options
Downloads
Patches
Plain Diff
back to pyhdf for now
parent
bbdb863c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
da/ct/obs.py
+37
-22
37 additions, 22 deletions
da/ct/obs.py
with
37 additions
and
22 deletions
da/ct/obs.py
+
37
−
22
View file @
6ebe6c9b
...
@@ -107,32 +107,47 @@ class CtObservations(object):
...
@@ -107,32 +107,47 @@ class CtObservations(object):
Note that this routine was not yet ported to Nio because it cannot read string arrays !!!
Note that this routine was not yet ported to Nio because it cannot read string arrays !!!
"""
"""
import
pyhdf.SD
as
HDF
import
Nio
import
Nio
import
datetime
as
dtm
import
datetime
as
dtm
from
string
import
strip
,
join
from
string
import
strip
,
join
ncf
=
Nio
.
open_file
(
self
.
ObsFilename
)
ncf
=
HDF
.
SD
(
self
.
ObsFilename
)
idates
=
ncf
.
variables
[
'
date_components
'
].
get_value
()
idates
=
ncf
.
select
(
'
date_components
'
).
get
()
ids
=
ncf
.
variables
[
'
id
'
].
get_value
()
ids
=
ncf
.
select
(
'
id
'
).
get
()
#sites = ncf.variables['site'].get_value()
sites
=
ncf
.
select
(
'
site
'
).
get
()
#sites = [s.tostring().lower() for s in sites]
sites
=
[
s
.
tostring
().
lower
()
for
s
in
sites
]
#sites = map(strip,sites)
sites
=
map
(
strip
,
sites
)
sites
=
map
(
str
,
range
(
len
(
ids
)))
lats
=
ncf
.
select
(
'
lat
'
).
get
()
lats
=
ncf
.
variables
[
'
lat
'
].
get_value
()
lons
=
ncf
.
select
(
'
lon
'
).
get
()
lons
=
ncf
.
variables
[
'
lon
'
].
get_value
()
alts
=
ncf
.
select
(
'
alt
'
).
get
()
alts
=
ncf
.
variables
[
'
alt
'
].
get_value
()
obs
=
ncf
.
select
(
'
obs
'
).
get
()
obs
=
ncf
.
variables
[
'
obs
'
].
get_value
()
species
=
ncf
.
select
(
'
species
'
).
get
()
#species = ncf.variables['species'].get_value()
date
=
ncf
.
select
(
'
date
'
).
get
()
species
=
map
(
str
,
range
(
len
(
ids
)))
window
=
ncf
.
select
(
'
sampling_strategy
'
).
get
()
date
=
ncf
.
variables
[
'
date
'
].
get_value
()
flags
=
ncf
.
select
(
'
NOAA_QC_flags
'
).
get
()
#window = ncf.variables['sampling_strategy'].get_value()
flags
=
[
s
.
tostring
().
lower
()
for
s
in
flags
]
window
=
map
(
str
,
range
(
len
(
ids
)))
flags
=
map
(
strip
,
flags
)
#flags = ncf.variables['NOAA_QC_flags'].get_value()
dummy
=
ncf
.
end
()
#flags = [s.tostring().lower() for s in flags]
#flags = map(strip,flags)
#+ ncf = Nio.open_file(self.ObsFilename)
flags
=
map
(
str
,
range
(
len
(
ids
)))
#+ idates = ncf.variables['date_components'].get_value()
dummy
=
ncf
.
close
()
#+ ids = ncf.variables['id'].get_value()
#+ sites = ncf.variables['site'].get_value()
#+ sites = [s.tostring().lower() for s in sites]
#+ sites = map(strip,sites)
#+ lats = ncf.variables['lat'].get_value()
#+ lons = ncf.variables['lon'].get_value()
#+ alts = ncf.variables['alt'].get_value()
#+ obs = ncf.variables['obs'].get_value()
#+ species = ncf.variables['species'].get_value()
#+ date = ncf.variables['date'].get_value()
#+ window = ncf.variables['sampling_strategy'].get_value()
#+ flags = ncf.variables['NOAA_QC_flags'].get_value()
#+ flags = [s.tostring().lower() for s in flags]
#+ flags = map(strip,flags)
#+ dummy = ncf.close()
msg
=
"
Successfully read data from obs file (%s)
"
%
self
.
ObsFilename
;
logging
.
debug
(
msg
)
msg
=
"
Successfully read data from obs file (%s)
"
%
self
.
ObsFilename
;
logging
.
debug
(
msg
)
dates
=
[
dtm
.
datetime
(
*
d
)
for
d
in
idates
]
dates
=
[
dtm
.
datetime
(
*
d
)
for
d
in
idates
]
...
...
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