What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?

Please enter here to ask a question about any NASA Science related topics!
Post Reply
clynnes
Posts: 2
Joined: Tue Jun 19, 2018 10:29 am America/New_York

What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?

by clynnes » Fri Apr 09, 2021 10:29 am America/New_York

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?

Tags:

lien
Posts: 19
Joined: Thu Jun 25, 2020 9:51 am America/New_York

Re: What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?

by lien » Tue Apr 13, 2021 11:46 am America/New_York

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

clynnes
Posts: 2
Joined: Tue Jun 19, 2018 10:29 am America/New_York

Re: What is the easiest way to get full-resolution geolocation into a MYD11_L2 LST file?

by clynnes » Wed Apr 14, 2021 2:33 pm America/New_York

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)
Attachments
LST_in_MYD11_L2.A2021096.0845.006.2021097170907.s.png
LST_in_MYD11_L2.A2021096.0845.006.2021097170907.s.png (334.42 KiB) Not viewed yet

Post Reply