【Python】嫦娥探月数据(PDS)处理与可视化
大家好,本鯨來蹭嫦娥5號的熱度了。
2020年11月24日4時30分,我國在中國文昌航天發射場,用長征五號遙五運載火箭成功發射探月工程嫦娥五號探測器。正式開啟我國首次地外天體采樣返回之旅。(并在12月1日23時11分,成功著陸月球并傳回著陸影像圖)
隨后,美國國家航空航天局(NASA)在其官方推特賬號上對中國航天取得的新突破進行了一番點評。
“隨著嫦娥五號的發射升空,中國開始努力加入美國和前蘇聯獲取月面樣本的行列。我們希望中國和全球科學界分享中國探月工程所獲得的數據,以增進我們對于月球的了解,就像美國的阿波羅計劃和阿爾忒彌斯計劃所做的那樣。”
這話。。。中國探月工程數據發布與信息服務系統(http://moon.bao.ac.cn/)表示有些莫名奇妙。。。
早在2018年4月04日,該網站就發布了“嫦娥二號全月50米分辨率DEM數據”,并且就在前不久的11月3日,該網站還發布了嫦娥四號第八批科學數據。
這不由地讓我想關心一句“NASA你是這個格式的數據讀不出”嗎?
這不,和鯨社區的 @lqy 大佬制作了在線項目,專題介紹了中國探月工程數據發布與信息服務系統(http://moon.bao.ac.cn/)如何使用,如何獲取數據,如何讀取數據的問題,希望NASA的同學全文閱讀,盡量減少不必要的誤會,靴靴。
項目鏈接
嫦娥探月數據(PDS)處理與可視化
https://www.kesci.com/mw/project/5fc081b065710400309ef8e7
示例數據鏈接
嫦娥四號探月工程數據
https://www.kesci.com/mw/dataset/5fc4ec4b6571040030a1bd5f
項目概覽
(數據獲取略)
安裝模塊
!pip install --upgrade pip !pip install pds4-tools==1.2 !pip install colour-demosaicing==0.1.6導入模塊
from pds4_tools import pds4_read import matplotlib.pyplot as plt import matplotlib %matplotlib inlineimport numpy as np from PIL import Imagefrom skimage import exposure from skimage import data, img_as_float import colourfrom colour_demosaicing import (demosaicing_CFA_Bayer_bilinear,demosaicing_CFA_Bayer_Malvar2004,demosaicing_CFA_Bayer_Menon2007,mosaicing_CFA_Bayer) cctf_encoding = colour.cctf_encoding _ = colour.utilities.filter_warnings()灰度圖像
path = 'CE4_GRAS_TCAM-I-023_SCI_N_20190106035123_20190106035123_0004_A.2CL' d = pds4_read(path, quiet=True) fig, axes = plt.subplots(1,1,figsize=(10,10)) img = np.array(d[0].data) axes.imshow(img, cmap='gray')灰度圖+直方圖
def read_pds(path):data = pds4_read(path, quiet=True)img = np.array(data[0].data)img = img_as_float(img)return imgdef plot_img_and_hist(image, hist=True, bins=128):"""Plot an image along with its histogram."""if hist:fig, axes = plt.subplots(2,1, figsize=(10,10), gridspec_kw={'height_ratios': [3, 1]})ax_img, ax_hist = axeselse:fig, ax_img = plt.subplots(figsize=(10,10))# Display imageax_img.imshow(image, cmap='gray')ax_img.set_axis_off()if hist:# Display histogramax_hist.hist(image[:,:,0].ravel(), bins=bins, histtype='step', color='red')ax_hist.hist(image[:,:,1].ravel(), bins=bins, histtype='step', color='green')ax_hist.hist(image[:,:,2].ravel(), bins=bins, histtype='step', color='blue')ax_hist.ticklabel_format(axis='y', style='scientific', scilimits=(0, 0))ax_hist.set_xlabel('Pixel intensity')ax_hist.set_xlim(0, 1)ax_hist.set_yticks([])def export_img(name, img):pil_img = Image.fromarray(np.uint8(img*255))pil_img.save(name)path = 'CE4_GRAS_TCAM-I-023_SCI_N_20190106035123_20190106035123_0004_A.2CL' img = read_pds(path) plot_img_and_hist(img, hist=True) plt.show() export_img(f"{path}.png", img)彩色圖
def debayer_img(img, CFA='RGGB'):# Menon2007 yields better edges than bilineardebayered = cctf_encoding(demosaicing_CFA_Bayer_Menon2007(img, CFA))return debayered def stretch_img(img):p2, p98 = np.percentile(img, (2, 98))img = exposure.rescale_intensity(img, in_range=(p2, p98))return imgpath = '/home/kesci/input/CE44057/CE4_GRAS_PCAML-C-006_SCI_N_20190104084559_20190104084559_0001_B.2BL' img = read_pds(path) print(img.shape) debayered = debayer_img(img) final = stretch_img(debayered) plot_img_and_hist(final, hist=True) plt.show() export_img(f"{path}.png", final)查看屬性
d.label.to_dict()['Product_Observational']參考資料
[1]用Python打開嫦娥玉兔的科學數據:
https://zhuanlan.zhihu.com/p/106395591
[2]ChangE_4_data_playground
https://github.com/siyu6974/ChangE_4_data_playground
[3]嫦娥探月數據(PDS)處理與可視化:
https://www.kesci.com/mw/project/5fc081b065710400309ef8e7
往期精彩回顧適合初學者入門人工智能的路線及資料下載機器學習及深度學習筆記等資料打印機器學習在線手冊深度學習筆記專輯《統計學習方法》的代碼復現專輯 AI基礎下載機器學習的數學基礎專輯 獲取本站知識星球優惠券,復制鏈接直接打開: https://t.zsxq.com/qFiUFMV 本站qq群704220115。加入微信群請掃碼:總結
以上是生活随笔為你收集整理的【Python】嫦娥探月数据(PDS)处理与可视化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【效率】微软开源最强Python自动化神
- 下一篇: C++自学者的困境!