Meteoinfolab Script Example: Get meteorological data for each node of the air mass trajectory

Source: Internet
Author: User

Read the Hysplit output trajectory data file and the corresponding time meteorological data file, generate the trajectory layer, loop each track node, read out the node's longitude, latitude, air pressure, time, through the meteorological data interpolation to obtain the meteorological data of the node.

Script Program:

#-----------------------------------------------------#Author:yaqiang Wang#date:2015-9-30#purpose:get meteorological data along trajectory#Note:sample#-----------------------------------------------------#Set working DirectoryTrajdir ='D:/temp/hysplit'Meteodir='D:/temp/arl'#Open trjactory Data FilePrint 'Open Trajectory data file ...'TRAJFN= Os.path.join (Trajdir,'traj_20090731')Print 'Trajectory file:'+TRAJFNTRAJF=Addfile_hytraj (TRAJFN)#Create Trajectory LayerTrajlayer =Trajf.trajlayer ()#Open Meteorological Data filePrint 'Open Meteorological data file ...'meteofn= Os.path.join (Meteodir,'gdas1.jul09.w5')Print 'Meteorological File:'+meteofnmeteof=AddFile (METEOFN)#Get meteorological data along trajectoryPrint 'Get meteorological data along trajectory ...'OUTFN= Os.path.join (Trajdir,'Pblh_traj.txt') Outf= Open (OUTFN,'W') Outf.write ('lon,lat,time,heigh,pblh,uwnd\n') Pblvar='PBLH'Uvar='Uwnd'idx=0 forTlineinchtrajlayer.shapes (): t= Trajlayer.cellvalue ('StartDate', idx) H= Trajlayer.cellvalue ('Starthour', IDX) t.replace (hour=h) forPsinchtline.getpoints (): Lon=PS. X lat=PS. Y Z=PS. M pres=PS. Z PBL=meteof.tostation (Pblvar, Lon, LAT, None, t) Uwnd=meteof.tostation (Uvar, Lon, LAT, pres, t)Print 'lon:%.2f; Lat:%.2f; time:%s; height:%.2f; PBLH:%.2f; Uwnd:%.2f'% (lon, LAT, t.strftime ('%y%m%d_%h:%m'), Z, PBL, Uwnd) line='%.4f,%.4f,%s,%.2f,%.2f,%.2f'% (Lon,lat,t.strftime ('%y%m%d_%h:%m'), Z,pbl,uwnd) Outf.write ( line+'\ n') T= t + datetime.timedelta (hours=-1) IDX+ = 1outf.close ()Print 'Finish ...'

Meteoinfolab Script Example: Get meteorological data for each node of the air mass trajectory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.