Skip to content
Snippets Groups Projects
Commit b997262a authored by Ralf Mueller's avatar Ralf Mueller :fishing_pole_and_fish:
Browse files

rm old builds (python)

parent cd5f54fb
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
from distutils.core import setup, Extension
from setup import *
CdiLib_module = Extension('_CdiLib',
sources=['cdilib_wrap.c'],
extra_compile_args = INCFLAGS,
library_dirs = LDFLAGS,
extra_objects = ['../../src/cdilib.o'],
extra_link_args = LIBS,
)
setup (name = 'CdiLib',
version = '0.1',
author = "Ralf Mueller",
description = """pyhton bindings to CDI function library""",
ext_modules = [CdiLib_module],
py_modules = ["CdiLib"],
)
#!/usr/bin/env python
from distutils.core import setup, Extension
from setup import *
cdiobj_module = Extension('_CdiObj',
sources=['cdiobj_wrap.cpp'],
extra_compile_args = INCFLAGS,
library_dirs = LDFLAGS,
extra_objects = ['../cdi.o'],
runtime_library_dirs = [os.environ['BUILDLIBDIR'],os.environ['LIBDIR']],
extra_link_args = LIBS,
libraries = ['cdi','stdc++'],
language = 'c++',
)
setup (name = 'CdiObj',
version = '0.1',
author = "Ralf Mueller",
description = """pyhton bindings to CDI class library""",
ext_modules = [cdiobj_module],
py_modules = ["CdiObj"],
)
import sys,os
sys.path.insert(0,os.getcwd())
print(sys.path)
import Cdi
print("# BEGIN PYTHON TEST ==================================#")
ifile = "../mulval.nc"
cdi = Cdi.Cdi(ifile)
......@@ -45,3 +45,4 @@ print("#========= Var by code ===============================#")
code = 169
newvar = cdi.varByCode[code]
newvar.sinfo()
print("# END PYTHON TEST ====================================#")
require './Cdi'
require "pp"
puts "# BEGIN RUBY TEST ====================================#"
ifile = ARGV[0].nil? ? "../mulval.nc" : ARGV[0]
puts "Reading file: #{ifile}"
cdi = Cdi.new(ifile);
puts "Stream: #{cdi.streamID} vlistID:#{cdi.vlistID} nvars:#{cdi.nvars}"
puts "#========== TAXES ====================================#"
cdi.taxes.each {|k,v|
puts k.to_s+": " + cdi.taxes[k].ntsteps.to_s
}
puts "#========== GRIDS ====================================#"
cdi.grids.each {|k,v|
puts [k.to_s+": ",
v.size.to_s,
v.xname,
v.yname,
v.ylongname].join(" ")
}
puts "#========== ZAXES ====================================#"
cdi.zaxes.each {|k,v|
puts [k.to_s+": ",
cdi.zaxes[k].size.to_s,
cdi.zaxes[k].name,
cdi.zaxes[k].units].join(" ")
}
puts "#========== VARIABLES ================================#"
cdi.variables.each_with_index {|k,i|
print k.name[0,5] + " " + k.size.to_s + " "
puts if i%16==0
}
cdi.variables.each_with_index {|k,i|
print k.missval
puts if i%16==0
}
puts "#========== VARNAMES =================================#"
puts cdi.varnames.sort.join(" ")
puts cdi.varnames.grep(/max/).join(" <-> ")
puts "#========== VARIABLE.NAME =================================#"
puts cdi.variables.collect {|v| v.longname }.join("-")
puts cdi.variables.collect {|v| v.units }.join("-")
puts "#========== VAR by index ======================================#"
var = cdi.variables[1]
var.getValues()
val = var.values
pp val[-5..-1]
puts "#========= Var by name ===============================#"
name ="tsurf"
newvar = cdi.var[name]
puts "name ",name," var.name: ", newvar.name, " var.grids.xsize: " , newvar.grid.xsize
puts "#========= Var by code ===============================#"
code = 169
newvar = cdi.varByCode[code]
newvar.sinfo
puts "# END RUBY TEST ======================================#"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment