mirror of https://github.com/ecmwf/eccodes.git
Merge pull request #1 in ECCODES/eccodes from fix/ECC-188-pep8ify-python-examples to develop
* commit '7939c008e92790bbd11534c29b363ea7a3121121': ECC-188 Add tox.ini with flake8 configuration ECC-188 PEP8ify python examples
This commit is contained in:
commit
9b45c58719
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_attributes
|
||||
|
@ -51,10 +52,10 @@ def example():
|
|||
# i.e. unpack the data values
|
||||
codes_set(gid, 'unpack', 1)
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# --------------------------------------------------------------
|
||||
# We will read the value and all the attributes available for
|
||||
# the 2m temperature.
|
||||
#---------------------------------------------------------------
|
||||
# --------------------------------------------------------------
|
||||
# get the value
|
||||
key = 'airTemperatureAt2M'
|
||||
try:
|
||||
|
@ -72,11 +73,11 @@ def example():
|
|||
except CodesInternalError, err:
|
||||
print 'Error with key="%s" : %s' % (key, err.msg)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------
|
||||
# The 2m temperature data element in this message has an associated
|
||||
# field: percentConfidence. Its value and attributes can be accessed
|
||||
# in a similar manner as was shown above for 2m temperature.
|
||||
#-------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
# get the value
|
||||
key = 'airTemperatureAt2M->percentConfidence'
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
#
|
||||
|
@ -63,7 +64,7 @@ def example():
|
|||
def main():
|
||||
try:
|
||||
example()
|
||||
except CodesInternalError, err:
|
||||
except CodesInternalError as err:
|
||||
if VERBOSE:
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
else:
|
||||
|
|
|
@ -18,7 +18,7 @@ from eccodes import *
|
|||
|
||||
def example(csvfile, input_filename, output_filename):
|
||||
|
||||
fbufrin = open(input_filename, 'rb')
|
||||
fbufrin = open(input_filename, 'rb')
|
||||
fbufrout = open(output_filename, 'wb')
|
||||
|
||||
print 'Using ecCodes version: ', codes_get_api_version()
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_get_keys
|
||||
|
@ -42,9 +43,9 @@ def example():
|
|||
# i.e. unpack the data values
|
||||
codes_set(gid, 'unpack', 1)
|
||||
|
||||
#-----------------------------------
|
||||
# ----------------------------------
|
||||
# get all the expanded data values
|
||||
#-----------------------------------
|
||||
# ----------------------------------
|
||||
key = 'numericValues'
|
||||
|
||||
# get size
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_get_keys
|
||||
|
@ -42,9 +43,9 @@ def example():
|
|||
# i.e. unpack the data values
|
||||
codes_set(gid, 'unpack', 1)
|
||||
|
||||
#----------------------------------------------
|
||||
# ---------------------------------------------
|
||||
# get values for keys holding a single value
|
||||
#----------------------------------------------
|
||||
# ---------------------------------------------
|
||||
# Native type integer
|
||||
key = 'blockNumber'
|
||||
|
||||
|
@ -74,9 +75,9 @@ def example():
|
|||
except CodesInternalError, err:
|
||||
print 'Error with key="%s" : %s' % (key, err.msg)
|
||||
|
||||
#---------------------------------
|
||||
# --------------------------------
|
||||
# get values for an array
|
||||
#---------------------------------
|
||||
# --------------------------------
|
||||
# Native type integer
|
||||
key = 'bufrdcExpandedDescriptors'
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_keys_iterator
|
||||
|
@ -59,8 +60,6 @@ def example():
|
|||
|
||||
# print key name
|
||||
keyname = codes_keys_iterator_get_name(iterid)
|
||||
#keyval = codes_get_string(iterid,keyname)
|
||||
# print "%s = %s" % (keyname,keyval)
|
||||
print " %s" % keyname
|
||||
|
||||
# delete the key iterator
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -3,17 +3,20 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_read_scatterometer
|
||||
#
|
||||
# Description: how to read data for a given beam from scatterometer BUFR messages.
|
||||
# Description: how to read data for a given beam from scatterometer BUFR
|
||||
# messages.
|
||||
#
|
||||
# Please note that scatterometer data can be encoded in various ways in BUFR. Therefore the code
|
||||
# below might not work directly for other types of messages than the one used in the
|
||||
# example. It is advised to use bufr_dump first to understand the structure of these messages.
|
||||
# Please note that scatterometer data can be encoded in various ways in BUFR.
|
||||
# Therefore the code below might not work directly for other types of messages
|
||||
# than the one used in the example. It is advised to use bufr_dump first to
|
||||
# understand the structure of these messages.
|
||||
#
|
||||
|
||||
|
||||
|
@ -46,12 +49,13 @@ def example():
|
|||
# i.e. unpack the data values
|
||||
codes_set(gid, 'unpack', 1)
|
||||
|
||||
# The BUFR file contains a single message with 2016 subsets in a compressed form.
|
||||
# It means each subset has exactly the same structure: they store one location with
|
||||
# several beams and one backscatter value in each beam.
|
||||
# The BUFR file contains a single message with 2016 subsets in a
|
||||
# compressed form. It means each subset has exactly the same structure:
|
||||
# they store one location with several beams and one backscatter value
|
||||
# in each beam.
|
||||
#
|
||||
# To print the backScatter values for beamIdentifier=2 from all the subsets
|
||||
# we will simply access the key by condition (see below)
|
||||
# To print the backScatter values for beamIdentifier=2 from all the
|
||||
# subsets we will simply access the key by condition (see below)
|
||||
|
||||
# Get the total number of subsets.
|
||||
numObs = codes_get(gid, "numberOfSubsets")
|
||||
|
@ -64,8 +68,8 @@ def example():
|
|||
# Get longitude (for all the subsets)
|
||||
lon = codes_get_array(gid, "longitude")
|
||||
|
||||
# Get backScatter for beam two. We use an access by condition for this key.
|
||||
#(for all the subsets)
|
||||
# Get backScatter for beam two. We use an access by condition for this
|
||||
# key (for all the subsets).
|
||||
bscat = codes_get_array(gid, "/beamIdentifier=2/backscatter")
|
||||
|
||||
# Check that all arrays are same size
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_read_synop
|
||||
|
@ -12,11 +13,10 @@
|
|||
# Description: how to read data values from BUFR messages.
|
||||
#
|
||||
|
||||
#
|
||||
# Please note that SYNOP reports can be encoded in various ways in BUFR. Therefore the code
|
||||
# below might not work directly for other types of SYNOP messages than the one used in the
|
||||
# example. It is advised to use bufr_dump to understand the structure of the messages.
|
||||
#
|
||||
# Please note that SYNOP reports can be encoded in various ways in BUFR.
|
||||
# Therefore the code below might not work directly for other types of SYNOP
|
||||
# messages than the one used in the example. It is advised to use bufr_dump to
|
||||
# understand the structure of the messages.
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
|
@ -55,7 +55,8 @@ def example():
|
|||
# cloud block introduced by the key
|
||||
# verticalSignificanceSurfaceObservations=1.
|
||||
# We know that this is the first occurrence of the keys we want to
|
||||
# read so in the list above we used the # (occurrence) operator accordingly.
|
||||
# read so in the list above we used the # (occurrence) operator
|
||||
# accordingly.
|
||||
|
||||
cnt = 0
|
||||
|
||||
|
|
|
@ -3,18 +3,21 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_read_temp
|
||||
#
|
||||
# Description: how to read temperature significant levels from TEMP BUFR messages.
|
||||
# Description: how to read temperature significant levels from TEMP BUFR
|
||||
# messages.
|
||||
#
|
||||
#
|
||||
# Please note that TEMP reports can be encoded in various ways in BUFR. Therefore the code
|
||||
# below might not work directly for other types of TEMP messages than the one used in the
|
||||
# example. It is advised to use bufr_dump to understand the structure of the messages.
|
||||
# Please note that TEMP reports can be encoded in various ways in BUFR.
|
||||
# Therefore the code below might not work directly for other types of TEMP
|
||||
# messages than the one used in the example. It is advised to use bufr_dump to
|
||||
# understand the structure of the messages.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
@ -60,23 +63,29 @@ def example():
|
|||
# We find out the number of temperature significant levels by
|
||||
# counting how many pressure values we have on these levels.
|
||||
|
||||
numSigT = codes_get_size(gid, "/verticalSoundingSignificance=4/pressure")
|
||||
numSigT = codes_get_size(
|
||||
gid, "/verticalSoundingSignificance=4/pressure")
|
||||
print ' Number of temperature significant levels %ld' % (numSigT)
|
||||
|
||||
# Get pressure
|
||||
sigt_pres = codes_get_array(gid, "/verticalSoundingSignificance=4/pressure")
|
||||
sigt_pres = codes_get_array(
|
||||
gid, "/verticalSoundingSignificance=4/pressure")
|
||||
|
||||
# Get gepotential
|
||||
sigt_geo = codes_get_array(gid, "/verticalSoundingSignificance=4/geopotential")
|
||||
sigt_geo = codes_get_array(
|
||||
gid, "/verticalSoundingSignificance=4/geopotential")
|
||||
|
||||
# Get temperature
|
||||
sigt_t = codes_get_array(gid, "/verticalSoundingSignificance=4/airTemperature")
|
||||
sigt_t = codes_get_array(
|
||||
gid, "/verticalSoundingSignificance=4/airTemperature")
|
||||
|
||||
# Get dew point
|
||||
sigt_td = codes_get_array(gid, "/verticalSoundingSignificance=4/dewpointTemperature")
|
||||
sigt_td = codes_get_array(
|
||||
gid, "/verticalSoundingSignificance=4/dewpointTemperature")
|
||||
|
||||
# Check that all arrays are same size
|
||||
if len(sigt_pres) != numSigT or len(sigt_geo) != numSigT or len(sigt_t) != numSigT or len(sigt_td) != numSigT:
|
||||
if len(sigt_pres) != numSigT or len(sigt_geo) != numSigT or \
|
||||
len(sigt_t) != numSigT or len(sigt_td) != numSigT:
|
||||
print 'inconsistent array dimension'
|
||||
return 1
|
||||
|
||||
|
@ -85,7 +94,9 @@ def example():
|
|||
print "-------------------------------"
|
||||
|
||||
for i in xrange(numSigT):
|
||||
print "%3d %6.0f %6.0f %.1f %.1f" % (i + 1, sigt_pres[i], sigt_geo[i], sigt_t[i], sigt_td[i])
|
||||
print "%3d %6.0f %6.0f %.1f %.1f" % (i + 1, sigt_pres[i],
|
||||
sigt_geo[i], sigt_t[i],
|
||||
sigt_td[i])
|
||||
|
||||
cnt += 1
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_set_keys
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_subset
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
# Python implementation: get_product_kind
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
|
|
|
@ -4,11 +4,13 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
# Description: How to create and use an index to access GRIB messages from a file
|
||||
# Description: How to create and use an index to access GRIB messages from
|
||||
# a file
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
|
@ -68,7 +70,8 @@ def example():
|
|||
gid = codes_new_from_index(iid)
|
||||
if gid is None:
|
||||
break
|
||||
print " ".join(["%s=%s" % (key, codes_get(gid, key)) for key in index_keys])
|
||||
print " ".join(["%s=%s" % (key, codes_get(gid, key))
|
||||
for key in index_keys])
|
||||
codes_release(gid)
|
||||
|
||||
codes_index_release(iid)
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
@ -26,7 +27,8 @@ def example():
|
|||
for lat, lon in points:
|
||||
nearest = codes_grib_find_nearest(gid, lat, lon)[0]
|
||||
print lat, lon
|
||||
print nearest.lat, nearest.lon, nearest.value, nearest.distance, nearest.index
|
||||
print nearest.lat, nearest.lon, nearest.value, nearest.distance, \
|
||||
nearest.index
|
||||
|
||||
four = codes_grib_find_nearest(gid, lat, lon, is_lsm=False, npoints=4)
|
||||
for i in range(len(four)):
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
|
@ -34,7 +35,8 @@ def example():
|
|||
|
||||
# Check counts of missing and non-missing values
|
||||
num_data = codes_get(gid, 'numberOfDataPoints', int)
|
||||
assert(codes_get(gid, 'numberOfCodedValues', int) == num_data - num_missing)
|
||||
assert(codes_get(gid, 'numberOfCodedValues', int)
|
||||
== num_data - num_missing)
|
||||
assert(codes_get(gid, 'numberOfMissing', int) == num_missing)
|
||||
|
||||
codes_write(gid, fout)
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: bufr_get_keys
|
||||
|
@ -38,9 +39,9 @@ def example():
|
|||
|
||||
print "message: %s" % cnt
|
||||
|
||||
#----------------------------------------------
|
||||
# ---------------------------------------------
|
||||
# get values for keys holding a single value
|
||||
#----------------------------------------------
|
||||
# ---------------------------------------------
|
||||
keys = ['TT', 'AA', 'II', 'CCCC', 'YY', 'GG', 'gg', 'BBB']
|
||||
|
||||
for key in keys:
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
|
||||
#
|
||||
# Python implementation: metar_get_keys
|
||||
#
|
||||
# Description: how to read values of different type of keys from METAR messages.
|
||||
# Description: how to read values of different type of keys from METAR messages
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -38,9 +39,9 @@ def example():
|
|||
|
||||
print "message: %s" % cnt
|
||||
|
||||
#----------------------------------------------
|
||||
# ---------------------------------------------
|
||||
# get values for keys holding a single value
|
||||
#----------------------------------------------
|
||||
# ---------------------------------------------
|
||||
keys = ['CCCC', 'latitude', 'longitude', 'dateTime',
|
||||
'elevation', 'temperature', 'dewPointTemperature', 'qnh']
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an intergovernmental organisation
|
||||
# nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
|
Loading…
Reference in New Issue