def grdcut(self, options, input, output=None): g1 = gmt_grid.GMT_Grid(self._gmt_session) g1.register_input(input) g2 = gmt_grid.GMT_Grid(self._gmt_session) g2.register_output(output) module_options = ' '.join([g1.in_str, options, g2.out_str, self.v]) self._print_call('grdcut ' + module_options) self._gmt_session.call_module('grdcut', module_options) return g2
def grdvector(self, options, grid1, grid2): g1 = gmt_grid.GMT_Grid(self._gmt_session) g2 = gmt_grid.GMT_Grid(self._gmt_session) g1.register_input(grid1) g2.register_input(grid2) module_options = ' '.join([ g1.in_str, g2.in_str, options, self.ko, self.v, self.range_proj, self.ps_output ]) self._print_call('grdvector ' + module_options) self._gmt_session.call_module('grdvector', module_options)
def grdinfo(self, options, input): g = gmt_grid.GMT_Grid(self._gmt_session) g.register_input(input) module_options = ' '.join([g.in_str, options, self.v]) self._print_call('grdinfo ' + module_options) self._gmt_session.call_module('grdinfo', module_options)
def grdcontour(self, options, input): g = gmt_grid.GMT_Grid(self._gmt_session) g.register_input(input) module_options = ' '.join([ g.in_str, options, self.ko, self.v, self.range_proj, self.ps_output ]) self._print_call('grdcontour ' + module_options) self._gmt_session.call_module('grdcontour', module_options)
def grd2cpt(self, options, input, output=None): g = gmt_grid.GMT_Grid(self._gmt_session) g.register_input(input) c = gmt_cpt.GMT_CPT(self._gmt_session) c.register_output(output) module_options = ' '.join([g.in_str, options, c.out_str, self.v]) self._print_call('grd2cpt ' + module_options) self._gmt_session.call_module('grd2cpt', module_options) return c
def grdview(self, options, input, cpt=None, intensity=None): ''' Call the GMT pscontour module with the text string "options" ''' g = gmt_grid.GMT_Grid(self._gmt_session) g.register_input(input) module_options = ' '.join([ g.in_str, options, self.ko, self.v, self.range_proj, self.ps_output ]) if intensity != None: g = gmt_grid.GMT_Grid(self._gmt_session) g.register_input(intensity) module_options = module_options + ' -I' + g.in_str if cpt != None: c = gmt_cpt.GMT_CPT(self._gmt_session) c.register_input(cpt) module_options = module_options + ' ' + c.in_str self._print_call('grdview ' + module_options) self._gmt_session.call_module('grdview', module_options)
def grdmath(self, *args): #parse all the input operations module_options = '' for a in args: if isinstance(a, gmt_grid.GMT_Grid): a.register_input() module_options = " ".join([module_options, a.in_str]) else: module_options = " ".join([module_options, str(a)]) #prepare the output grid g = gmt_grid.GMT_Grid(self._gmt_session) g.register_output() module_options = " ".join([module_options, " = " + g.out_str]) #call grdmath self._print_call('grdmath ' + module_options) self._gmt_session.call_module('grdmath', module_options) return g