Esempio n. 1
0
    # Calculate temperature advection at lower and upper level for differential thermal advection term later

    # Calculate absolute vorticity advection at middle level

    # Need to wrap the tendency array
    geoph_tend, lons = um.addcyclic(geoph_tend, lonin)

    # Convert temperature to degrees Celsius
    var_lower = var_lower - 273.15
    var_upper = var_upper - 273.15
elif diagnostic == 2:  # traditional omega
    # Temperature at 700 hPa
    var_mid = temp_mid

    # Vertical relative and absolute voriticity
    var_lower = wm.vertical_vorticity_latlon(uin_lower, vin_lower, lats, lons,
                                             1)
    var_upper = wm.vertical_vorticity_latlon(uin_upper, vin_upper, lats, lons,
                                             1)

    # for differential vorticity advection
    var_adv_lower = wm.hadvection_latlon(uin_lower, vin_lower, var_lower, lats,
                                         lons)
    var_adv_upper = wm.hadvection_latlon(uin_upper, vin_upper, var_upper, lats,
                                         lons)

    # temperature advection level middle level
    var_adv_mid = wm.hadvection_latlon(uin_mid, vin_mid, temp_mid, lats, lons)

    # convert temperature to celsius
    var_mid = var_mid - 273.15
ghgtin1 = f.variables['HGT_P0_L100_GLL0'][levelindex1,::-1,:].squeeze()
ghgtin2 = f.variables['HGT_P0_L100_GLL0'][levelindex2,::-1,:].squeeze()

# Omega
omegain = f.variables['VVEL_P0_L100_GLL0'][levelindex3,::-1,:].squeeze()

# Close netcdf file
f.close

# Convert wind to geostrophic wind
if compute_geostrophic_wind == 'true' :
   uin1,vin1 = wm.geostrophic_latlon(uin1, vin1, ghgtin1, lats, lons)
   uin2,vin2 = wm.geostrophic_latlon(uin2, vin2, ghgtin2, lats, lons)

# Compute vertical voriticity
zeta_a1 = wm.vertical_vorticity_latlon(uin1, vin1, lats, lons, 1)
zeta_a2 = wm.vertical_vorticity_latlon(uin2, vin2, lats, lons, 1)

# Make all fields to be plotted cyclic
lonin = lons
u_plot1, lons = um.addcyclic(uin1, lonin)
v_plot1, lons = um.addcyclic(vin1, lonin)
u_plot2, lons = um.addcyclic(uin2, lonin)
v_plot2, lons = um.addcyclic(vin2, lonin)
zeta_a1, lons = um.addcyclic(zeta_a1, lonin)
zeta_a2, lons = um.addcyclic(zeta_a2, lonin)
omegain, lons = um.addcyclic(omegain, lonin)

# For the title
levelh1 = levels_x1[0] / 100 # Convert level to hPa for title
levelh2 = levels_x1[1] / 100 # Convert level to hPa for title
   
   # Calculate absolute vorticity advection at middle level     

   # Need to wrap the tendency array
   geoph_tend, lons = um.addcyclic(geoph_tend, lonin)
   
   # Convert temperature to degrees Celsius
   var_lower = var_lower - 273.15
   var_upper = var_upper - 273.15
elif diagnostic == 2: # traditional omega
   # Temperature at 700 hPa
   var_mid = temp_mid   

   # Vertical relative and absolute voriticity
   var_lower = wm.vertical_vorticity_latlon(uin_lower, vin_lower, lats, lons, 1)
   var_upper = wm.vertical_vorticity_latlon(uin_upper, vin_upper, lats, lons, 1)

   # for differential vorticity advection 
   var_adv_lower = wm.hadvection_latlon(uin_lower, vin_lower, var_lower, lats, lons)
   var_adv_upper = wm.hadvection_latlon(uin_upper, vin_upper, var_upper, lats, lons)
   
   # temperature advection level middle level
   var_adv_mid = wm.hadvection_latlon(uin_mid, vin_mid, temp_mid, lats, lons)
   
   # convert temperature to celsius
   var_mid = var_mid - 273.15
  
else:
   var_lower = wm.vertical_vorticity_latlon(uin_lower, vin_lower, lats, lons, 1)