land mask for equal distance grid?
as newbie, I am happy I found this tool and forum. After some research I could not see/understand if my issue is already resolved.
I would like to create a land mask. The mask should fit with some modis data. The data are in 250m spatial resolution. I use the following command:
gmt grdlandmask -R-100.995/10.995/63.005/82.995 -Df -I250e -N0/1 -Gland_mask_gmt.nc -V
Then I need to reproject the data to a polar grid and I am using gdal:
gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3413 -wo SOURCE_EXTRA=1000 land_mask_gmt.nc output.tiff
After loading the data in qgis and measuring the finest cells, I see that the resolution differs from the desired one and further, seems that the cells are not all equal. Since the further north you get the distance is changing, is there a way to create a land mask with equal distance cells in x and y direction? I see that I can define the bounding box as 4square box by the argument:
I guess in order to create an equal distance grid that would require to define explicitly the 4 corners; so that each corner has its own lat/lon value?
RE: land mask for equal distance grid? - Added by Paul 30 days ago
No, but you have given me an idea for an extension to grdlandmask to allow output grids that considers a projection. Then one could create equidistant projected grids which are what you want at hight latitudes. Your workaround today may be to make a finer grid (e.g. 100e) then use grdproject to do the projection and request a square grid size. Unless gdalwarp can do the same, of course.
RE: land mask for equal distance grid? - Added by Panagiotis 29 days ago
Many thanks for your reply and, this extension would be really great. I will give it a go the way you suggested and I will come back to show the details.
RE: land mask for equal distance grid? - Added by Panagiotis 14 days ago
It took some days due to other priorities but here as promised the work around:
first we create the mask:
west / east / south/north resolution(**f**ull) grid spacing in meters node values
gmt grdlandmask -R-115.995/15.995/62.005/83.995 -Df -I100e -N0/1 -Gland_mask.nc -V
Then we reproject using gdal setting our output resolution to 250m for both directions:
gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3413 -tr 250 250 -wo SOURCE_EXTRA=1000 land_mask.nc output.tiff
Some extra question: Unfortunately the closer to the pole we are, the worst the shorelines are. And this includes particularly the gshhs shorelines. I am wondering if there is a way to use other shoreline shapefiles to create the land mask. In case that someone faces the same problem, I found that shapefiles from http://openstreetmapdata.com/ are more precise for the higher latitudes.