Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 12:17
    HARSHBARDHANK94 closed #2046
  • 12:17
    HARSHBARDHANK94 commented #2046
  • 12:15
    fahdiscoding97 commented #1528
  • 12:05
    stefraynaud commented #2046
  • 09:20
    HARSHBARDHANK94 opened #2046
  • May 16 22:26
    kconnour opened #2045
  • May 12 18:37
    dopplershift commented #1437
  • May 12 04:45
    judd147 commented #1437
  • May 11 01:58

    greglucas on main

    examples: define 'sample_data' … Merge pull request #2044 from p… (compare)

  • May 11 01:58
    greglucas closed #2044
  • May 11 01:48
    greglucas milestoned #2044
  • May 11 01:48
    greglucas labeled #2044
  • May 10 15:10
    phil-blain synchronize #2044
  • May 10 15:08
    phil-blain opened #2044
  • May 06 23:11
    MHBalsmeier commented #805
  • May 03 19:38
    greglucas labeled #2043
  • May 03 19:38
    greglucas commented #2043
  • May 03 12:59
    ReagentX commented #2043
  • May 03 03:32
    ReagentX closed #2043
  • May 03 03:32
    ReagentX commented #2043
Greg Lucas
@greglucas
No, that is the new location of the data. It is an AWS s3 resource with no login required. My guess is you are hitting many sites that serve their resources through AWS, so it is likely very hard to avoid them ;)
Karl Schneider
@karlwx
img_1.PNG
img_2.PNG
Sorry, those were supposed to be in that thread @greglucas. Weird behavior here. I'm pretty sure image 2 just results in a blank image because when I take off the cartopy features and set_extent, there's still nothing
Karl Schneider
@karlwx
img_3.PNG
Tried with pcolormesh (passing rgba tuples to color kwarg) and the transform works, but all these dots appear. Frustrating day!
Greg Lucas
@greglucas
Hm... My initial guess is that your image 2 may have to do with you using img1.size as the regrid_shape argument. That will be nm4 for an (n, m) RGBA image, not just the shape of the output, so I'm guessing that is producing a really large output array that may cause issues with the queries...? Just a stab in the dark there. I'd try just setting it to a large value at first (2000) and see if that works and increase appropriately to your problem. For the second pcolormesh idea, I'm not sure that pcolormesh takes RGBA tuples...? So it could be doing some odd resampling based on the strides in your array to produce those dots, or reordering the data in an odd way.
1 reply
Clément
@ludwigVonKoopa

Hi all, i want to test some modification on cartopy, so i forked the project and did python setup.py install to install it localy.
I got a error ModuleNotFoundError: No module named 'cartopy._version'

I saw that in v0.18 there was a file _version.py in the cartopy project, but there isn"t anymore. Do i have to do extra step to use it locally ? Thanks

image.png
Clément
@ludwigVonKoopa
ok i found in a commit message SciTools/cartopy@9ecdbb5 that i need setuptools-scm to be installed.
Greg Lucas
@greglucas
There is an environment.yml file listing a bunch of dependencies in the base repo now that you can use to create a new conda environment that will be able to compile/install Cartopy for testing. You can also just use that as a reference for which packages you'd need. There are also some install_requires and requirements.txt files for different dependencies
Karl Schneider
@karlwx
I'm experiencing some weirdness with pcolormesh. I'm trying to pass the kwarg shading='nearest', which per the matplotlib docs will work when C has the same dimensions of X and Y. It seems like the cartopy transformation adds an element to X and Y because I get the error: TypeError: Dimensions of C (300, 400) are incompatible with X (401) and/or Y (301); see help(pcolormesh)
Even though I double checked and the shape of C (300, 400) is the same as my input X and Y. I've tested and the same line that works with plain matplotlib fails with cartopy.
Greg Lucas
@greglucas
Possibly this: SciTools/cartopy#1892
Elliott Sales de Andrade
@QuLogic
I just noticed there's a tag for 0.20.1, but not a release, so I turned it into one
I don't think this makes much difference for anyone, except the GitHub UI
Karl Schneider
@karlwx
Thanks Greg, I didn't see that PR in my searches related to that issue. Upgraded to 0.20.1 and am happy to report that things are working as expected!
JuanJose9611
@JuanJose9611
Hi all, im trying to replicate the following srtm shading example https://scitools.org.uk/cartopy/docs/v0.14/examples/srtm_shading.html however when i run the code i get this error UserWarning: SRTM requires an account set up and log in to access. Use of this Downloader is likely to fail with HTTP 401 errors. warnings.warn('SRTM requires an account set up and log in to access.. I have looked at the documentation thoroughly and i can't find anything regarding this. Is there a new version of the srtm_shading example? Thanks.
Elliott Sales de Andrade
@QuLogic
The SRTM data requires an EarthData login
There is no direct API for setting that, but it uses regular urlopen, so you can set a password override using that
JuanJose9611
@JuanJose9611
Thank you for your answer Elliott, i will look into it.
Greg Lucas
@greglucas
Elliot, any interest in PRing your branch that removes the final PROJ dependencies in trace? QuLogic/cartopy@d109aac
I still think the benefits outweigh the decreased speed of spherical interpolators. Especially with all of the recent PROJ installation issues being opened.
Ryan May
@dopplershift
:+1: To that, we're caught in the middle of the worst of both worlds. We got slower, but we're also even more of a pain to install...
Leonardo
@leonardojimenez1990

