- 积分
- 1033
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-11-28
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 无敌大壮壮 于 2025-1-5 16:22 编辑
- f=readAsciiTable("20210720120000.txt",5,"float",1);读取文本文件,这种读取方式可以跳过表头,后面那个的意思是表头占的行数
- data=f(:,:);把数据取出来
- lat=data(:,1)
- lon=data(:,2)
- pre1=data(:,4)
- lat@_FillValue=999990
- lon@_FillValue=999990
- pre1@_FillValue=999990
- pre1(ind(ismissing(pre1))) = 0 ; ind将a中为缺省值的数组索引去除,并将其中对应缺省值的元素赋值为0
- ; lat1 = where(lat.lt. 31.and.lat.gt. 37,lat@_FillValue,lat)
- ; lon1 = where(lon.lt.110.and.lon.gt.117,lon@_FillValue,lon)
- ;;;d = ind(pre1.le.50.and.pre1.gt.0) ;;;;返回满足这个条件中pre1的索引
- lat1 = lat(ind(lat.lt. 36.and.lat.gt. 31));;;;这个范围的经纬
- lon1 = lat(ind(lon.lt.117.and.lon.gt.110))
- A=new(6,float)
- A=(/0,50,100,250,500,800/)
- sizes = ispan(30,55,5)/5000. ; 0.00025 to 0.00055
- colors = (/"orange","green","red","yellow","purple"/);,"blue","red","brown","red2","skyblue"/)
- labels = (/"0~F25~~~50","50~F25~~~100","100~F25~~~250","250~F25~~~500","500~F25~~~800"/)
- xpos3 = (/ 0.18, 0.33, 0.48, 0.63, 0.78/)
- xpos2 = (/ 0.15, 0.30, 0.45, 0.60, 0.75/)
- markers1 = (/ 16, 16, 16, 16, 16/)
-
-
- wks = gsn_open_wks("pdf","Scatter")
- gsn_define_colormap(wks, "WhViBlGrYeOrRe")
- ; 填色
- ;************************************************
- res = True
- res@gsnDraw = False
- res@gsnFrame = False
- res@tiMainString = "~F25~Obeserve Precipitation"
- res@tiMainFontHeightF = 0.022 ;set main title fontsize
-
- res@mpMinLatF = 31
- res@mpMaxLatF = 37
- res@mpMinLonF = 110
- res@mpMaxLonF = 117
- res@mpFillOn = False
- res@mpFillColor = False
- res@tmXBTickSpacingF = 1 ;坐标轴标注间距
- res@tmYLTickSpacingF = 1
- res@tmXBLabelFontHeightF = 0.016
- res@tmYLLabelFontHeightF = 0.016
- res@mpOutlineOn = True ; Use outlines from shapefile
- res@mpOutlineBoundarySets = "Geophysical"
- res@mpNationalLineColor = "black"
- res@mpProvincialLineColor = "black"
- res@mpGeophysicalLineColor = "black"
- res@mpNationalLineThicknessF = 2
- res@mpProvincialLineThicknessF = 2.5
- res@mpGeophysicalLineThicknessF = 2
- res@mpOutlineSpecifiers = (/"China","China:States"/)
- res@mpDataBaseVersion = "MediumRes"
- res@mpDataSetName = "Earth..4"
-
- ;;;;色标设置
- ; res@lbLabelBarOn = True ;显隐开关
- ; res@lbLabelFontHeightF = 0.25
- ; res@cnFillPalette="wh-bl-gr-ye-re"
- ; res@cnLabelBarEndStyle = "ExcludeOuterBoxes" ; 色标两端标注风格,ExcludeOuterBoxes是去掉色标两端色块,IcludeMinMaxLabels是色标两端显示最大最小值,默认是色标两端无标注
- ; res@pmLabelBarWidthF = 0.8 ;色标宽度
- ; res@pmLabelBarHeightF = 0.08 ; 色标高度
- ; res@pmLabelBarOrthogonalPosF = 0.12 ;色标垂直偏移坐标,默认为0.02,正向上,负向下
- ; res@cnFillOpacityF = 0.5 ;不透明度,默认为1
- res@pmTickMarkDisplayMode= "Always"
- res@lgOrientation = "horizontal" ; Default is vertical
- res@pmLegendWidthF = 0.75 ; Make it wider
- res@pmLegendOrthogonalPosF = -0.1 ; Move it up slightly
- res@lgPerimOn = False ; Turn off the perimeter box
-
- ;;色标名字设定
- ; res@lbTitleOn = True
- ; res@lbTitleString = "mm"
- ; res@lbLabelFontHeightF = 0.02;;;字体大小
- ; res@lbTitlePosition = "Bottom"
- ; res@cnLevelSelectionMode = "ExplicitLevels";等值线手动挡开始
- ; res@cnLevels = (/0,50,100,250,500,800/)
- map = gsn_csm_map(wks,res)
-
-
- dum_fill = new(5,graphic)
- mkres = True
- mkres@gsMarkerThicknessF = 2.0 ; Twice as thick
- do i=0,4 ;;;6个区间
- ii = ind(pre1.le.A(i+1).and.pre1.gt.A(i))
- mkres@gsMarkerIndex = markers1(i) ; Filled dots
- mkres@gsMarkerSizeF = sizes(i)
- mkres@gsMarkerColor = colors(i)
- txres = True
- txres@txFontHeightF = 0.016 ;图例上文本的大小
- txres@txJust = "CenterLeft" ;文本放在图例的那个位置
-
- ;;;;;其实没什么用,操作两小时,回到中华人民共和国成立前,只需要对地图哪儿设置就行了。。。。但是我还是要保留他
- x=new(dimsizes(lon(ii)),float)
- x=lon(ii)
- y=new(dimsizes(lat(ii)),float)
- y=lat(ii)
-
- dd=ind(lon(ii).gt.110.0 .and. lon(ii).lt.116.5)
- bb=ind(lat(ii).lt.36.5 .and. lat(ii).gt.31.5)
- ;print(x(dd))
- ;print(in(lon(ii)))
- ; if(all(lat(ii).lt.37.and.lat(ii).gt.31))
- dum_fill(i)=gsn_add_polymarker(wks,map,x(dd),y(bb),mkres)
- gsn_polymarker_ndc(wks, xpos2(i),0.15,mkres)
- gsn_text_ndc (wks,labels(i),xpos3(i),0.15,txres)
-
- delete(ii)
- delete(dd)
- delete(x)
- delete(bb)
- delete(y)
- end do
-
-
- draw(map)
- frame(wks)
复制代码
|
-
评分
-
查看全部评分
|