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

Added example of setting projection using EPSG, and modified rgb_example to incorporate this #3622

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bwwjohnson
Copy link

@bwwjohnson bwwjohnson commented Nov 16, 2024

Description of proposed changes

Two changes:

  1. Responding to Issue Add an example of setting the projection using EPSG codes to the gallery #2004 I implemented a quick example of using coast with web mercator projection (EPSG:3857), referring to rgb_example as a place where this might be useful to use
  2. I attempted to modify rgb_example to add a coastline to the image using the EPSG number and region given in the example.

Unfortunately 2. has not worked yet for some reason as the region specification is throwing an error:

coast [WARNING]: For a UTM or TM projection, your region 738000/755000/2300000/2318000+Uk is too large to be in degrees and thus assumed to be in meters
coast [ERROR]: UTM projection insufficiently specified to auto-determine geographic region
coast [ERROR]: Option -R parsing failure. Correct syntax:

-R<west>/<east>/<south>/<north>[+r]
Specify the min/max coordinates of your data region in user units. Use dd:mm[:ss] for regions
     given in arc degrees, minutes [and seconds]. Use -R<xmin>/<xmax>/<ymin>/<ymax>[+u<unit>] for
     regions given in projected coordinates, with <unit> selected from e|f|k|M|n|u [e]. If +u is
     set, projected regions centered on (0,0) may beset via -R<halfwidth>[/<halfheight>]+u<unit>,
     where <halfheight> defaults to <halfwidth> if not given. Use
     [yyyy[-mm[-dd]]]T[hh[:mm[:ss[.xxx]]]] format for time axes. Append +r if -R specifies the
     coordinates of the lower left and upper right corners of a rectangular area.
Use -Re and -Ra to set exact or approximate regions based on your input data (if applicable).
     Use -R<gridfile> to use its limits (and increments if applicable). Use -Rg and -Rd as
     shorthand for -R0/360/-90/90 and -R-180/180/-90/90. Derive region from closed polygons from
     the Digital Chart of the World (DCW): Append a comma-separated list of ISO 3166 codes for
     countries to set region, i.e., <code1>,<code2>,... etc., using the 2-character ISO country
     codes (see pscoast -E+l for list). To select a state of a country (if available), append
     .state, e.g, US.TX for Texas. To select a whole continent, give the full name as <code> (e.g,
     -RAfrica). To select a DCW collection, give collection tag as <code> (see pscoast -E+n for
     list). Use +r to modify the region from polygon(s): Append <inc>, <xinc>/<yinc>, or <winc>/⏎
     …<einc>/<sinc>/<ninc> to round region to these multiples; use +R to extend region by those
     increments instead, or use +e which is like +r but makes sure the region extends at least by
     0.25 x <inc>.
Alternatively, use -R<code><x0>/<y0>/<n_columns>/<n_rows> for origin and grid dimensions,
     where <code> is a 2-char combo from [T|M|B][L|C|R] (top/middle/bottom/left/center/right) and
     grid spacing must be specified via -I<dx>[/<dy>] (also see -r).
coast [ERROR]: Offending option -R738000/755000/2300000/2318000+Uk

Could I get help with point 2. as I think it demonstrates the value of using EPSG to specify projections, and it is very useful to be able to plot additional features on top of pre-projected data. (e.g. example 28 on the OG GMT https://docs.generic-mapping-tools.org/latest/gallery/ex28.html).

Fixes #

Preview:

Reminders

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

Copy link

welcome bot commented Nov 16, 2024

💖 Thanks for opening this pull request! 💖

Please make sure you read our contributing guidelines and abide by our code of conduct.

A few things to keep in mind:

  • If you need help writing tests, take a look at the existing ones for inspiration. If you don't know where to start, let us know and we'll walk you through it.
  • All new features should be documented. It helps to write the docstrings for your functions/classes before writing the code. This will help you think about your code design and results in better code.
  • No matter what, we are really grateful that you put in the effort to do this! 🎉

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Nov 16, 2024
@yvonnefroehlich yvonnefroehlich added this to the 0.14.0 milestone Nov 16, 2024
@yvonnefroehlich
Copy link
Member

yvonnefroehlich commented Nov 18, 2024

Hi @bwwjohnson,
Great that you started working on this quite old issue 🙂. I think we start with this part.

Regarding plotting features on top of the RGB image example (e.g., the built-in GMT coastlines) I am unsure, and I feel we should handle this in a second step.

Please note, that some of us are currently preparing materials for AGU, so answers may be a bit delayed.


Regarding the failing Style checks:

Run make check
ruff check pygmt doc/conf.py examples
examples/projections/misc/misc_epsg.py:1:1: EXE002 The file is executable but no shebang is present
Found 1 error.
make: *** [Makefile:67: check] Error 1
Error: Process completed with exit code 2.

This indicates that your Python script has execution permission, which is not allowed here.

@bwwjohnson
Copy link
Author

Thanks Yvonne, noted about AGU! I think the EPSG specification not working is an upstream issue within GMT so not worth adding now. I will tidy up the EPSG projection example and remove the changes to rgb_example.

@seisman seisman marked this pull request as draft November 20, 2024 02:27
@seisman
Copy link
Member

seisman commented Nov 20, 2024

I have converted to PR to draft status to save our CI resources. Please click the "Ready for review" when you think the PR is finished. Thanks.

@yvonnefroehlich yvonnefroehlich mentioned this pull request Dec 16, 2024
49 tasks
@seisman
Copy link
Member

seisman commented Dec 19, 2024

@bwwjohnson First of all, thank you for opening this PR. Since we're planning to release v0.14.0 at the end of this year, I'm wondering if you have time to finish this PR before the release date.

@seisman seisman removed this from the 0.14.0 milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants