Changeset 2742 in lmdz_wrf for trunk


Ignore:
Timestamp:
Nov 1, 2019, 7:07:41 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `DefineMap?': Function to provide the evnrionment for the projection of the maps
Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/OBSstations.csv

    r2732 r2742  
    5454VILLA REYNOLDS AERO,87448,33.733333,33,44,0.00,65.383333,65,23,0.00,486,SAN LUIS,Argentina,Villa Reynolds Airpot,,
    5555VILLAGUAY AERO,87385,31.850000,31,51,0.00,59.083333,59,05,0.00,43,ENTRE RIOS,Argentina,Villaguay Airpot,,
     56
  • trunk/tools/drawing_tools.py

    r2739 r2742  
    165165# check_colorBar: Check if the given colorbar exists in matplotlib
    166166# colorbar_vals: Function to provide the colorbar values for a figure
     167# DefineMap: Function to provide the evnrionment for the projection of the maps
    167168# draw_MerPara: Function to add the parallels and meridians into a figure with a
    168169#   panel of plots
     
    30023003    return axisv, newaxist, newaxisL
    30033004
     3005def DefineMap(proj,res,projvals):
     3006    """ Function to provide the evnrionment for the projection of the maps
     3007      proj: name of the projection
     3008        'cyl': cylindric
     3009        'lcc': lamber-conformal
     3010        'npstere': north polar stereographic
     3011        'spstere': south polar stereographic
     3012      res: resolution to use
     3013      projvals: values for the given projection
     3014    """
     3015    fname = 'DefineMap'
     3016
     3017    availproj = ['cyl', 'lcc', 'npstere', 'spstere']
     3018
     3019
     3020    if proj == 'cyl':
     3021        Nvals = 4
     3022        if len(projvals) != Nvals:
     3023            expvals = ['llcrnrlon', 'llcrnrlat', 'urcrnrlon','urcrnrlat']
     3024            print errrormsg
     3025            print '  ' + fname + ": projection '" + proj + "' reequires ", Nvals,    \
     3026              "values, ", len(projvals), 'provided!!'
     3027            print '    expected values', expvals
     3028            quit(-1)
     3029        defmap=Basemap(projection=proj, llcrnrlon=projvals[0], llcrnrlat=projvals[1],\
     3030         urcrnrlon=projvals[2], urcrnrlat=projvals[3], resolution=res)
     3031
     3032    elif proj == 'lcc':
     3033        Nvals = 6
     3034        if len(projvals) != Nvals:
     3035            expvals = ['lat_0', 'lon_0', 'llcrnrlon', 'llcrnrlat', 'urcrnrlon',      \
     3036              'urcrnrlat']
     3037            print errrormsg
     3038            print '  ' + fname + ": projection '" + proj + "' reequires ", Nvals,    \
     3039              "values, ", len(projvals), 'provided!!'
     3040            print '    expected values', expvals
     3041            quit(-1)
     3042            m = Basemap(projection=proj, lat_0=projvals[0], lon_0=projvals[1],       \
     3043              llcrnrlon=projvals[2], llcrnrlat=projvals[3], urcrnrlon=projvals[4],   \
     3044              urcrnrlat=projvals[5], resolution=res)
     3045
     3046    elif proj == 'npstere':
     3047        Nvals = 2
     3048        if len(projvals) != Nvals:
     3049            expvals = ['boundinglat', 'lon_0']
     3050            print errrormsg
     3051            print '  ' + fname + ": projection '" + proj + "' reequires ", Nvals,    \
     3052              "values, ", len(projvals), 'provided!!'
     3053            print '    expected values', expvals
     3054            quit(-1)
     3055        defmap = Basemap(projection=proj, boundinglat=projvals[0], lon_0=projvals[1],\
     3056          resolution=res)
     3057
     3058    elif proj == 'spstere':
     3059        Nvals = 2
     3060        if len(projvals) != Nvals:
     3061            expvals = ['boundinglat', 'lon_0']
     3062            print errrormsg
     3063            print '  ' + fname + ": projection '" + proj + "' reequires ", Nvals,    \
     3064              "values, ", len(projvals), 'provided!!'
     3065            print '    expected values', expvals
     3066            quit(-1)
     3067        defmap = Basemap(projection=proj, boundinglat=projvals[0], lon_0=projvals[1],\
     3068          resolution=res)
     3069    else:
     3070        print errormsg
     3071        print '  ' + fname + ": projection '" + + "' not available !!"
     3072        print '    avaialble ones:', availproj
     3073        quit(-1)
     3074
     3075    return defmap
     3076
    30043077def figureMap_size(lonlatb, figwidth=8, Ncol=1, Nrow=1, titpercen=1.1, dpi=100):
    30053078    """ Function to determine the real size of a figure adjusted to the ratio of the
     
    43224395
    43234396        if map_proj == 'cyl':
    4324             m = Basemap(projection=map_proj, llcrnrlon=nlon, llcrnrlat=nlat,         \
    4325               urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res)
     4397            m = DefineMap(map_proj, map_res, [nlon,nlat,xlon,xlat])
    43264398        elif map_proj == 'lcc':
    4327             m = Basemap(projection=map_proj, lat_0=lat2, lon_0=lon2, llcrnrlon=nlon, \
    4328               llcrnrlat=nlat, urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res)
    4329         else:
    4330             print errormsg
    4331             print '  ' + fname + ": projection '" + map_proj + "' does not exist!!"
    4332             print '    existing ones: cyl, lcc'
    4333             quit(-1)
    4334 
     4399            m = DefineMap(map_proj, map_res, [lat2, lon2, nlon, nlat, xlon, xlat])
     4400        elif map_proj == 'npstere':
     4401            m = DefineMap(map_proj, map_res, [lat2, lon2])
     4402        elif map_proj == 'spstere':
     4403            m = DefineMap(map_proj, map_res, [xlat, -65.])
    43354404        if len(olon[:].shape) == 1:
    43364405            lons, lats = np.meshgrid(olon[:], olat[:])
Note: See TracChangeset for help on using the changeset viewer.