Hello, someone how can I solve this problem?
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.24.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import cartopy.crs as ccrs

ImportError Traceback (most recent call last)

<ipython-input-1-139fa5ad2567> in <module>
----> 1 import cartopy.crs as ccrs

~/.local/lib/python3.8/site-packages/cartopy/init.py in <module>
102 # Commonly used sub-modules. Imported here to provide end-user
103 # convenience.
--> 104 import cartopy.crs
105 import cartopy.feature # noqa: F401 (flake8 = unused import)

~/.local/lib/python3.8/site-packages/cartopy/crs.py in <module>
20 from shapely.prepared import prep
21
---> 22 from cartopy._crs import (CRS, Geodetic, Globe, PROJ4_VERSION,
23 WGS84_SEMIMAJOR_AXIS, WGS84_SEMIMINOR_AXIS)
24 from cartopy._crs import Geocentric # noqa: F401 (flake8 = unused import)

ImportError: libproj.so.19: cannot open shared object file: No such file or directory

Leonardo
@leonardojimenez1990
Hi, How can I install Cartopy? I get the error:
pip3 install cartopy==0.20.2 --no-warn-script-location
Defaulting to user installation because normal site-packages is not writeable
Collecting cartopy==0.20.2
Using cached Cartopy-0.20.2.tar.gz (10.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /home/leo/.local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpxc5rsxyg
cwd: /tmp/pip-install-edx6ys1f/cartopy_faed090c1dd0401bb4dbbd520024780d
Complete output (3 lines):
setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
warnings.warn(

Proj 8.0.0 must be installed.

Ryan May
@dopplershift
Make sure you use your Linux package manager to install libproj-dev and libgeos-dev (or their equivalents) and that libproj-dev is at least version 8. If that's not possible, I'd recommend installing using conda, following the official install instructions: https://scitools.org.uk/cartopy/docs/latest/installing.html#conda-pre-built-binaries
Leonardo
@leonardojimenez1990
Thank you very much @dopplershift . I have not been able to install proj 8. Do you know a way to install proj 8?
Successfully built cartopy
Installing collected packages: cartopy
Successfully installed cartopy-0.19.0.post1
Greg Lucas
@greglucas
Their install page lists the many ways to install it: https://proj.org/install.html
Miles Engel
@Pheosics
Does anyone have any experience with creating satellite coverage maps using cartopy? I've managed to figure out how to properly change map projections and things like that, but anytime I attempt to apply a transformation to a patch or a ShapelyFeature I don't get anything.
Ryan May
@dopplershift
I've not done anything like that before. Would need to see a complete, self-contained example to try to debug.
Greg Lucas
@greglucas
Yes, I work with plotting satellite data and passes. Have you binned your data into a grid and are trying to plot that? Or trying to plot the ground tracks of satellites? My guess is that if you are not able to transform anything is that you're using the incorrect transform for your data coordinates. If you have lat/lon ground tracks use the PlateCarree/Geodetic input to the function call, and then whatever projection you want in the Axes() creation calls. But, remember the transform=data for the plotting function calls.
Miles Engel
@Pheosics
test_0000.gif
What I have is the TLE of a satellite (or the actual ephemeris data, depending on the satellite) and would like to plot a field of view coverage area (assuming some fixed field of view), the circle gets plotted, but it doesn't get properly transformed to account for the geodetic Earth
Greg Lucas
@greglucas
You may want to look at the Nightshade implementation which follows the subsolar point and handles some curvatures in that way. https://scitools.org.uk/cartopy/docs/latest/gallery/lines_and_polygons/nightshade.html https://github.com/SciTools/cartopy/blob/main/lib/cartopy/feature/nightshade.py
Miles Engel
@Pheosics
Thanks, I will look at that. I also found this example, https://scitools.org.uk/cartopy/docs/v0.10/examples/geostationary.html, which seems to take a circular image and uses the Geostationary reference frame to transform it into a more expected shape. I'm guessing this won't work for an arbitrary satellite location, but maybe I can figure out something by looking at that code
Ryan May
@dopplershift
@Pheosics That example is using the transform framework to transform the image (which has circular extent) to the desired Miller projection for the map. For arbitrary satellite location, you might also be interested in NearsidePerspective.
Miles Engel
@Pheosics
Hmm, NearsidePerspective does seem to be what I want... it looks like it can take the lat/lon/alt of the satellite and do a transformation. The projected coordinates are supposed to be an x,y measured from the origin of the plane tangent to the Earth directly below the satellite. That should be easy enough to calculate. I'm guessing thats x,y in meters?
Ryan May
@dopplershift
Correct. I'm still curious why that isn't what happens to the circle patch, though.
Greg Lucas
@greglucas
image.png
I'm confused now... I think it does happen for the Circle() patch.
import matplotlib.pyplot as plt
import cartopy.crs as ccrs

fig, ax = plt.subplots(subplot_kw={"projection": ccrs.Robinson()})

ax.coastlines()
patch = plt.Circle((140, 20), 20, color='g',
                   alpha=0.5, transform=ccrs.PlateCarree().as_geodetic())
ax.add_patch(patch)
ax.set_global()

plt.show()
Miles Engel
@Pheosics
interesting, that is what I expected to see, but not what I was seeing in my code, the only thing I can see as different is instead of the transform using ccrs.PlateCarree().as_geodetic() I just used ccrs.Geodetic()
Greg Lucas
@greglucas
Should be the same thing I think. Yours is just the quicker version :) Note that all of the Circle parameters are then in degrees, including the radius, which may or may not be what you want.
Miles Engel
@Pheosics
hmm, that could have been the issue, I will have to investigate tomorrow when I am back in front of the computer. Thank you both for your help, I'll update tomorrow with whatever I was doing wrong
Miles Engel
@Pheosics
So it seems like my issue was that I was using the PlateCarree projection with a Geodetic transformation which didn't alter the shape of the circle. Using Robinson and Geodetic did alter the circle in a way consistent with the coordinate transformation, but also made me realize that I will either need to figure out NearsidePerspective or perform a more detailed calculation for determining the view coverage as a circle doesn't just become a rounded rectangle by coordinate transformation, but instead by field of view mapping
Ryan May
@dopplershift
@Pheosics Having gone through the math for all that, you may be better off just copying the code in NearsidePerspective/Satellite that calculates that boundary.
Miles Engel
@Pheosics
looks like NearsidePerspective gives me what I need (or at least something that looks a lot like what I need). The only tricky thing is that if your radius is too large it just won't plot anything. Luckily it seems my calculation of the circle from before is enough to limit the radius to something it will correctly plot
test_NP.gif
Ryan May
@dopplershift
@Pheosics I'm not sure what your radius represents? The math in NearsidePerspective is calculating based on tangent lines for a given satellite height.
Miles Engel
@Pheosics
By radius I mean the radius of the circle that is formed when you draw a cone from the satellite down to a tangent plane which is centered right below the satellite. Of course if the satellite is far away or has a large enough look angle, the circle formed will be larger than the cross section of the Earth, so you have to limit it. In an ideal world NearsidePerspective would handle that, but it seems like it doesn't and so if you create a circle with too large of radius and try and use NearsidePerspective to display it it will just not display anything.
Ryan May
@dopplershift
So Nearside perspective is calculating purely where the line from the satellite is tangent to the surface of the earth—so the physical limit one can see without looking through rock. It’s not using any kind of field of view limit from the satellite.
George Duffy
@CowboyGeorge

Hello. I just installed Cartopy on a new MacOS Pro 13", running Monterey. I just tried to copy the tutorial script "https://scitools.org.uk/cartopy/docs/latest/gallery/lines_and_polygons/always_circular_stereo.html", and I'm getting an error at the line where i'm supposed to apply cfeature.LAND,
"PermissionError: [Errno 13] Permission denied: '~/.local/share/cartopy'"

I don't have "cartopy" directory in /.local/share/, which seems like problem. I've tried reinstalling to no avail (using the conda forge), and I haven't seen any similar problems on stack overflow or anything similar. Any ideas on what could be going wrong?