I am looking for access to longitude, latitude data of shoreline. In pyGMT documentation is totally clear how to achieve coast-plotting but I wonder if it is possible to only load this data in a variable to work with it.
I think that creating a direct method to do this, will be a really useful feature to access GSHHG coastlines from python environments. If you know about any other library to do that please let me know.
Yes the whole shoreline or a subset. I think that the method will be something like the one you have for strm data, I think that is the same but for the GSHHG dataset. something like:
Thank you @biggle1856 it is a solution, but I have to implement this for operational tools coded in python so I rather prefer to use some python library wrappers if possible first, and then if it is no other way use external calls to another kind of software.
However, I think that the method that I suggest will be very useful for pyGMT users… if there is no way so far.
BUT. This is probably not what you expect. The GSHHG dataset has a particular memory organization (to be efficient 30 years ago) that makes contiguous by chunks (bins whose size depends on the resolution) but not between chunks.
The alternative is to use the DCW dataset, which is contiguous along the coast. Then you would use
D = coast(DCW=:ES, dump=true);
You can also access the GMT.jl from Python if you install the pyjulia package but have not tried this for a long time and not sure how it’s working now.
Thank you @Joaquim, that is exactly what I need. Indeed, I need a global coastline provider with good resolution but it has not to be GSHHG specifically.
Can anyone confirm that there is no similar method in python wrapper, pyGMT or similar? I think It would be a good feature request for pyGMT, what do you think?
@aragong you have other options. Namely, the GSHHS coastlines are also distributed as shape files (not sure where but I know that Paul have made them) that you can read using some python package that can read the (awful) shapefile format.
Another alternative is like I said at the end of my post. With the pyjulia package you can run the Julia programs (i.e., GMT.jl), as well as the converse from Julia using the pycall package.
Sure, thank you again.
I downloaded GSHHS shp-files from GSHHG web and I’m gonna try to read them using geopandas to achieve the final pandas.dataframe. I think is the most “standard” way…