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
NearRealTimeCTDAS
CTDAS
Commits
8bc500fc
Commit
8bc500fc
authored
Jun 11, 2013
by
Peters, Wouter
Browse files
update of io function names for reading/writing of netcdf data and attributes
parent
df1b1c21
Changes
3
Hide whitespace changes
Inline
Side-by-side
gridded/da/carbondioxide/obs.py
View file @
8bc500fc
...
...
@@ -61,7 +61,7 @@ class CO2Observations(Observations):
For now, we will stick with option (1)
"""
ncf
=
io
.
CT_R
ead
(
self
.
obs_filename
,
'read'
)
ncf
=
io
.
ct_r
ead
(
self
.
obs_filename
,
'read'
)
idates
=
ncf
.
get_variable
(
'date_components'
)
dates
=
array
([
dtm
.
datetime
(
*
d
)
for
d
in
idates
])
...
...
@@ -108,7 +108,7 @@ class CO2Observations(Observations):
logging
.
error
(
"...exiting"
)
raise
IOError
,
msg
ncf
=
io
.
CT_R
ead
(
filename
,
method
=
'read'
)
ncf
=
io
.
ct_r
ead
(
filename
,
method
=
'read'
)
ids
=
ncf
.
get_variable
(
'obs_num'
)
simulated
=
ncf
.
get_variable
(
'flask'
)
ncf
.
close
()
...
...
gridded/da/carbondioxide/obspack.py
View file @
8bc500fc
...
...
@@ -79,7 +79,7 @@ class ObsPackObservations(Observations):
for
ncfile
in
ncfilelist
:
infile
=
os
.
path
.
join
(
self
.
obspack_dir
,
'data'
,
'nc'
,
ncfile
)
ncf
=
io
.
CT_R
ead
(
infile
,
'read'
)
ncf
=
io
.
ct_r
ead
(
infile
,
'read'
)
idates
=
ncf
.
get_variable
(
'time_components'
)
dates
=
array
([
dtm
.
datetime
(
*
d
)
for
d
in
idates
])
...
...
@@ -91,12 +91,12 @@ class ObsPackObservations(Observations):
evn
=
ncf
.
get_variable
(
'obspack_id'
).
take
(
subselect
,
axis
=
0
)
evn
=
[
s
.
tostring
().
lower
()
for
s
in
evn
]
evn
=
map
(
strip
,
evn
)
site
=
ncf
.
G
et
A
ttribute
(
'site_code'
)
site
=
ncf
.
g
et
_a
ttribute
(
'site_code'
)
lats
=
ncf
.
get_variable
(
'latitude'
).
take
(
subselect
,
axis
=
0
)
lons
=
ncf
.
get_variable
(
'longitude'
).
take
(
subselect
,
axis
=
0
)
alts
=
ncf
.
get_variable
(
'altitude'
).
take
(
subselect
,
axis
=
0
)
obs
=
ncf
.
get_variable
(
'value'
).
take
(
subselect
,
axis
=
0
)
species
=
ncf
.
G
et
A
ttribute
(
'dataset_parameter'
)
species
=
ncf
.
g
et
_a
ttribute
(
'dataset_parameter'
)
#strategy = ncf.get_variable('sampling_strategy').take(subselect,axis=0)
strategy
=
1
flags
=
ncf
.
get_variable
(
'qc_flag'
).
take
(
subselect
,
axis
=
0
)
...
...
@@ -122,7 +122,7 @@ class ObsPackObservations(Observations):
logging
.
error
(
"...exiting"
)
raise
IOError
,
msg
ncf
=
io
.
CT_R
ead
(
filename
,
method
=
'read'
)
ncf
=
io
.
ct_r
ead
(
filename
,
method
=
'read'
)
ids
=
ncf
.
get_variable
(
'obs_num'
)
simulated
=
ncf
.
get_variable
(
'flask'
)
ncf
.
close
()
...
...
@@ -467,4 +467,4 @@ class MixingRatioSample(object):
if
__name__
==
"__main__"
:
pass
\ No newline at end of file
pass
gridded/da/carbondioxide/obspack_geocarbon.py
View file @
8bc500fc
...
...
@@ -78,7 +78,7 @@ class ObsPackObservations(Observations):
for
ncfile
in
ncfilelist
:
infile
=
os
.
path
.
join
(
self
.
obspack_dir
,
'data'
,
'nc'
,
ncfile
+
'.nc'
)
ncf
=
io
.
CT_R
ead
(
infile
,
'read'
)
ncf
=
io
.
ct_r
ead
(
infile
,
'read'
)
idates
=
ncf
.
get_variable
(
'time_components'
)
dates
=
array
([
dtm
.
datetime
(
*
d
)
for
d
in
idates
])
...
...
@@ -95,7 +95,7 @@ class ObsPackObservations(Observations):
lons
=
ncf
.
get_variable
(
'longitude'
).
take
(
subselect
,
axis
=
0
)
alts
=
ncf
.
get_variable
(
'altitude'
).
take
(
subselect
,
axis
=
0
)
obs
=
ncf
.
get_variable
(
'value'
).
take
(
subselect
,
axis
=
0
)
species
=
ncf
.
G
et
A
ttribute
(
'dataset_parameter'
)
species
=
ncf
.
g
et
_a
ttribute
(
'dataset_parameter'
)
flags
=
ncf
.
get_variable
(
'obs_flag'
).
take
(
subselect
,
axis
=
0
)
ncf
.
close
()
...
...
@@ -117,7 +117,7 @@ class ObsPackObservations(Observations):
logging
.
error
(
"...exiting"
)
raise
IOError
,
msg
ncf
=
io
.
CT_R
ead
(
filename
,
method
=
'read'
)
ncf
=
io
.
ct_r
ead
(
filename
,
method
=
'read'
)
ids
=
ncf
.
get_variable
(
'obs_num'
)
simulated
=
ncf
.
get_variable
(
'flask'
)
ncf
.
close
()
...
...
@@ -162,7 +162,7 @@ class ObsPackObservations(Observations):
for
key
,
value
in
self
.
site_move
.
iteritems
():
msg
=
"Site is moved by %3.2f degrees latitude and %3.2f degrees longitude"
%
value
f
.
A
dd
A
ttribute
(
key
,
msg
)
f
.
a
dd
_a
ttribute
(
key
,
msg
)
data
=
self
.
getvalues
(
'id'
)
...
...
@@ -372,7 +372,7 @@ class ObsPackObservations(Observations):
for
key
,
value
in
self
.
site_move
.
iteritems
():
msg
=
"Site is moved by %3.2f degrees latitude and %3.2f degrees longitude"
%
value
f
.
A
dd
A
ttribute
(
key
,
msg
)
f
.
a
dd
_a
ttribute
(
key
,
msg
)
data
=
self
.
getvalues
(
'id'
)
...
...
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