简体   繁体   English

为什么我的网格化数据没有显示在底图上?

[英]why isnt my gridded data showing up on basemap?

I am trying to plot NASA GISS gridded temperature data but my maps keep showing up blank.我正在尝试 plot NASA GISS 网格化温度数据,但我的地图一直显示空白。 Below is my code:下面是我的代码:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import geopandas as gpd
import xarray as xr

ncin = xr.open_dataset('GriddedAir250.nc')

lons = ncin.variables['lon'][:]
lats = ncin.variables['lat'][:]
air = ncin.air

MeanTmax=air.mean(dim='time')

m=Basemap(projection='merc',
          llcrnrlon= -123.416059,
          llcrnrlat=18.954443,
          urcrnrlon=-61.285950,
          urcrnrlat= 47.536340,
          resolution='i')

lon, lat = np.meshgrid(lons, lats)
xi, yi = m(lon, lat)
# Add Coastlines, States, and Country Boundaries
m.drawcoastlines()
m.drawstates()
m.drawcountries()

# Plot Data
cs = m.pcolor(xi,yi,np.squeeze(MeanTmax))

# Add Colorbar
cbar = m.colorbar(cs, location='bottom', pad="10%")
cbar.set_label('winter')

# Add Title
plt.title('DJF Maximum Temperature')

plt.show()

All I get is a blank map that looks like this.我得到的只是一个空白的 map,看起来像这样。 Why isn't the temperature data showing up?为什么没有显示温度数据? 在此处输入图像描述

The longitude grid in the source data is from 0 to 360 rather than -180 to 180. Because of this, it's likely that you've filtered out all of the data in your basemap projection command.源数据中的经度网格是从 0 到 360,而不是 -180 到 180。因此,您可能已经过滤掉了底图投影命令中的所有数据。 I haven't tested because I don't have the deprecated basemap package.我没有测试,因为我没有已弃用的底图 package。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将模型中带有颜色的数据绘制到matplotlib底图上? 为什么没有显示数据? - How do I plot data with color from my model onto matplotlib Basemap? Why is data not showing up? 为什么 pygame 中没有显示文本? - Why isnt the text showing up in pygame? Python Antlr 为什么我的代码没有达到预期的结果? - Python Antlr why isnt my code coming up with the expected outcome? 如何在底图中绘制网格化数据并沿特定方位查找网格点 - How to plot gridded data in basemap and find grid points along a specific azimuth Python:计算机选项未显示 - Python: computer choice isnt showing up 我的 django 表单显示数据已发布但数据未保存到数据库 - My django form is showing that data is posted but data isnt being saved to database 为什么我的Django SessionWizardView Survey Application数据未以可用格式显示在MySQL数据库中? - Why is my Django SessionWizardView Survey Application Data not showing up in a usable format in my MySQL Database? 为什么我的网站的下半部分没有显示? - Why is the bottom half of my site not showing up? 为什么我的日期列显示为空? - Why is my date column showing up as empty? 为什么 QVideoWidget 没有出现在我的应用程序中? - Why is QVideoWidget not showing up in my application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM