get lat lon from Viirs VNP09GA
get lat lon from Viirs VNP09GA
How can I get with Python the latitude and longitude from the Viirs VNP09GA file to generate coastlines.
Tried many examples without success.
Not technically inclined to calculate myself, so I think there should be a solution using UpperLeftPointMtrs and LowerRightMtrs?
I hope someone can help me out, thank you
Regards Ger
Tried many examples without success.
Not technically inclined to calculate myself, so I think there should be a solution using UpperLeftPointMtrs and LowerRightMtrs?
I hope someone can help me out, thank you
Regards Ger
Filters:
-
- User Services
- Posts: 420
- Joined: Mon Sep 30, 2019 10:00 am America/New_York
- Has thanked: 30 times
- Been thanked: 8 times
- Contact:
Re: get lat lon from Viirs VNP09GA
Hi @ger.smit I'll talk to our developers and see if they have any ideas and get back to you. In the meantime we'll open this up to the community to see if any other VIIRS users have any suggestions.
Subscribe to the LP DAAC listserv by sending a blank email to lpdaac-join@lists.nasa.gov.
Sign up for the Landsat listserv to receive the most up to date information about Landsat data: https://public.govdelivery.com/accounts/USDOIGS/subscriber/new#tab1.
Sign up for the Landsat listserv to receive the most up to date information about Landsat data: https://public.govdelivery.com/accounts/USDOIGS/subscriber/new#tab1.
-
- Subject Matter Expert
- Posts: 71
- Joined: Tue Nov 12, 2019 4:02 pm America/New_York
- Been thanked: 3 times
Re: get lat lon from Viirs VNP09GA
@ger.smit ,
Could you give more details about what you are trying to accomplish? Are you asking how extract pixels based on Lat/Lon or how to extract coastlines from an image (VNP09GA tile)? Also, please pass along any scripts or resources that you've been referencing.
Could you give more details about what you are trying to accomplish? Are you asking how extract pixels based on Lat/Lon or how to extract coastlines from an image (VNP09GA tile)? Also, please pass along any scripts or resources that you've been referencing.
Re: get lat lon from Viirs VNP09GA
I enjoy the images as downloaded and edited, the only thing that is wrong is the coastlines and country borders.
I've looked for a basis to find the lath and lon coordinates that the lines need, but I can't, I don't have that knowledge.
I borrowed the script from https://hdfeos.org/zoo/LPDAAC/VNP09GA.A2020305.h30v07.001.2020306101330.h5.py , and am working on getting the correct coordination using a script I found elsewhere.
But as I said, I can't and it is possible that you understand me and can provide a solution.
------- This is what i am doing now but without result -----------------
# Construct the grid. The needed information is in a string dataset
# called 'StructMetadata.0'. Use regular expressions to retrieve
# extents of the grid.
ul_regex = re.compile(r'''UpperLeftPointMtrs=\((?P<upper_left_x>[+-]?\d+\.\d+),(?P<upper_left_y>[+-]?\d+\.\d+)\)''', re.VERBOSE)
match = ul_regex.search(s)
x0 = np.float(match.group('upper_left_x'))
y0 = np.float(match.group('upper_left_y'))
lr_regex = re.compile(r'''LowerRightMtrs=\(
(?P<lower_right_x>[+-]?\d+\.\d+)
,
(?P<lower_right_y>[+-]?\d+\.\d+)
\)''', re.VERBOSE)
match = lr_regex.search(s)
x1 = np.float(match.group('lower_right_x'))
y1 = np.float(match.group('lower_right_y'))
ny, nx = data.shape
x = np.linspace(x0, x1, nx, endpoint=False)
y = np.linspace(y0, y1, ny, endpoint=False)
xv, yv = np.meshgrid(x, y)
lon = xv / 68000.0
lat = yv / 111000.0
print('lon -- lat : ',lon,'-- ',lat)
Thanks in advange and gretings
Ger
I've looked for a basis to find the lath and lon coordinates that the lines need, but I can't, I don't have that knowledge.
I borrowed the script from https://hdfeos.org/zoo/LPDAAC/VNP09GA.A2020305.h30v07.001.2020306101330.h5.py , and am working on getting the correct coordination using a script I found elsewhere.
But as I said, I can't and it is possible that you understand me and can provide a solution.
------- This is what i am doing now but without result -----------------
# Construct the grid. The needed information is in a string dataset
# called 'StructMetadata.0'. Use regular expressions to retrieve
# extents of the grid.
ul_regex = re.compile(r'''UpperLeftPointMtrs=\((?P<upper_left_x>[+-]?\d+\.\d+),(?P<upper_left_y>[+-]?\d+\.\d+)\)''', re.VERBOSE)
match = ul_regex.search(s)
x0 = np.float(match.group('upper_left_x'))
y0 = np.float(match.group('upper_left_y'))
lr_regex = re.compile(r'''LowerRightMtrs=\(
(?P<lower_right_x>[+-]?\d+\.\d+)
,
(?P<lower_right_y>[+-]?\d+\.\d+)
\)''', re.VERBOSE)
match = lr_regex.search(s)
x1 = np.float(match.group('lower_right_x'))
y1 = np.float(match.group('lower_right_y'))
ny, nx = data.shape
x = np.linspace(x0, x1, nx, endpoint=False)
y = np.linspace(y0, y1, ny, endpoint=False)
xv, yv = np.meshgrid(x, y)
lon = xv / 68000.0
lat = yv / 111000.0
print('lon -- lat : ',lon,'-- ',lat)
Thanks in advange and gretings
Ger
-
- Subject Matter Expert
- Posts: 71
- Joined: Tue Nov 12, 2019 4:02 pm America/New_York
- Been thanked: 3 times
Re: get lat lon from Viirs VNP09GA
@ger.smit ,
I'm still not quite sure if I'm understanding your objective, but maybe this will help you get started. I've started to update a VIIRS Python resource we have to support VNP09GA version 2 (https://git.earthdata.nasa.gov/projects/LPDUR/repos/nasa_viirs_surfacereflectance/browse/VIIRS_V2_SurfaceReflectance_Tutorial.ipynb?at=refs%2Fheads%2Fv2update). This will walk you through how to work with the VNP09GA file and in Step 7 show you how to grab and set the georeferencing info. Take a look and let me know if you have any questions.
Regarding your comment: "...the only thing that is wrong is the coastlines and country borders." Could you explain a bit more?
I'm still not quite sure if I'm understanding your objective, but maybe this will help you get started. I've started to update a VIIRS Python resource we have to support VNP09GA version 2 (https://git.earthdata.nasa.gov/projects/LPDUR/repos/nasa_viirs_surfacereflectance/browse/VIIRS_V2_SurfaceReflectance_Tutorial.ipynb?at=refs%2Fheads%2Fv2update). This will walk you through how to work with the VNP09GA file and in Step 7 show you how to grab and set the georeferencing info. Take a look and let me know if you have any questions.
Regarding your comment: "...the only thing that is wrong is the coastlines and country borders." Could you explain a bit more?
Re: get lat lon from Viirs VNP09GA
Your colleague eoshelp@hdfgroup.org helped me to create coastlines like in https://hdfeos.org/zoo/LPDAAC/VNP09GA.A2020305.h30v07.001.2020306101330.h5.py .
Is it also possible to create coastlines in the py file you provided https://git.earthdata.nasa.gov/projects/LPDUR/repos/nasa_viirs_surfacereflectance/browse/VIIRS_V2_SurfaceReflectance_Tutorial.ipynb?at=refs%2Fheads%2Fv2update .
This gives an idea if the clouds dominate.
Thanks for an answer and of course thanks for the explanation above.
Is it also possible to create coastlines in the py file you provided https://git.earthdata.nasa.gov/projects/LPDUR/repos/nasa_viirs_surfacereflectance/browse/VIIRS_V2_SurfaceReflectance_Tutorial.ipynb?at=refs%2Fheads%2Fv2update .
This gives an idea if the clouds dominate.
Thanks for an answer and of course thanks for the explanation above.
-
- User Services
- Posts: 342
- Joined: Mon Sep 30, 2019 12:39 pm America/New_York
- Has thanked: 10 times
Re: get lat lon from Viirs VNP09GA
@ger.smit Thank you for your message. After further review, our science team has no further recommendations.
LP DAAC User Services
LP DAAC User Services