笔记
滴滴答答11
这个作者很懒,什么都没留下…
展开
-
xgboost
【代码】xgboost。原创 2022-11-30 17:15:14 · 443 阅读 · 0 评论 -
Python micaps数据转nc
【代码】Python micaps数据转nc。python读取micapspython保存成nc原创 2022-10-20 11:39:26 · 824 阅读 · 0 评论 -
python读取气象nc数据
绝大多数nc的数据存在variable中,但也有部分nc数据variable是空的,数据存在其他地方。以下分别对这两类情况进行读取。原创 2021-10-21 00:03:39 · 2865 阅读 · 0 评论 -
Python 关于时间的处理方法
# 转换成时间格式time_format = []for i in data['时间']: print(i) time_format.append(time.strptime(str(i),'%Y%m%d'))原创 2021-01-12 11:16:05 · 1691 阅读 · 0 评论 -
笔记:np查找满足条件的数组下标
代码】笔记:np查找满足条件的数组下标。原创 2022-08-19 08:29:32 · 475 阅读 · 0 评论 -
python批量读取txt
【代码】python批量读取txt。原创 2022-08-08 17:20:18 · 995 阅读 · 0 评论 -
matlab ncwrite写入nc文件
matlab官方文档只给出了简单的写入一个变量情况,以下程序给出了同时写入多个变量到nc格式文件的例子。原创 2020-08-23 23:28:25 · 11151 阅读 · 11 评论 -
Arcgis 计算两个栅格图层相关性
arcgis计算栅格图层相关性原创 2022-07-20 16:34:28 · 4759 阅读 · 4 评论 -
Python 将数字字符串数组转为数字数组的最快方法
将数字字符串转数组最快方法原创 2022-06-23 10:57:37 · 1191 阅读 · 0 评论 -
Matlab 读取nc文件报错解决方法
读取nc文件报如下错误的解决方法: 把nc文件从移动硬盘盒拷贝到电脑里。Warning: The following error was caught while executing'internal.matlab.imagesci.nc' class destructor:Error using netcdflibThe NetCDF library encountered an error during execution of 'close'function - 'Not a valid I原创 2022-05-26 22:59:53 · 5129 阅读 · 4 评论 -
python pycwt小波分析
安装模块pycwt这个库在官方文档中没有提供conda的安装方法,官网推荐使用pip进行安装pip install pycwt。但是,conda也可以用如下方法安装,推荐conda安装conda install -c conda-forge/label/gcc7 pycwt官网例子https://github.com/regeirk/pycwt"""In this example we will load the NINO3 sea surface temperature anomaly d原创 2022-05-04 01:01:55 · 2400 阅读 · 5 评论 -
笔记:python 绘图进阶
参考:气象学家公众号1.双坐标 twinx()fig=plt.figure(figsize=(7,4),dpi=200)ax1=fig.add_subplot(111)ax2=ax1.twinx()line2,=ax2.plot(times,pressures,'k-',lw=1.2,label='气压')plt.show()2.上下子图共用横坐标fig,((ax1),(ax2))=plt.subplots(2,1,figsize=(5,5),dpi=200,sharex='all')原创 2020-06-09 10:30:58 · 4401 阅读 · 6 评论 -
Matlab/Python nc格式小时数据转日期
在处理气象nc格式数据时,时间变量往往不是已YYYYMMDD格式给出日期,而是距某一天(如1900年1月1日)XXX小时或XXX日。为此,可由以下代码将nc的时间变量转为日期:t0 = datetime(1900,1,1);date_yyymmdd = t0 + double(time(????)/24; %time为距1900年1月1日00时的小时数...原创 2020-04-11 14:13:50 · 9239 阅读 · 11 评论 -
Pycharm设置方案的配置文件路径
原创 2022-04-20 21:08:07 · 979 阅读 · 0 评论 -
雨型K均值聚类
# -*- coding: utf-8 -*-"""@Author: xxx@Features of this code:利用聚类找出24、48、72小时雨型"""import numpy as npimport pandas as pdimport glob# import matplotlib.pyplot as pltfrom sklearn.cluster import KMeans # 导入K均值聚类算法# from pylab import *# 读取数据def原创 2022-03-22 16:18:27 · 153 阅读 · 0 评论 -
Python按shp文件提取格点和插值图
# coding=utf-8'''本程序实现shp文件范围内的格点选取'''import numpy as npimport shapefileimport shapely.geometry as geometryfrom shapely.geometry import Polygonfrom shapely.ops import cascaded_unionimport matplotlib.pyplot as pltshp = shapefile.Reader(r'DTool\d原创 2021-07-15 22:16:53 · 3046 阅读 · 1 评论 -
Python MK趋势检验
# -*- coding: utf-8 -*-from __future__ import divisionimport numpy as npimport pandas as pdfrom scipy import statsfrom scipy.stats import normdef mk_test(x, alpha=0.05): """ This function is derived from code originally posted by Sat Kumar原创 2022-03-03 20:22:47 · 2118 阅读 · 0 评论 -
pd添加列名数据变为nan
for i, t in enumerate(real_time): # print(i,t) temp = [] for j in range(len(lat)): print(i, t, j) for k in range(len(lon)): data = [t, mlon[j, k], mlat[j, k], hurs[i, j, k]] ...原创 2022-02-25 23:36:37 · 1039 阅读 · 0 评论 -
Arcgis 刻度去掉分秒
去除原图刻度含分、秒方法:结果:原创 2022-02-15 11:07:48 · 1687 阅读 · 0 评论 -
MATLAB/Python MK检验程序
function [UF,UB]=MannKendall(timeseries)N=length(timeseries);UF=SMK(timeseries,N);for i=1:N YY(i)=timeseries(N+1-i);endu_res=SMK(YY,N);for i=1:N UB(i)=-u_res(N+1-i);endfunction u_res=SMK(Y,N)m_res=zeros(N,1);md_res=zeros(N,1);u_res=zeros(原创 2021-05-24 19:07:22 · 2676 阅读 · 0 评论 -
一个例子理解Python *args **kwargs参数
*args, **kwargs分别为位置参数和关键字参数。args,kwargs参数分别为元祖和字典对象。def func(*args, **kwargs): print(args, kwargs)func(1, 2, 3)func(1, *(2, 3))func(b=2, a=1, c=3)func(**{'a': 1, 'b': 2, 'c': 3})结果:(1, 2, 3) {}(1, 2, 3) {}() {'b': 2, 'a': 1, 'c': 3}() {'a原创 2021-05-26 16:56:26 · 185 阅读 · 0 评论 -
ValueError: column index (256) not an int in range(256)
pandas 保存为xls时最大列为256,改为保存csv格式可避免该限制。解决方法:pd.DataFrame(in_shp_pre).to_csv('各区站点\\' + file[14:17] + '.csv')原创 2022-01-09 20:04:28 · 3494 阅读 · 0 评论