Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygmt.datasets.load_earth_relief region keyword #656

Closed
uliw opened this issue Oct 19, 2020 · 2 comments
Closed

pygmt.datasets.load_earth_relief region keyword #656

uliw opened this issue Oct 19, 2020 · 2 comments
Labels
question Further information is requested

Comments

@uliw
Copy link

uliw commented Oct 19, 2020

Description of the problem

Line 1 in the example below will work, line 2 will not. I also tried to include R or -R. What is the correct way of specifying the region?

Full code that generated the error

grid = gmt.datasets.load_earth_relief(resolution="05m",region="g")
grid = gmt.datasets.load_earth_relief(resolution="05m",region="-180/180/90/-90")

Full error message

GMTCLibErrorTraceback (most recent call last)
<ipython-input-2-c3f4b1e9fae7> in <module>
     14 
     15 #grid = gmt.datasets.load_earth_relief(resolution="05m",region="g")
---> 16 grid = gmt.datasets.load_earth_relief(resolution=r,region="-180/180/90/-90")
     17 # grid = gmt.datasets.load_earth_relief(resolution="01d")
     18 

~/anaconda3/envs/mygmt/lib/python3.8/site-packages/pygmt/helpers/decorators.py in new_module(*args, **kwargs)
    372                         kwargs[arg] = separators[fmt].join(f"{item}" for item in value)
    373             # Execute the original function and return its output
--> 374             return module_func(*args, **kwargs)
    375 
    376         return new_module

~/anaconda3/envs/mygmt/lib/python3.8/site-packages/pygmt/datasets/earth_relief.py in load_earth_relief(resolution, region, registration)
    101                 f"'region' is required for Earth relief resolution '{resolution}'"
    102             )
--> 103         grid = grdcut(f"@earth_relief_{resolution}{reg}", region=region)
    104     else:
    105         raise GMTInvalidInput(f'Invalid Earth relief resolution "{resolution}"')

~/anaconda3/envs/mygmt/lib/python3.8/site-packages/pygmt/helpers/decorators.py in new_module(*args, **kwargs)
    235                 if alias in kwargs:
    236                     kwargs[arg] = kwargs.pop(alias)
--> 237             return module_func(*args, **kwargs)
    238 
    239         new_module.aliases = aliases

~/anaconda3/envs/mygmt/lib/python3.8/site-packages/pygmt/helpers/decorators.py in new_module(*args, **kwargs)
    372                         kwargs[arg] = separators[fmt].join(f"{item}" for item in value)
    373             # Execute the original function and return its output
--> 374             return module_func(*args, **kwargs)
    375 
    376         return new_module

~/anaconda3/envs/mygmt/lib/python3.8/site-packages/pygmt/gridops.py in grdcut(grid, **kwargs)
    104                 outgrid = kwargs["G"]
    105                 arg_str = " ".join([infile, build_arg_string(kwargs)])
--> 106                 lib.call_module("grdcut", arg_str)
    107 
    108         if outgrid == tmpfile.name:  # if user did not set outgrid, return DataArray

~/anaconda3/envs/mygmt/lib/python3.8/site-packages/pygmt/clib/session.py in call_module(self, module, args)
    500         )
    501         if status != 0:
--> 502             raise GMTCLibError(
    503                 "Module '{}' failed with status code {}:\n{}".format(
    504                     module, status, self._error_message

GMTCLibError: Module 'grdcut' failed with status code 71:
grdcut [ERROR]: Option -R parsing failure. Correct syntax:
grdcut [ERROR]: Offending option -R-180/180/90/-90

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.2.0
System information:
  python: 3.8.6 | packaged by conda-forge | (default, Oct  7 2020, 19:08:05)  [GCC 7.5.0]
  executable: /home/uliw/anaconda3/envs/mygmt/bin/python
  machine: Linux-5.6.14-1-default-x86_64-with-glibc2.10
Dependency information:
  numpy: 1.18.5
  pandas: 1.0.5
  xarray: 0.15.1
  netCDF4: 1.5.3
  packaging: 20.4
  ghostscript: 9.53.3
  gmt: 6.1.1
GMT library information:
  binary dir: /home/uliw/anaconda3/envs/mygmt/bin
  cores: 8
  grid layout: rows
  library path: /home/uliw/anaconda3/envs/mygmt/lib/libgmt.so
  padding: 2
  plugin dir: /home/uliw/anaconda3/envs/mygmt/lib/gmt/plugins
  share dir: /home/uliw/anaconda3/envs/mygmt/share/gmt
  version: 6.1.1
@seisman
Copy link
Member

seisman commented Oct 19, 2020

It should be -R-180/180/-90/90, not -R-180/180/90/-90.

region should be given by xmin/xmax/ymin/ymax.

@seisman seisman added the question Further information is requested label Oct 19, 2020
@uliw
Copy link
Author

uliw commented Oct 19, 2020 via email

@seisman seisman closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants