I want to visualize MYD11_L2 in Panoply, so I need lat/long at the same resolution as the LST data; Panoply does not grok the Coarse lat/longs.
I ended up dumping lat/lon to text from MYD03 with hdp, converting MYD11_L2 to HDF5, ncdumping to CDL, and then vi’ing the CDL to flatten the hierarchy and import the text that I dumped in the first step. That worked, but cannot be the easiest way…
What is the proper way?
What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?
-
- Posts: 248
- Joined: Thu Jun 25, 2020 9:51 am America/New_York
- Been thanked: 9 times
Re: What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?
Hi,
Yes, the swath data only has geolocation information every 5 scans. The suggested way to project is to use the corresponding MOD03 Gelocation swath, which can be downloaded through the NASA LAADS site: https://ladsweb.modaps.eosdis.nasa.gov/ ... cts/MYD03/
The NASA HEG tool was developed to project and reproject many NASA products, including the the Level1 swath data: https://wiki.earthdata.nasa.gov/display ... rsion+Tool
Thanks,
Brett
Yes, the swath data only has geolocation information every 5 scans. The suggested way to project is to use the corresponding MOD03 Gelocation swath, which can be downloaded through the NASA LAADS site: https://ladsweb.modaps.eosdis.nasa.gov/ ... cts/MYD03/
The NASA HEG tool was developed to project and reproject many NASA products, including the the Level1 swath data: https://wiki.earthdata.nasa.gov/display ... rsion+Tool
Thanks,
Brett
Re: What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?
I want to use the data in native sensor coords, not reprojected. Eventually I developed a recipe using NCO:
#! /usr/bin/env python
import os
import sys
lst_h4 = sys.argv[1]
geo_h4 = sys.argv[2]
# Convert from HDF4 to netcdf-compatible HDF5 so we can use NCO
lst_h5 = lst_h4.replace('.hdf','.h5')
os.system(f"./h4toh5convert -osna {lst_h4} {lst_h5}")
geo_h5 = geo_h4.replace('.hdf','.h5')
os.system(f"./h4toh5convert -osna {geo_h4} {geo_h5}")
# Extract LST from MYD11
lst_sub = lst_h5.replace('.h5','.sub.h5')
os.system(f"ncks -v LST -G : -O {lst_h5} {lst_sub}")
# Extract Latitude, Longitude from MYD13
geo_sub = geo_h5.replace('.h5','.sub.h5')
# Don't know why I have to add -A to not error out...or why it even works.
if os.path.exists(geo_sub):
os.unlink(geo_sub)
os.system(f"ncks -A -v Latitude,Longitude -G : {geo_h5} {geo_sub}")
# Rename dimensions in geo subset to match LST subset
os.system(f"ncrename -d phony_dim_4,phony_dim_0 -d phony_dim_5,phony_dim_1 -O {geo_sub} {geo_sub}")
# Append geo subset to LST file
os.system(f"ncks -A {geo_sub} {lst_sub}")
# Fix coordinates to be CF-compliant
os.system(f"ncatted -a units,Latitude,o,c,degrees_north -a units,Longitude,o,c,degrees_east -a coordinates,LST,c,c,'Latitude Longitude' -O {lst_sub} {lst_sub}")
print(lst_sub)
#! /usr/bin/env python
import os
import sys
lst_h4 = sys.argv[1]
geo_h4 = sys.argv[2]
# Convert from HDF4 to netcdf-compatible HDF5 so we can use NCO
lst_h5 = lst_h4.replace('.hdf','.h5')
os.system(f"./h4toh5convert -osna {lst_h4} {lst_h5}")
geo_h5 = geo_h4.replace('.hdf','.h5')
os.system(f"./h4toh5convert -osna {geo_h4} {geo_h5}")
# Extract LST from MYD11
lst_sub = lst_h5.replace('.h5','.sub.h5')
os.system(f"ncks -v LST -G : -O {lst_h5} {lst_sub}")
# Extract Latitude, Longitude from MYD13
geo_sub = geo_h5.replace('.h5','.sub.h5')
# Don't know why I have to add -A to not error out...or why it even works.
if os.path.exists(geo_sub):
os.unlink(geo_sub)
os.system(f"ncks -A -v Latitude,Longitude -G : {geo_h5} {geo_sub}")
# Rename dimensions in geo subset to match LST subset
os.system(f"ncrename -d phony_dim_4,phony_dim_0 -d phony_dim_5,phony_dim_1 -O {geo_sub} {geo_sub}")
# Append geo subset to LST file
os.system(f"ncks -A {geo_sub} {lst_sub}")
# Fix coordinates to be CF-compliant
os.system(f"ncatted -a units,Latitude,o,c,degrees_north -a units,Longitude,o,c,degrees_east -a coordinates,LST,c,c,'Latitude Longitude' -O {lst_sub} {lst_sub}")
print(lst_sub)
- Attachments
-
- LST_in_MYD11_L2.A2021096.0845.006.2021097170907.s.png (334.42 KiB) Not viewed yet