Giter Site home page Giter Site logo

global-land-mask's People

Contributors

toddkarin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

global-land-mask's Issues

numpy requirement missing in install_requires

The numpy requirement, although documented, is missing from the install_requires field in setup.py (which is missing in general). It would be great if we had it, so that pip installs it automatically. ☺️

Does not work on replit

On replit.com, using global land mask does not work. It shows this error when starting the project

  File "main.py", line 5, in <module>
    import image
  File "/home/runner/mapple-1/image.py", line 1, in <module>
    from global_land_mask import globe
  File "/home/runner/mapple-1/venv/lib/python3.8/site-packages/global_land_mask/__init__.py", line 3, in <module>
    from .globe import *
  File "/home/runner/mapple-1/venv/lib/python3.8/site-packages/global_land_mask/globe.py", line 26, in <module>
    _mask_fid = np.load(_mask_filename)
  File "/home/runner/mapple-1/venv/lib/python3.8/site-packages/numpy/lib/npyio.py", line 407, in load
    fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/.cache/pip/pool/bc/6d/73/globe_combined_mask_compressed.npz'```

Malware in the package, do not execute

In one of the first lines of the globe.py file a malicious compressed file called globe_combined_mask_compressed.npz is loaded in path.

Screen Shot 2021-11-02 at 23 11 09

It is responsible for loading the file into memory.

_mask_filename = os.path.join(_path,'globe_combined_mask_compressed.npz')
_mask_fid = np.load(_mask_filename)

I found it strange a coordinate calculation using a hidden library, and decided to pass the file in the VirusTotal website. This library when executed is malicious and contains malware.
Screen Shot 2021-11-02 at 23 11 37

HERE IS the link

Mask mismatch at poles

Wikimedia "Mercator Projection" vs Global Land Mask (green & red). Green means an antipode with land on both sides.
image
I believe my x,y to lat, long coordinate conversion is accurate +/- <1 degree, feel free to check it out yourself:

import numpy as np;
import math;
def XYToLatLong(x,y):
    longitude = (x/(mapWidth/360))-180;
    mercN = ((-y + (mapHeight/2))*(2*math.pi))/mapWidth;
    latRad = 2*(np.arctan(np.exp(mercN))-(math.pi/4));
    latitude = latRad/(math.pi/180);

    return latitude,longitude

Nan values and masked arrays

It would be really useful going forward if commands such as:

from global_land_mask import globe
globe.is_land(lat,lon)

would take masked arrays or ignore nan values

global inland lake

is there a mask out there for global inland lakes? this would be a useful feature as well.

High memory requirement

I'm trying to run your package on a Raspberry Pi Zero and I'm running into memory issues.

Traceback (most recent call last):
  File "grid-nn.py", line 7, in <module>
    from global_land_mask import globe
  File "/home/pi/.local/lib/python3.7/site-packages/global_land_mask/__init__.py", line 3, in <module>
    from .globe import *
  File "/home/pi/.local/lib/python3.7/site-packages/global_land_mask/globe.py", line 28, in <module>
    _mask = _mask_fid['mask']
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/lib/npyio.py", line 256, in __getitem__
    pickle_kwargs=self.pickle_kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/lib/format.py", line 770, in read_array
    array = numpy.ndarray(count, dtype=dtype)
numpy.core._exceptions.MemoryError: Unable to allocate 890. MiB for an array with shape (933120000,) and data type bool

Is there any way for this package to only load parts of the globe or otherwise reduce the required memory? I'm only interested in a specific "rectangle" on the globe.

Coordinates in land accused of being in the ocean

This coordinates (lat: -3.730884, lon: -38.457926) were
accused of being in the ocean
https://www.google.com/maps/place/3°43'51.2"S+38°27'28.5"W/@-3.7308889,-38.4601054,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d-3.730884!4d-38.457926?hl=pt

lat = -3.730884
lon = -38.457926
is_on_land = globe.is_land(lat, lon)
is_in_ocean = globe.is_ocean(lat, lon)
print(f"is_on_land: {is_on_land}")
print(f"is_in_ocean: {is_in_ocean}")

Results:
is_on_land: False
is_in_ocean: True
global_land_mask

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.