This commit is contained in:
Shahram Najm 2015-03-18 10:36:56 +00:00
parent 2f59abc76d
commit 53db8aed2b
11 changed files with 161 additions and 170 deletions

View File

@ -21,7 +21,6 @@ from eccodes import *
INPUT='../../data/bufr/syno_multi.bufr'
VERBOSE=1 # verbose error reporting
def example():
# open bufr file
@ -48,13 +47,12 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(gid,'unpack',1);
codes_set(gid,'unpack',1)
#---------------------------------------------------------------
# We will read the value and all the attributes available for
# the 2m temperature.
#---------------------------------------------------------------
#get the value
key='airTemperatureAt2M'
if not codes_is_defined(gid,key):
@ -65,7 +63,6 @@ def example():
# are keys as well. Their name is constructed like:
# keyname->attributename
for attr in attrs:
key='airTemperatureAt2M' + "->" + attr
if not codes_is_defined(gid,key):
raise Exception("Key: " + key + " was not defined")
@ -85,14 +82,12 @@ def example():
# print the values of the attributes of the key.
for attr in attrs:
key='airTemperatureAt2M->percentConfidence' + "->" + attr
if not codes_is_defined(gid,key):
raise Exception("Key: " + key + " was not defined")
print ' %s: %s' % (key,codes_get(gid,key))
cnt+=1
# delete handle

View File

@ -38,7 +38,7 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(gid,'unpack',1);
codes_set(gid,'unpack',1)
#-----------------------------------
# get all the expanded data values

View File

@ -38,12 +38,11 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(gid,'unpack',1);
codes_set(gid,'unpack',1)
#----------------------------------------------
# get values for keys holding a single value
#----------------------------------------------
#Native type integer
key='blockNumber'
if not codes_is_defined(gid,key):
@ -68,11 +67,9 @@ def example():
raise Exception("Key: " + key + " was not defined")
print ' %s: %s' % (key,codes_get(gid,key))
#---------------------------------
# get values for an array
#---------------------------------
# Native type integer
key='bufrdcExpandedDescriptors'

View File

@ -39,7 +39,7 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
#codes_set(gid,'unpack',1);
#codes_set(gid,'unpack',1)
# get key iterator for a given namespace
iterid = codes_keys_iterator_new(gid,'ls')

View File

@ -55,7 +55,7 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(gid,'unpack',1);
codes_set(gid,'unpack',1)
# print the values for the selected keys from the message
for key in keys:

View File

@ -38,7 +38,7 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(gid,'unpack',1);
codes_set(gid,'unpack',1)
# In what follows we rely on the fact that for
# temperature significant levels the value of key

View File

@ -43,7 +43,7 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
#codes_set(gid,'unpack',1);
#codes_set(gid,'unpack',1)
# This is the place where you may wish to modify the message
# E.g. we change the centre

View File

@ -38,7 +38,7 @@ def example():
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(gid,'unpack',1);
codes_set(gid,'unpack',1)
# find out the number of subsets
key='numberOfSubsets'
@ -65,7 +65,6 @@ def example():
#val=codes_get(gid,key)
#print ' %d: %d' % (key,val)
cnt+=1
# delete handle