[gdal-dev] NetCDF and EASE-2

Marsh, Chris chris.marsh at usask.ca
Sat Feb 1 16:37:04 PST 2020


Thanks this may be a good option 2 if I can't get even's solution to work. Seems straightforward, agreed on mask!

On Sat, Feb 1, 2020 at 15:52 Markus Metz <markus.metz.giswork at gmail.com<mailto:markus.metz.giswork at gmail.com>> wrote:
CAUTION: This email originated from outside of the University of Saskatchewan. Do not click links or open attachments unless you recognize the sender and know the content is safe. If in doubt, please forward suspicious emails to phishing at usask.ca<mailto:phishing at usask.ca>

Regarding this EASE-2 grid (https://nsidc.org/ease/ease-grid-projection-gt), I found that

On Sat, Feb 1, 2020 at 1:22 PM Even Rouault <even.rouault at spatialys.com<mailto:even.rouault at spatialys.com>> wrote:

> - the spacing of the lat variable is not constant

the spacing of the lat variable increases drastically towards the poles.

You could convert the netcdf file to xyz text format, then treat it as vector points and interpolate a grid surface from these points with appropriate parameters. This should preserve the original values at the original xy locations and should take care of the increasing spacing of the lat variable towards the poles. Regarding your use case of snow depth, a land mask could speed up the interpolation step, skipping oceans.

>
> I've a somewhat complicated workflow to propose to create a georeferenced
> GeoTIFF file. It assumes you are running GDAL master 3.1.0dev to be able to
> use the gdalmdimtranslate utility
>
> 1) Create a tiled geotiff
>
> gdal_translate NETCDF:"SD_20160901.nc":snd_upd out.tif -co TILED=YES
>
> 2) Transpose it, and also mirror the values in the x and y directions. I'm not
> sure why this mirroring is needed at all (at least the one in the horizontal
> direction. The one in the version direction might perhaps be explained by a
> north-up vs south-up convention difference between netCDF and GeoTIFF)
>
> gdalmdimtranslate out.tif out2.tif -co TILED=YES \
>     -array band=1,transpose=[1,0],view=[::-1,::-1]
>
> (in theory 1. and 2. could be merged in a single step, but doing the
> transposition on the initial netCDF file will be very inefficient. Doing it on
> a source tiled file is the best)
>
> 3) Create a out2.tif.aux.xml file with the following content
>
> <PAMDataset>
>   <Metadata domain="GEOLOCATION">
>     <MDI key="LINE_OFFSET">0</MDI>
>     <MDI key="LINE_STEP">1</MDI>
>     <MDI key="PIXEL_OFFSET">0</MDI>
>     <MDI key="PIXEL_STEP">1</MDI>
>     <MDI key="SRS">EPSG:4326</MDI>
>     <MDI key="X_BAND">1</MDI>
>     <MDI key="X_DATASET">NETCDF:"SD_20160901.nc":lon</MDI>
>     <MDI key="Y_BAND">1</MDI>
>     <MDI key="Y_DATASET">NETCDF:"SD_20160901.nc":lat</MDI>
>   </Metadata>
> </PAMDataset>
>
> 4) Warp it:
>
> gdalwarp out2.tif out3.tif -overwrite -co TILED=YES
>
> Even
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Chris Marsh, PhD
University of Saskatchewan
chrismarsh.ca<http://chrismarsh.ca/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200202/bd0cad18/attachment-0001.html>


More information about the gdal-dev mailing list