source: trunk/src/scripts_Laura/ARCTIC/Travail_CEN/read_cartesian_osisaf_ice_types.py @ 55

Last change on this file since 55 was 42, checked in by lahlod, 10 years ago

knew scripts

File size: 2.5 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3import string
4import numpy as np
5import matplotlib.pyplot as plt
6from pylab import *
7from mpl_toolkits.basemap import Basemap
8from mpl_toolkits.basemap import shiftgrid, cm
9from netCDF4 import Dataset
10import scipy.special
11import ffgrid2
12import map_ffgrid
13from matplotlib import colors
14import cartesian_grid_monthly
15import arctic_map
16import map_cartesian_grid
17
18
19
20
21##########################
22# time period parameters #
23##########################
24MONTH = np.array(['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'])
25month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER'])
26month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])
27M = len(month)
28
29
30
31########################
32# grid characteristics #
33########################
34x0 = -3000. # min limit of grid
35x1 = 2500. # max limit of grid
36dx = 40.
37xvec = np.arange(x0, x1+dx, dx)
38nx = len(xvec) 
39y0 = -3000. # min limit of grid
40y1 = 3000. # max limit of grid
41dy = 40.
42yvec = np.arange(y0, y1+dy, dy)
43ny = len(yvec)
44
45
46
47####################
48# Read OSISAF data #
49####################
50ice_type_month = np.zeros([M, ny, nx], float)
51for imo in range (0, M):
52    print 'open file ' + str(month[imo])
53    file_osisaf = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/OSISAF_Ice_Types/OSISAF_ice_types_cartesian_grid/OSISAF_ice_types_cartes_grid_' + month[imo] + '_2009.nc', 'r', format='NETCDF3_CLASSIC')
54    lon_osi = file_osisaf.variables['longitude'][:]
55    lat_osi = file_osisaf.variables['latitude'][:]
56    days = file_osisaf.variables['days'][:]
57    ice_type_osi = file_osisaf.variables['osi_ice_type'][:]
58    ice_type_month[imo, :, :] = ice_type_osi[0, :, :]
59    file_osisaf.close()
60
61
62
63###################
64# Map OSISAF data #
65###################
66for imo in range (0, M):
67    x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() # definition of the map coast background //se 'arctic_map.py' function for more details
68    x_coast = x_ind
69    y_coast = y_ind
70    z_coast = z_ind
71    colormap = colors.ListedColormap(['0.20', 'cyan','blue','0.75'])
72    map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, ice_type_month[imo, :, :], 0, 5, 1, colormap, 'ice_type')
73    title(month[imo] + ' 2009 - OSISAF')
74    savefig('/usr/home/lahlod/twice_d/figure_output_ARCTIC/figure_output_CEN/OSISAF_ice_types/cartesian_grid/OSISAF_cartesian_gridded_ice_types_01' + month[imo] + '2009.png')
75
76
77
Note: See TracBrowser for help on using the repository browser.