0
Follow
0
View

MCD19A2 atmospheric remote sensing data processing

shouxianer 注册会员
2023-02-27 20:11

Refer to this tutorial: MCD19A2 data processing of remote sensing data processing < br / > < a href = "https://blog.csdn.net/weixin_42176976/article/details/108124258" id="textarea_1677492992299_1677493031894_0" rel="noopener noreferrer" target="_blank">

lovedjj07590 注册会员
2023-02-27 20:11

Is there any python code for this? I don't understand IDL

ebanban208 注册会员
2023-02-27 20:11

Time seems not to be read directly, need to convert the Oribt_time_stamp inside the number of days into the year, month, day, hour and minute. Each time corresponds to a value of aod and aodqa, because aod and aodqa are three-dimensional data, which are latitude and longitude and the number of tracks. For example, aod in a file is(16,1200,1200), which means 16 tracks, and 1200*1200 is the size of grid. How to read the track time and aod, aodqa in the file one by one? That's the problem I'm having right now.

cui55681987 注册会员
2023-02-27 20:11
< div class = "md_content_show e397 data - v - 3967" = "" >

you can add me

hbt734542744 注册会员
2023-02-27 20:11

To work with MCD19A2 data using Python, you need to follow these steps:

Install the necessary Python libraries: numpy, h5py, and pandas. You can install them using the following command:

pip install numpy h5py pandas

Download MCD19A2 data. You can download the data from NASA's Land Processes Distributed Active Archive Center(LP DAAC) website. Make sure you have registered an LP DAAC account and are authorized to access this data.
Understand the structure and content of the data. MCD19A2 data is stored in HDF format and contains multiple data sets and metadata. You can use the h5py library to read and process data in HDF format.
Write Python scripts to batch process data. You need to process multiple files using loop statements and conditional statements in Python, and read data such as time, AOD, AODQA, and latitude and longitude into pandas data frames.
Here is a sample Python script to read the time, AOD, AODQA, and latitude and longitude data in MCD19A2 data:

import h5py
import pandas as pd
import numpy as np
import os

# 设置输入文件夹和输出文件夹路径
input_folder = "path/to/input/folder"
output_folder = "path/to/output/folder"

# 获取输入文件夹中的所有HDF文件名
file_names = os.listdir(input_folder)
file_names = [f for f in file_names if f.endswith('.hdf')]

# 遍历所有HDF文件,并读取时间、AOD、AODQA和经纬度数据
for file_name in file_names:
    # 打开HDF文件并读取数据
    with h5py.File(os.path.join(input_folder, file_name), 'r') as f:
        # 读取AOD数据集
        aod = f['AOD'][:]
        aod = np.ma.masked_where(aod == -9999.0, aod)
        # 读取AODQA数据集
        aodqa = f['AOD_QA'][:]
        aodqa = np.ma.masked_where(aodqa == -9999.0, aodqa)
        # 读取经纬度数据集
        lat = f['Latitude'][:]
        lon = f['Longitude'][:]
        # 读取时间元数据
        time = f['/MODIS_SWATH_Type_GEO/Data_Fields/DateTime'][:]

    # 创建pandas数据帧,并将数据添加到其中
    data = pd.DataFrame()
    data['time'] = pd.to_datetime(time)
    data['aod'] = aod.flatten()
    data['aodqa'] = aodqa.flatten()
    data['lat'] = lat.flatten()
    data['lon'] = lon.flatten()

    # 将数据保存为CSV文件
    output_file_name = os.path.splitext(file_name)[0] + '.csv'
    output_file_path = os.path.join(output_folder, output_file_name)
    data.to_csv(output_file_path, index=False)

This is a simple sample script that may need to be adapted to your specific data and needs.

About the Author

Question Info

Publish Time
2023-02-27 20:11
Update Time
2023-02-27 20:11