Ejemplo n.º 1
0
dataset = open_url(
    'http://omgsrv1.meas.ncsu.edu:8080/thredds/dodsC/fmrc/sabgom/SABGOM_Forecast_Model_Run_Collection_best.ncd'
)

###############################################################################################################
#### get sabgom data and save to .mat file

#note: the utils.mk_array was done to get around an issue I was having with my numpy array getting trash values in savemat unless I wrapped the matrix within a 'singleton' dimension
# so (320,440) becomes (1,320,440) and then matrix squeezed here and in matlab to give the original (320,440) matrix

#obs vars
temp = dataset['temp']
#temp = temp[1,:,:,:]
temp = temp[fc_offset, :, :, :]
temp = utils.mk_array(temp.shape, temp)

salt = dataset['salt']
salt = salt[fc_offset, :, :, :]
salt = utils.mk_array(salt.shape, salt)

u = dataset['u']
u = u[fc_offset, :, :, :]
u = utils.mk_array(u.shape, u)

v = dataset['v']
v = v[fc_offset, :, :, :]
v = utils.mk_array(v.shape, v)

chl = dataset['chlorophyll']
chl = chl[fc_offset, :, :, :]
Ejemplo n.º 2
0
import scipy.io as sio

from scipy.io import netcdf
filein = netcdf.netcdf_file('sabgom_grd_H.nc','r')
import numpy as np

import utils

#    { 'mask_rho','mask_psi','mask_u','mask_v','h','pm','pn','f','angle'};
mask_rho = filein.variables['mask_rho']
mask_rho = utils.mk_array(mask_rho.shape,mask_rho[:,:])

mask_psi = filein.variables['mask_psi']
mask_psi = utils.mk_array(mask_psi.shape,mask_psi[:,:])

mask_u = filein.variables['mask_u']
mask_u = utils.mk_array(mask_u.shape,mask_u[:,:])

mask_v = filein.variables['mask_v']
mask_v = utils.mk_array(mask_v.shape,mask_v[:,:])

h = filein.variables['h']
h = utils.mk_array(h.shape,h[:,:])

pm = filein.variables['pm']
pm = utils.mk_array(pm.shape,pm[:,:])

pn = filein.variables['pn']
pn = utils.mk_array(pn.shape,pn[:,:])