WRF后处理:图片美化
2023-03-14 22:41:47 时间
做WRF后处理软件的过程中主要关注了整体流程拉通和产品输出,画的图片比较粗糙,今天静下心来(被迫营业)慢慢修图,经过小组会议的讨论,总结的问题主要可以归纳为以下几点:
- y轴的纬度标签长短不一
- 省界过于突出
- 数据分辨率过高,整体不美观
- 色标标签值太长
- 图片边缘留白过大
这里以能见度为例:
以下是具体的修改内容:
- 调整y轴纬度标签格式
; res@pmTickMarkDisplayMode = "Always" 先取消默认的设置
xlonval = ispan(toint(10*res@mpMinLonF),toint(10*res@mpMaxLonF),5) *.1
ylatval = ispan(toint(10*res@mpMinLatF),toint(10*res@mpMaxLatF),5) *.1
res@tmXBMode = "Explicit"
res@tmXBValues = xlonval
res@tmXBLabels = sprintf("%4.1f",xlonval) + "~S~o~N~E"
res@tmYLMode = "Explicit"
res@tmYLValues = ylatval
res@tmYLLabels = sprintf("%4.1f",ylatval) + "~S~o~N~N"
- 调整行政边界
;res@mpOutlineOn = False
;>--------------增加行政边界------------------------------<
shp_city ="xxx/boundary/city.shp"
city_res = True
city_res@gsLineColor = "DimGray"
city_res@gsLineDashPattern = 0
city_res@gsLineThicknessF = 2.0
city_plot = gsn_add_shapefile_polylines(wks,plot,shp_city,city_res)
shp_prov = "xxx/boundary/province.shp"
prov_res = True
prov_res@gsLineColor = "black"
prov_res@gsLineDashPattern = 0
prov_res@gsLineThicknessF = 3.0
prov_plot = gsn_add_shapefile_polylines(wks,plot,shp_prov,prov_res)
- 数据平滑
wrf_smooth_2d(vis, 9)
- 数据量级调整&色标标签格式设置
vis = vis / 1000.
res@cnLevels = (/200, 500, 1000, 1500, 2000, 3000, 4000, 5000, 10000/) / 1000.
res@lbLabelStrings = sprintf("%4.1f",res@cnLevels)
- 添加mark
;>--------------增加站点------------------------------<
mstring = "z"
fontnum = 35
xoffset = 0.0
yoffset = 0.0625
ratio = 1.0
size = 0.5
angle = 0.0
solidstar = NhlNewMarker(wks2,mstring,fontnum,xoffset,yoffset,ratio,size,angle)
pmres = True
pmres@gsMarkerColor = "red"
pmres@gsMarkerSizeF = 0.028
pmres@gsMarkerIndex = solidstar
plat = xxx
plon = xxx
dum = gsn_add_polymarker(wks,plot,plon,plat,pmres)
- 裁减图片白边
这里主要是利用python的PIL库来进行图片白边的裁减
import sys, os
from PIL import Image, ImageOps
def crop_margin(img_fileobj, out, padding=(0, 0, 0, 0)):
image = Image.open(img_fileobj).convert('RGB')
ivt_image = ImageOps.invert(image)
bbox = ivt_image.getbbox()
left = bbox[0] - padding[0]
top = bbox[1] - padding[1]
right = bbox[2] + padding[2]
bottom = bbox[3] + padding[3]
cropped_image = image.crop([left, top, right, bottom])
cropped_image.save(out)
return
dirs = r"C:UsersjiaobfDesktopJ"
fils = os.listdir(dirs)
for fn in fils:
if not fn.endswith('png'):continue
fp = os.path.join(dirs, fn)
crop_margin(fp,fp)
修改后的图片:
以上工作感谢师门的师弟师妹!
图形美化可进一步参考:
https://confluence.ecmwf.int/display/METV/Metview
http://www.caps.ou.edu/wx/casa/r/casa_dfw/fcst/
https://aviationweather.gov/
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的