Dear forum members,
If I export an image as NetCDF, SNAP writes an extra set of coordinates: lat, lon. These coordinates has the same dimensions as the bands, i.e. they are two dimensional (2D). What seems natural to me, is to make longitude 1D of length X and latitude 1D of length Y.
I’m trying to extract pixels without Pixel Extraction Tool. If I do it on 2D coordinates, I would have to calculate metric distances to all pixels from the target point and find an index of minimum. With 1D coordinates simple
argmin(abs(lat - lat_target)), argmin(abs(lon - lat_target)) would be enough.
In this respect, how can I get 1D lat and lon?
Reprojection did not help.
A follow up. When I open an exported NetCDF in python
xarray, which has a concept of dimensions (1D) and coordinates, I see SNAP’s 2D
lat, lon as coordinates, each having 2 dimensions:
lat_intern, lon_intern. I assume the dimensions are added by xarray, however their values are just integer indices (range), and I need decimal degree coordinates.
@marpet this is something for you to have a look…
Personally I suspect it may have to do with conventions for variables in netCDF… @Prikaziuk which convention/implementation are you basing your expectations on?
I download ERA data and they do it with 1D coordinates, which advantage is the easy search.
In any case conventions are not written within NetCDF itself, are they? It’s hard to judge if it is CF or BEAM.
Furthermore, my expectations are based on the natural logic: all pixels of the image are equal in size. Maybe not in metric size as in UTM, but still. Am I mistaken?