°®ÆøÏ󣬰®ÆøÏó¼ÒÔ°£¡ 

ÆøÏó¼ÒÔ°

 ÕÒ»ØÃÜÂë
 Á¢¼´×¢²á

QQ怬

Ö»ÐèÒ»²½£¬¿ìËÙ¿ªÊ¼

ÐÂÀË΢²©µÇ½

Ö»ÐèÒ»²½, ¿ìËÙ¿ªÊ¼

ËÑË÷
²é¿´: 7569|»Ø¸´: 0

[ÇóÖú] ΪʲôlambertͶӰ²»³öͼ°¡£¿

[¸´ÖÆÁ´½Ó]

ÐÂÀË΢²©´ïÈËÑ«

·¢±íÓÚ 2017-7-24 12:41:45 | ÏÔʾȫ²¿Â¥²ã |ÔĶÁģʽ

µÇ¼ºó²é¿´¸ü¶à¾«²ÊÄÚÈÝ~

ÄúÐèÒª µÇ¼ ²Å¿ÉÒÔÏÂÔØ»ò²é¿´£¬Ã»ÓÐÕʺţ¿Á¢¼´×¢²á ÐÂÀË΢²©µÇ½

x
°ÑͶӰ·½Ê½'cyl'Ì滻Ϊ'lcc'¡£½ö½ö»æÖÆÁ˵Øͼ£¬¶ø×Ô¼ºËùÐèµÄÊý¾ÝûÓлæÖƳöÀ´¡£ÕâÊÇΪʲô£¿ËùÓÃÊý¾ÝΪmicapsÖÐecmwf µÍÔƸ²¸ÇÂÊÔ¤±¨Êý¾Ý¡£ÏÂÃæÊdzÌÐò´úÂë¡£¿ÒÇë¸÷λ°ïæ¡£

import numpy as np
import datetime
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.font_manager import FontProperties
import os

font1=FontProperties(fname='C:\\Windows\\Fonts\\SimSun.ttc')


def initialize(resolution):

    mspace=(60.0, 150.0, 60., -10.) # tutle
    gspace=[0,0,0,0]  # list
    ospace=[0,0,0,0]

    f=open('D:\\EcmwfDisplay\\zht\\systemSet.txt', 'r')
    lines = f.readlines()
    f.close

    d1=('%d'%int(lines[0].strip()), '-%02d'%int(lines[1].strip()),
    '-%02d'%int(lines[2].strip()), ' %02d'%int(lines[3].strip()))
    datePredefined=datetime.datetime.strptime(''.join(d1), '%Y-%m-%d %H')


    initialTime=datePredefined.strftime('%y%m%d%H.')
    tt = datePredefined - datetime.timedelta(hours=36)
    tt=tt.strftime('%Y%m%d%H')
    newPath = ''.join(('D:\\EcmwfDisplay\\result\\', tt))

    if os.path.exists(newPath):
        __import__('shutil').rmtree(newPath)

    tt=datePredefined.strftime('%Y%m%d%H')
    newPath = ''.join(('D:\\EcmwfDisplay\\result\\', tt))
    mkFolder( newPath )


    validTimePredefined=int(lines[4].strip())
    destPath=lines[9].strip()

    ospace[0]=float(lines[5].strip())
    ospace[1]=float(lines[6].strip())
    ospace[2]=float(lines[7].strip())
    ospace[3]=float(lines[8].strip())

    ospace [ 0 ] = max ( mspace[0], ospace[0] )
    ospace [ 1 ] = min ( mspace[1], ospace[1] )
    ospace [ 2 ] = min ( mspace[2], ospace[2] )
    ospace [ 3 ] = max ( mspace[3], ospace[3] )
    gspace [ 0 ] = int( ( ospace[0] - mspace[0] ) / resolution )
    gspace [ 1 ] = int ( ( ospace[1] - mspace[0] ) / resolution + 1)
    gspace [ 2 ] = int ( ( mspace[2] - ospace[2] ) / resolution )
    gspace [ 3 ] = int ( ( mspace[2] - ospace[3] ) / resolution + 1)
    return destPath, validTimePredefined, ospace, gspace, \
           datePredefined, initialTime, newPath

def mkFolder( destPath ):
    isExists=os.path.exists(destPath)
    if not isExists:
        os.mkdir(destPath)


def dataRead(fln, space ):  
    fileName=''.join(fln)
    if os.path.exists(fileName):
        status=True
        datas=np.genfromtxt(fname=fileName, skip_header=6)
        datas = datas[space[2]:space[3], space[0]:space[1]]  
    else:
        datas=-99.0
        status=False
    return datas, status

destPath, validTimePredefined, ospace, gspace, datePredefined, \
    initialTime, newPath=initialize(0.125)
lon_0 = ospace[0] + ( ospace[1] - ospace[0] )/2.0
lat_0 = ospace[3] + ( ospace[2] - ospace[3] )/2.0

fig = plt.figure(figsize=(16, 10))
maps = Basemap(llcrnrlat=ospace[3], urcrnrlat=ospace[2],
                llcrnrlon=ospace[0], urcrnrlon=ospace[1],
                lon_0=lon_0, lat_0=lat_0, projection='lcc', resolution ='c')  
nx = gspace[1]-gspace[0]
ny = gspace[3]-gspace[2]
xx, yy=maps.makegrid(nx,ny)  
yy=yy[::-1]

datas, status=dataRead((destPath, 'LCC','\\999\\', initialTime,
                        '003'), gspace )
maps.drawmeridians(np.arange(ospace[0], ospace[1]+0.00001, 10.),
                   labels=[0, 0, 0, 1], fontsize=15, linewidth=0.4)
maps.drawparallels(np.arange(ospace[3], ospace[2]+0.00001, 10.),
                   labels=[1, 0, 0, 0], fontsize=15, linewidth=0.4)
maps.drawcoastlines(color='#00ffff')
maps.drawcountries(color='#00ffff')
cs = maps.contourf(xx, yy, datas)

ÃÜÂëÐÞ¸Äʧ°ÜÇëÁªÏµÎ¢ÐÅ£ºmofangbao
ÄúÐèÒªµÇ¼ºó²Å¿ÉÒÔ»ØÌû µÇ¼ | Á¢¼´×¢²á ÐÂÀË΢²©µÇ½

±¾°æ»ý·Ö¹æÔò

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (¾©ICP-10201084)

±¾Õ¾ÐÅÏ¢¾ùÓÉ»áÔ±·¢±í£¬²»´ú±íÆøÏó¼ÒÔ°Á¢³¡£¬½ûÖ¹ÔÚ±¾Õ¾·¢±íÓë¹ú¼Ò·¨ÂÉÏàµÖ´¥ÑÔÂÛ

¿ìËٻظ´ ·µ»Ø¶¥²¿ ·µ»ØÁбí