mirror of https://github.com/ecmwf/eccodes.git
GRIB-339 Python bindings: remove all grib_ prefixes
This commit is contained in:
parent
a63c3b2a33
commit
879cf907ec
|
@ -20,7 +20,7 @@ def example():
|
|||
out = open(sys.argv[2],'w')
|
||||
|
||||
while 1:
|
||||
gid = grib_new_from_file(f)
|
||||
gid = new_from_file(f)
|
||||
if gid is None: break
|
||||
|
||||
message = get_message(gid)
|
||||
|
|
|
@ -22,7 +22,7 @@ def example():
|
|||
fin = open(INPUT)
|
||||
fout = open(OUTPUT,'w')
|
||||
|
||||
gid = grib_new_from_file(fin)
|
||||
gid = new_from_file(fin)
|
||||
|
||||
nx = get(gid,'Ni')
|
||||
ny = get(gid,'Nj')
|
||||
|
|
|
@ -19,8 +19,8 @@ VERBOSE=1 # verbose error reporting
|
|||
def example():
|
||||
f = open(INPUT)
|
||||
|
||||
mcount = grib_count_in_file(f)
|
||||
gid_list = [grib_new_from_file(f) for i in range(mcount)]
|
||||
mcount = count_in_file(f)
|
||||
gid_list = [new_from_file(f) for i in range(mcount)]
|
||||
|
||||
f.close()
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ def example():
|
|||
]
|
||||
|
||||
while 1:
|
||||
gid = grib_new_from_file(f)
|
||||
gid = new_from_file(f)
|
||||
if gid is None: break
|
||||
|
||||
for key in keys:
|
||||
|
|
|
@ -20,7 +20,7 @@ def example():
|
|||
f = open(INPUT)
|
||||
|
||||
while 1:
|
||||
gid = grib_new_from_file(f)
|
||||
gid = new_from_file(f)
|
||||
if gid is None: break
|
||||
|
||||
iterid = iterator_new(gid,0)
|
||||
|
|
|
@ -20,7 +20,7 @@ def example():
|
|||
f = open(INPUT)
|
||||
|
||||
while 1:
|
||||
gid = grib_new_from_file(f)
|
||||
gid = new_from_file(f)
|
||||
if gid is None: break
|
||||
|
||||
iterid = keys_iterator_new(gid,'ls')
|
||||
|
|
|
@ -21,17 +21,17 @@ def example():
|
|||
fin = open(INPUT)
|
||||
fout = open(OUTPUT,'w')
|
||||
|
||||
gid = grib_new_from_file(fin)
|
||||
gid = new_from_file(fin)
|
||||
|
||||
mgid = grib_multi_new()
|
||||
mgid = multi_new()
|
||||
|
||||
for step in range(12,132,12):
|
||||
set(gid,"step",step)
|
||||
grib_multi_append(gid,4,mgid)
|
||||
multi_append(gid,4,mgid)
|
||||
|
||||
grib_multi_write(mgid,fout)
|
||||
multi_write(mgid,fout)
|
||||
|
||||
grib_multi_release(mgid)
|
||||
multi_release(mgid)
|
||||
release(gid)
|
||||
fin.close()
|
||||
fout.close()
|
||||
|
|
|
@ -20,14 +20,14 @@ def example():
|
|||
points = ((30,-20),(13,234))
|
||||
|
||||
f = open(INPUT)
|
||||
gid = grib_new_from_file(f)
|
||||
gid = new_from_file(f)
|
||||
|
||||
for lat,lon in points:
|
||||
nearest = grib_find_nearest(gid,lat,lon)[0]
|
||||
nearest = find_nearest(gid,lat,lon)[0]
|
||||
print lat,lon
|
||||
print nearest.lat,nearest.lon,nearest.value,nearest.distance,nearest.index
|
||||
|
||||
four = grib_find_nearest(gid,lat,lon,is_lsm = False,npoints = 4)
|
||||
four = find_nearest(gid,lat,lon,is_lsm = False,npoints = 4)
|
||||
for i in range(len(four)):
|
||||
print "- %d -" % i
|
||||
print four[i]
|
||||
|
|
|
@ -18,7 +18,7 @@ VERBOSE=1 # verbose error reporting
|
|||
|
||||
def example():
|
||||
f = open(INPUT)
|
||||
gid = grib_new_from_file(f)
|
||||
gid = new_from_file(f)
|
||||
|
||||
values = get_values(gid)
|
||||
for i in xrange(len(values)):
|
||||
|
|
|
@ -18,7 +18,7 @@ OUTPUT='out.grib'
|
|||
VERBOSE=1 # verbose error reporting
|
||||
|
||||
def example():
|
||||
sample_id = grib_new_from_samples("regular_ll_sfc_grib1")
|
||||
sample_id = new_from_samples("regular_ll_sfc_grib1")
|
||||
fin = open(INPUT)
|
||||
fout = open(OUTPUT,'w')
|
||||
|
||||
|
@ -34,7 +34,7 @@ def example():
|
|||
|
||||
prev_vals = None
|
||||
while 1:
|
||||
gid = grib_new_from_file(fin)
|
||||
gid = new_from_file(fin)
|
||||
if gid is None: break
|
||||
|
||||
curr_vals = get_values(gid)
|
||||
|
|
|
@ -19,7 +19,7 @@ VERBOSE=1 # verbose error reporting
|
|||
def example():
|
||||
fin = open(INPUT)
|
||||
fout = open(OUTPUT,'w')
|
||||
gid = grib_new_from_file(fin)
|
||||
gid = new_from_file(fin)
|
||||
|
||||
dt = date.today()
|
||||
today = "%d%02d%02d" % (dt.year,dt.month,dt.day)
|
||||
|
|
|
@ -21,7 +21,7 @@ def example():
|
|||
fin = open(INPUT)
|
||||
fout = open(OUTPUT,'w')
|
||||
|
||||
gid = grib_new_from_file(fin)
|
||||
gid = new_from_file(fin)
|
||||
|
||||
# set type of level to surface
|
||||
set(gid,'typeOfFirstFixedSurface','sfc')
|
||||
|
|
|
@ -205,7 +205,7 @@ def bufr_new_from_file(fileobj,headers_only = False):
|
|||
return gribid
|
||||
|
||||
@require(fileobj=file)
|
||||
def grib_new_from_file(fileobj,headers_only = False):
|
||||
def new_from_file(fileobj,headers_only = False):
|
||||
"""
|
||||
@brief Load in memory a grib message from a file.
|
||||
|
||||
|
@ -236,7 +236,7 @@ def grib_new_from_file(fileobj,headers_only = False):
|
|||
return gribid
|
||||
|
||||
@require(fileobj=file)
|
||||
def grib_count_in_file(fileobj):
|
||||
def count_in_file(fileobj):
|
||||
"""
|
||||
@brief Count the messages in a file.
|
||||
|
||||
|
@ -250,7 +250,7 @@ def grib_count_in_file(fileobj):
|
|||
CHECK(err)
|
||||
return num
|
||||
|
||||
def grib_multi_support_on():
|
||||
def multi_support_on():
|
||||
"""
|
||||
@brief Turn on the support for multiple fields in a single message.
|
||||
|
||||
|
@ -258,7 +258,7 @@ def grib_multi_support_on():
|
|||
"""
|
||||
_internal.grib_c_multi_support_on()
|
||||
|
||||
def grib_multi_support_off():
|
||||
def multi_support_off():
|
||||
"""
|
||||
@brief Turn off the support for multiple fields in a single message.
|
||||
|
||||
|
@ -311,7 +311,7 @@ def set_string(gribid,key,value):
|
|||
"""
|
||||
CHECK(_internal.grib_c_set_string(gribid,key,value,len(value)))
|
||||
|
||||
def grib_gribex_mode_on():
|
||||
def gribex_mode_on():
|
||||
"""
|
||||
@brief Turn on the compatibility mode with gribex.
|
||||
|
||||
|
@ -319,7 +319,7 @@ def grib_gribex_mode_on():
|
|||
"""
|
||||
_internal.grib_c_gribex_mode_on()
|
||||
|
||||
def grib_gribex_mode_off():
|
||||
def gribex_mode_off():
|
||||
"""
|
||||
@brief Turn off the compatibility mode with gribex.
|
||||
|
||||
|
@ -341,7 +341,7 @@ def write(gribid, fileobj):
|
|||
CHECK(_internal.grib_c_write(gribid, fileobj))
|
||||
|
||||
@require(multigribid=int,fileobj=file)
|
||||
def grib_multi_write(multigribid, fileobj):
|
||||
def multi_write(multigribid, fileobj):
|
||||
"""
|
||||
@brief Write a multi field message to a file.
|
||||
|
||||
|
@ -354,7 +354,7 @@ def grib_multi_write(multigribid, fileobj):
|
|||
CHECK(_internal.grib_c_multi_write(multigribid, fileobj))
|
||||
|
||||
@require(ingribid=int,startsection=int,multigribid=int)
|
||||
def grib_multi_append(ingribid, startsection, multigribid):
|
||||
def multi_append(ingribid, startsection, multigribid):
|
||||
"""
|
||||
@brief Append a single field grib message to a multi field grib message.
|
||||
|
||||
|
@ -400,7 +400,7 @@ def get_string_length(gribid,key):
|
|||
return result
|
||||
|
||||
@require(iterid=int)
|
||||
def grib_skip_computed(iterid):
|
||||
def skip_computed(iterid):
|
||||
"""
|
||||
@brief Skip the computed keys in a keys iterator.
|
||||
|
||||
|
@ -415,7 +415,7 @@ def grib_skip_computed(iterid):
|
|||
CHECK(_internal.grib_c_skip_computed(iterid))
|
||||
|
||||
@require(iterid=int)
|
||||
def grib_skip_coded(iterid):
|
||||
def skip_coded(iterid):
|
||||
"""
|
||||
@brief Skip the coded keys in a keys iterator.
|
||||
|
||||
|
@ -429,7 +429,7 @@ def grib_skip_coded(iterid):
|
|||
CHECK(_internal.grib_c_skip_coded(iterid))
|
||||
|
||||
@require(iterid=int)
|
||||
def grib_skip_edition_specific(iterid):
|
||||
def skip_edition_specific(iterid):
|
||||
"""
|
||||
@brief Skip the edition specific keys in a keys iterator.
|
||||
|
||||
|
@ -441,7 +441,7 @@ def grib_skip_edition_specific(iterid):
|
|||
CHECK(_internal.grib_c_skip_edition_specific(iterid))
|
||||
|
||||
@require(iterid=int)
|
||||
def grib_skip_duplicates(iterid):
|
||||
def skip_duplicates(iterid):
|
||||
"""
|
||||
@brief Skip the duplicate keys in a keys iterator.
|
||||
|
||||
|
@ -453,7 +453,7 @@ def grib_skip_duplicates(iterid):
|
|||
CHECK(_internal.grib_c_skip_duplicates(iterid))
|
||||
|
||||
@require(iterid=int)
|
||||
def grib_skip_read_only(iterid):
|
||||
def skip_read_only(iterid):
|
||||
"""
|
||||
@brief Skip the read_only keys in a keys iterator.
|
||||
|
||||
|
@ -467,7 +467,7 @@ def grib_skip_read_only(iterid):
|
|||
CHECK(_internal.grib_c_skip_read_only(iterid))
|
||||
|
||||
@require(iterid=int)
|
||||
def grib_skip_function(iterid):
|
||||
def skip_function(iterid):
|
||||
"""
|
||||
@brief Skip the function keys in a keys iterator.
|
||||
|
||||
|
@ -678,7 +678,7 @@ def set_double(gribid,key,value):
|
|||
CHECK(_internal.grib_c_set_double(gribid,key,value))
|
||||
|
||||
@require(samplename=str)
|
||||
def grib_new_from_samples(samplename):
|
||||
def new_from_samples(samplename):
|
||||
"""
|
||||
@brief Create a new valid gribid from a sample.
|
||||
|
||||
|
@ -846,7 +846,7 @@ def get_long_array(gribid,key):
|
|||
|
||||
return result
|
||||
|
||||
def grib_multi_new():
|
||||
def multi_new():
|
||||
"""
|
||||
@brief Create a new multi field and return its id.
|
||||
|
||||
|
@ -860,7 +860,7 @@ def grib_multi_new():
|
|||
return mgid
|
||||
|
||||
@require(gribid=int)
|
||||
def grib_multi_release(gribid):
|
||||
def multi_release(gribid):
|
||||
"""
|
||||
@brief Release a multi field from memory.
|
||||
|
||||
|
@ -872,7 +872,7 @@ def grib_multi_release(gribid):
|
|||
CHECK(_internal.grib_c_multi_release(gribid))
|
||||
|
||||
@require(gribid_src=int,namespace=str,gribid_dest=int)
|
||||
def grib_copy_namespace(gribid_src,namespace,gribid_dest):
|
||||
def copy_namespace(gribid_src,namespace,gribid_dest):
|
||||
"""
|
||||
@brief Copy the value of all the keys belonging to a namespace from the source message
|
||||
to the destination message.
|
||||
|
@ -1301,7 +1301,7 @@ def is_defined(gribid,key):
|
|||
|
||||
|
||||
@require(gribid=int,inlat=(int,float),inlon=(int,float))
|
||||
def grib_find_nearest(gribid,inlat,inlon,is_lsm = False,npoints = 1):
|
||||
def find_nearest(gribid,inlat,inlon,is_lsm = False,npoints = 1):
|
||||
"""
|
||||
@brief Find the nearest grid point or the nearest four grid points to a given latitude/longitude.
|
||||
|
||||
|
@ -1404,7 +1404,7 @@ def get(gribid,key, ktype=None):
|
|||
return result
|
||||
|
||||
@require(gribid=int,key=str)
|
||||
def grib_get_array(gribid,key, ktype=None):
|
||||
def get_array(gribid,key, ktype=None):
|
||||
"""
|
||||
@brief Get the contents of an array key.
|
||||
|
||||
|
|
Loading…
Reference in New Issue