#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 5 23:10:46 2017
@author: chenze
"""
from mpl_toolkits.basemap import Basemap, cm
# requires netcdf4-python (netcdf4-python.googlecode.com)
from netCDF4 import Dataset as NetCDFFile
import numpy as np
import matplotlib.pyplot as plt
#import h5py
# plot rainfall from NWS using special precipitation
# colormap used by the NWS, and included in basemap.
nc = NetCDFFile('/home/chenze/practice/nws_precip_1day_20171203_netcdf/nws_precip_conus_20061222.nc', mode='r')
#nc= NetCDFFile('/home/chenze/practice/nws_precip_1day_20171203_netcdf/nws_precip_1day_20171203_ak.nc')
#nc2 = NetCDFFile('/home/chenze/practice/nws_precip_1day_20171203_netcdf/nws_precip_1day_20171203_pr.nc')
# data from http://water.weather.gov/precip/
print(nc)#,'1\n',nc1,'2\n',nc2)
print(nc.variables.keys())
prcpvar = nc.variables['amountofprecip']
data = 0.01*prcpvar[:
python nc basemap
最新推荐文章于 2024-09-11 11:00:10 发布