- 博客(29)
- 资源 (2)
- 收藏
- 关注
转载 Linux安装pygrib
安装前置库anaconda安装最后一步conda install -c conda-forge pygrib=2.0.1
2019-05-06 23:06:13
2521
原创 python 等待输入指令(input)
在跑代码时,特别是跑数据,时常只是想选取其中某些个例,在源代码改起来很麻烦;这时,用户输入起到了极大便利。# -*- coding: utf-8 -*-"""Created on Mon Apr 22 13:02:01 2019@author: cz007"""import sysprint (sys.argv[0])price = input("price:[eg, 10...
2019-04-22 13:54:52
14345
原创 netCDF basemap win下安装,win下cmd,pip、python无法使用,添加环境变量 anaconda更新python版本
win 下添加pip 环境变量(python也一样,这里是anaconda下载)下载安装netCDF basemapwin下各种第三方库 https://www.lfd.uci.edu/~gohlke/pythonlibs/#cftime注意所需前置库。cftime pyproj...
2019-04-06 14:43:21
352
原创 python 画图,各部分字体大小调整详解
x,y 轴刻度 plt.xticks(xticks,xtickslabel,fontsize = 15,alpha=2.0)#,rotation=60) plt.yticks(fontsize=10)2 x,y ;label plt.ylabel('Height (km)'+str(ye),fontsize=10)plt.colorbar ...
2019-03-18 19:36:45
11972
原创 assert断言函数的运用
assert函数用于未完善的程序找错。assert sum(output)!=33219980,"ok"出错是结果:chenze@chenze-ThinkPad-T430u:~/high_performance$ python julia.pyLength of x: 1000Total elements: 1000000calculate_z_serial_purepython ...
2018-12-15 21:18:32
339
原创 Pycharm使用
无法多行操作rab键、删除键无法使用解决办法 file->setting->Plugins->vim取消此选项
2018-10-22 16:54:01
173
原创 CentOS 更新 pip
# pip install --upgrade pipCollecting pipDownloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB...
2018-10-17 13:48:05
817
原创 Linux install anaconda and pyhwm2014
pyhwm2014 : https://github.com/rilma/pyHWM14anaconda# su root[root@localhost Downloads]# bash Anaconda3-5.3.0-Linux-x86_64.shWelcome to Anaconda3 5.3.0In order to continue the installation p...
2018-10-17 13:46:20
2020
原创 python查找数组,其某段最大值最小值得位置
c = [-10,-5,0,5,3,10,15,-20,25]print (c[3:6].index(min(c[3:6]))) # 返回最小值print (c.index(max(c[3:6]))) # 返回最大值In[44]: c = [-10,-5,0,5,3,10,15,-20,25]print (c[3:6].index(min(c[3:6]))) # 返回最小值print ...
2018-10-03 20:56:13
17677
1
原创 python matplotlib的一些使用
plt.close() 清空画图,避免在大量出图,存图时,出现memory不够的情况plt.close(fig)###清空指定图plt.close('all')####清空所有图
2018-09-29 13:32:32
274
原创 python 自动将文件分类
# -*- coding: utf-8 -*-"""Created on Thu Aug 16 22:15:00 2018@author: chenze"""import osimport shutilimport redef mkdir(path): folder = os.path.exists(path) if not folder: ...
2018-08-16 23:14:28
792
原创 python3 np.loadtxt() 读取带字符内容,readlines()读取特定行的数据
data=np.loadtxt(path,dtype='str',skiprows=1) 结果如下
2018-08-13 13:52:02
6074
1
原创 np.array
当list 的第i层的数(数组)不相等时,不能用np.array() 进行list向 array 的转换。会出现如下错误ndarray object of numpy module
2018-08-06 15:38:28
1326
原创 np.zeros()
np.zeros(69)结果:print(path1[1][-3:])#####显示后三位xh-mst20131202202
2018-07-26 21:32:16
18707
原创 np.linspace
”’ import numpy as np np.linspace(0,34,35) ”’结果: ”’ import numpy as np a=np.linspace(0,34,35) print(a) a[1][ 0. 1. 2. …, 32. 33. 34.] 1.0 ”’
2018-06-05 00:00:48
1486
原创 python 求n次幂
k,b=5,2print(pow(k,b),pow(10**10,0.1))k,b=5,2print(pow(k,b),pow(10**10,0.1))25 10.000000000000002
2018-05-27 20:26:03
20676
原创 python 画图时中文注释解决办法
#中文注释 plt.rcParams['font.sans-serif']=['SimHei'] plt.rcParams['axes.unicode_minus'] = False plt.savefig(path0+'\\example\\'+'谱处理+剔除地杂波',dpi=800) plt.show()
2018-05-05 13:59:56
976
原创 python pandas 读取.txt .dat 文件时,跳读头文件,并把数据读成数组
# -*- coding: utf-8 -*-"""Created on Wed Mar 21 19:03:02 2018@author: Administrator"""import pandas as pdimport numpy as nppath1= '/home/chenze/MSTdata/xh-mst20120424'path=path1+'/XHT_MST01_DJH_
2018-03-22 15:32:23
21673
2
原创 完整的python basemap 选nc特定区域图
核心代码 【完整代码,数据另外上传】'''确定经纬度的最小最大值,以及点的个数。 因为在确定画图范围时,basemap,不能直接根据你选的定你所选画定的范围,自动选取 所在区域的要素的值。 nx,ny 通过比例关系,确定要素是从第n1行n2列到第n3行n4列。'''l=nc.variables['lon']a=nc.variables['lat']NX=l[:]N
2017-12-10 22:49:14
7368
1
原创 详细的python basemap 底图中各函数的所有参量注释
所有函数的参量在另一篇文章中#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Fri Dec 8 22:22:53 2017@author: chenze"""import matplotlib.pyplot as pltimport numpy as npfrom mpl_toolkits.basemap impo
2017-12-09 00:00:12
11379
2
原创 python nc basemap
#!/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.googleco
2017-12-06 13:40:47
2172
原创 python basemap 中一些函数括号内值的含义与用法
官方网页:http://matplotlib.org/basemap/api/basemap_api.html#mpl_toolkits.basemap.Basemap.contour如:contour(x, y, data, *args, **kwargs)Make a contour plot over the map(see matplotlib.pyplot.cont...
2017-12-05 20:22:46
1172
转载 python basemap 画图案例
原网址:http://matplotlib.org/basemap/users/examples.htmlcontour(): draw contour lines. contourf(): draw filled contours. imshow(): draw an image. pcolor(): draw a pseudocolor plot. pcolorme...
2017-12-05 20:18:28
5464
转载 python basemap 在地图标点
接上一篇的代码原网址:http://matplotlib.org/basemap/users/mapcoords.html#converting-to-and-from-map-projection-coordinates# plot blue dot on Boulder, colorado and label it as such.lon, lat = -104.237, 40.125...
2017-12-05 20:01:52
6020
转载 python basemap 画出经纬度并标定
原网页:http://matplotlib.org/basemap/users/graticule.html两个函数:Basemap.drawparallels ##纬度 Basemap.drawmeridians ##经度from mpl_toolkits.basemap import Basemapimport matplotlib.pyplot as plt...
2017-12-05 19:55:21
16706
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人