點贊發Nature
關注中Science
GCAM計算結果我們可以用model interface直接查看,在model interface中直接復制結果即可,但有時我們需要批量匯出結果,此時,我們可以利用python的gcam_reader包,
gcam_reader包并不在PyPI中,需要從JGCRI下載獲取,
pip install https://github.com/JGCRI/gcamreader
gcam_reader將database讀取為DataFrame:
import gcam_reader
import os
os.chdir(
r"file/path/to/gcam_directory"
)
dbpath = "output" # set output file
dbfile = "database_basexdb" # database name
conn = gcam_reader.LocalDBConn(dbpath, dbfile)
# Examplary outputs:
# Database scenarios: Reference, 4p5, GCAM_SSP4, GCAM_SSP5, GCAM_SSP1, GCAM_SSP2, GCAM_SSP1
# set a query file - query database results, gcam gives an example query file as "Main_queries.xml"
queries = gcam_reader.parse_batch_query(os.path.join(dbpath, "queries.xml"))
[q.title for q in queries] # show the titles of queries
# get a query dataframe
query_df = conn.runQuery(queries, ["GCAM_SSP1"])
————————
我是仁荷大學的博士生(我的google scholar, 我的Github),關注能源轉型程序中的環境、經濟問題,
專注于分享利用python科研的技巧,歡迎一起交流、學習、合作,
關于我的博客內容、其他相關的研究問題,有問題可以下方👇評論、或私信我~
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/305763.html
標籤:其他
上一篇:SpringMVC-整合SSM框架(狂神學習筆記)2021-10-03
下一篇:學習鋒迷商城的的筆記
