source: trunk/src/scripts_Laura/ARCTIC/arctic_map.py @ 55

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

scrpt for arctic map reading

File size: 1.4 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3import string
4import numpy as np
5import matplotlib.pyplot as plt
6import ffgrid2
7from pylab import *
8from mpl_toolkits.basemap import Basemap
9from mpl_toolkits.basemap import shiftgrid, cm
10from netCDF4 import Dataset
11
12
13
14def arctic_map_lat50():
15
16
17    ## read z_cote from netcfd file 'z_cote_global_final.nc' ##
18    cote_bin = Dataset ('/net/argos/data/parvati/lahlod/ARCTIC/z_cote_global_final_z0_lat50.nc','r', format = 'NETCDF4')
19    #cote_bin.variables
20    #lon_cote = cote_bin.variables['longitude'][:]
21    #lat_cote = cote_bin.variables['latitude'][:]
22    lim_cote = cote_bin.variables['cote'][:]
23    cote_bin.close()
24
25    coast_bin = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/z_cote_global_final_cartes_z0_lat50.nc', 'r', format = 'NETCDF4')
26    #coast_bin.variables
27    #lon_cote = coast_bin.variables['longitude'][:]
28    #lat_cote = coast_bin.variables['latitude'][:]
29    x_cote = coast_bin.variables['x'][:]
30    y_cote = coast_bin.variables['y'][:]
31    coast_bin.close()
32
33    X = reshape(x_cote, size(x_cote))
34    Y = reshape(y_cote, size(y_cote))
35    Z_LIM = reshape(lim_cote, size(lim_cote))
36
37    indices = np.where(Z_LIM == 1.)[0]
38    x_ind = X[indices]
39    y_ind = Y[indices]
40    z_ind = Z_LIM[indices]
41
42    volume = z_ind/50.
43    #fig = plt.figure()
44    #fig = plt.scatter(x_ind, y_ind, c = z_ind, s = volume)
45
46    return(x_ind, y_ind, z_ind, volume)
Note: See TracBrowser for help on using the repository browser.