def addVar(self, url, Vars=None, Verbose=True, Levels=None): """ Sample variable along DIAL track. """ from grads import GrADS ga = GrADS(Window=False, Echo=False) fh = ga.open(url) if Levels is not None: ga('set lev %s' % Levels) qh = ga.query('dims') if Vars is None: Vars = ga.query('file').vars elif type(Vars) is StringType: Vars = [ Vars, ] for var in Vars: if Verbose: print ' Working on <%s>' % var if fh.Vars[var.lower()].levs == 0: ga('set lev 1') # 2D variable else: ga.setdim(qh) q = ga.sampleXYT(var, self.lon, self.lat, self.tyme, Verbose=Verbose).data self.__dict__[var] = ma.MaskedArray(q, mask=q >= MAPL_UNDEF)
def getMERRA(self, npzFile=None): """ Get Met fields from MERRA. """ from grads import GrADS ga = GrADS(Window=False, Echo=False) ga.open( 'http://goldsmr2.sci.gsfc.nasa.gov:80/dods/MAT1NXFLX') # 2D fluxes self.sampleFile(ga, onlyVars=('ustar', 'bstar', 'pblh', 'hflux', 'eflux', 'rhoa', 'tsh')) ga('close 1') ga.open( 'http://goldsmr1.sci.gsfc.nasa.gov:80/dods/MAT3FVCHM') # 3D fields ga('set z 1 72') self.sampleFile(ga, onlyVars=('u', 'v', 't', 'qv', 'delp'), npzFile=npzFile)
def getFP(self, npzFile=None, dir='/home/adasilva/iesa/aerosol/experiments/seac4rs_01'): """ Get Met fields from GEOS-5 Forward Processing. """ from grads import GrADS ga = GrADS(Window=False, Echo=False) ga.open(dir + '/tavg1_2d_flx_Nx.ddf') self.sampleFile(ga, onlyVars=('ustar', 'bstar', 'pblh', 'hflux', 'eflux', 'rhoa', 'tsh')) ga('close 1') ga.open(dir + '/inst3_3d_asm_Nv.ddf') ga('set z 1 72') self.sampleFile(ga, onlyVars=('u', 'v', 't', 'qv', 'o3', 'delp'), npzFile=npzFile) ga('close 1')
def _estimate(): from grads import GrADS man = MAN() ga = GrADS(Echo=0,Window=False) # fh = ga.open('nnr_001.modo.ddf') # man.addVar(ga,'nnr_001.modo.tau.npz',expr='tau') # man.addVar(ga,'nnr_001.modo.tau_.npz',expr='tau_') ga('reinit') fh = ga.open('nnr_001.mydo.ddf') man.addVar(ga,'nnr_001.mydo.tau.npz',expr='tau') man.addVar(ga,'nnr_001.mydo.tau_.npz',expr='tau_')
class TestPdefFile(unittest.TestCase): def tearDown(self): del self.ga def test_01_Open(self): """ Check whether file was opened correctly. """ type = 'Gridded' vars = ['pslv'] var_levs = [0] nx, ny, nz, nt = (333, 182, 20, 1) fh = self.fh self.assertEqual(type, fh.type) self.assertEqual(nx, fh.nx) self.assertEqual(ny, fh.ny) self.assertEqual(nz, fh.nz) self.assertEqual(nt, fh.nt) vars2 = fh.vars[:] var_levs2 = fh.var_levs[:] self.assertEqual(vars.sort(), vars2.sort()) self.assertEqual(var_levs.sort(), var_levs2.sort()) def test_03_Display(self): """ Displays several variables and checks contour intervals """ self._CheckCint('pslv', 1004, 1026, 2, z=1, t=1) def _CheckCint(self, name, cmin, cmax, cint, z=1, t=1): """ Check contour intervals during display. """ self.ga('clear') self.ga('display %s(z=%d,t=%d)' % (name, z, t)) self.assertEqual(cmin, int(self.ga.rword(2, 2))) self.assertEqual(cmax, int(self.ga.rword(2, 4))) self.assertEqual(cint, int(self.ga.rword(2, 6))) def _GenericSetUp(self, bin): global GrADSTestFiles global GrADSBinaryFiles self.ga = GrADS(Bin=GrADSBinaryFiles[bin], Echo=False, Window=False) self.fh = self.ga.open(GrADSTestFiles['pdef'])
def getMERRAero(self, npzFile=None, dir='/home/adasilva/iesa/MERRAero'): """ Get Met fields from MERRA. """ from grads import GrADS ga = GrADS(Window=False, Echo=False) ga.open(dir + '/geosgcm_surf.ddf') self.sampleFile(ga, onlyVars=('ustar', 'bstar', 'pblh', 'shfx', 'lhfx', 'rhos', 'ts')) ga('close 1') ga.open(dir + '/inst3d_prog_v.ddf') ga('set z 1 72') self.sampleFile(ga, onlyVars=('u', 'v', 't', 'qv')) ga('close 1') ga.open(dir + '/inst3d_aer_v.ddf') ga('set z 1 72') self.sampleFile(ga, onlyVars=('delp', ), npzFile=npzFile)
def attach(self, filename, Vars=None, Cache=False): """ Attach variables from gridded meteorological files, interpolating from the gridded values to the (lat,lon) of the fire. If the variables are 3D, the whole curtain is included. If *Vars* is not specified, all non-coordinate variables on file are included. When *Cache* is true, the variables are saved locally to directory "__cache__". When the input file name is "__cache__", the variables are read from cache. """ from grads import GrADS # Expects GrADS v2 # ---------------- ga = GrADS(Bin='grads', Window=False, Echo=False) # Open the file # ------------- fh = ga.open(filename) ga('set lon -180 180') # good for interpolation # Either all varibles on file or user subset # ------------------------------------------ if Vars == None: vinfo = fh.var_info else: vinfo = [] for v, k, l in fh.var_info: if v in Vars: vinfo.append((v, k, l)) if len(vinfo) == 0: print "IndexError: requested variables - ", Vars raise IndexError, "cannot find any matchig variable in file %f"\ %filename # For each observation, find the correspondng time on file # -------------------------------------------------------- utimes = unique(self.tga) # unique obs times in grads format self.tgaf = self.tga.copy() # will hold times on file for each ob for tga in utimes: ga('set time %s' % tga, Quiet=True) qh = ga('query time', Quiet=True) self.tgaf[self.tga == tga] = ga.rword(1, 3) # Loop over each desired variable and interpolate it to # fire location # ----------------------------------------------------- self.met = {} n = self.lon.size levs = 1000. * zeros(fh.nz) for v, nlevs, l in vinfo: if nlevs == 0: nlevs = 1 y_f = zeros(n) else: y_f = zeros((n, nlevs)) for tgaf in unique(self.tgaf): ga('set time %s' % tgaf, Quiet=True) ga('set z %d %d' % (1, nlevs), Quiet=True) m = (self.tgaf == tgaf) # gather obs for this time lon_, lat_ = (self.lon[m], self.lat[m]) print "- Interpolating %5d %s obs at %s" % (lon_.size, v, tgaf) y_f[m], levs = ga.interp(v, lon_, lat_) # interp & scatter self.met[v] = y_f self.met['levs'] = levs # record vertical levels
if __name__ == "__main__": from time import time as now from grads import GrADS f = GFIOctl('/nobackup/ARCTAS/opendap/arctas.ddf') lons = linspace(-45., -30., 100) lats = linspace(30., 50., 100) dt = f.dt / 10 t0 = datetime(2008, 6, 29, 12) times = array([t0 + i * dt for i in range(100)]) ga = GrADS(Window=False, Echo=0) fh = ga.open('/nobackup/ARCTAS/opendap/arctas.ddf') # Interpolating ps # ---------------- t_ = now() ps = f.sample('ps', lons, lats, times, Verbose=True) print "---> Interpolating <ps> with GFIO took ", now() - t_ t_ = now() ps_ = ga.sampleXYT('ps', lons, lats, tyme=times, Verbose=True) print "---> Interpolating <ps> with PyGrADS took ", now() - t_ # Interpolating RH # ---------------- print "" t_ = now() rh = f.sample('RH', lons, lats, times, Verbose=True)
d = datetime(Y, M, D, H) # Listo, asi queda definida una fecha especifica YY = str(d.year) MM = str(d.month).zfill(2) DD = str(d.day).zfill(2) HH = str(d.hour).zfill(2) d_fcst = d + delta_fcst # Nombre de fecha para escribir: Yfcst = str(d_fcst.year) Mfcst = str(d_fcst.month).zfill(2) Dfcst = str(d_fcst.day).zfill(2) Hfcst = str(d_fcst.hour).zfill(2) gefs_ctl = path_in + '/' + YY + MM + DD + '_' + HH + '/' + MEM + '/' + 'gens_' + YY + MM + DD + '_' + HH + '00_' + FCST + '_' + MEM + '.ctl' CTL = ga.open(gefs_ctl) # ------ PSFC ------- psfc_gefs = read_ctl(ga, 'psfc', 0) psfc_gefs = psfc_gefs / 100 psfc = interp(psfc_gefs, lon_gefs, lat_gefs, lon2d_era, lat2d_era, masked=True) # Variables con niveles verticales: geopt = np.ma.empty( (len(vertical_levels), np.shape(lat2d_era)[0], np.shape(lat2d_era)[1])) tk = np.ma.empty( (len(vertical_levels), np.shape(lat2d_era)[0], np.shape(lat2d_era)[1])) q = np.ma.empty( (len(vertical_levels), np.shape(lat2d_era)[0], np.shape(lat2d_era)[1])) u = np.ma.empty(
#!/usr/bin/env python # # Simple script testing the ext()/expr() methods # from pylab import * from grads import GrADS # Start GrADS and open the data file # ---------------------------------- ga = GrADS(Bin='grads', Echo=False, Port=True, Window=False) ga.open('../data/model.ctl') # XY slices # --------- ts1 = ga.exp('ts') ts2 = ga.expr('ts') print "XY Skin temperature: " print ts1.data - ts2.data # XYT slices # ---------- ga('set t 2 3') ts1 = ga.exp('ts') ts2 = ga.expr('ts') print "XYT Skin temperature: " print ts1.data - ts2.data # XYZ slices # ---------- ga('set t 3')
# para generar las matrices de GEFS de lat lon segui los siguientes pasos en ipython: #Martin Iglesias Github SudestadaARG import numpy as np from grads import GrADS ga = GrADS(Bin='grads', Echo=False, Port=True, Window=False) CTL = ga.open('gens_20151201_0000_012_01.ctl') ga('set lev 1000') t = ga.exp('TMPPRS') lats = t.grid.lat[:] # (181,) lons = t.grid.lon[:] # (361,) np.save('lon_gefs.npy', lons) np.save('lat_gefs.npy', lats) # Para generar las 2D con dimension (181,361): lat2d = np.empty((181, 361)) for i in range(0, 361): lat2d[:, i] = lats lon2d = np.empty((181, 361)) for i in range(0, 181): lon2d[i, :] = lons np.save('lon2d_gefs.npy', lon2d) np.save('lat2d_gefs.npy', lat2d)
class TestGrb2File(unittest.TestCase): def tearDown(self): del self.ga def _GenericSetUp(self, bin): global GrADSTestFiles global GrADSBinaryFiles self.ga = GrADS(Bin=GrADSBinaryFiles[bin], Echo=False, Window=False) self.fh = self.ga.open(GrADSTestFiles['grb2']) def test_01_Open(self): """ Check whether file was opened correctly. """ type = 'Gridded' vars = [ 'apcpsfc', 'hgtprs', 'prmslmsl', 'rhprs', 'tmpprs', 'ugrdprs', 'vgrdprs' ] var_levs = [0, 3, 0, 3, 3, 3, 3] nx, ny, nz, nt = (144, 73, 3, 4) # no E size yet fh = self.fh self.assertEqual(type, fh.type) self.assertEqual(nx, fh.nx) self.assertEqual(ny, fh.ny) self.assertEqual(nz, fh.nz) self.assertEqual(nt, fh.nt) vars2 = fh.vars[:] var_levs2 = fh.var_levs[:] self.assertEqual(vars.sort(), vars2.sort()) self.assertEqual(var_levs.sort(), var_levs2.sort()) def test_03_Display(self): """ Displays several variables and checks contour intervals """ self._CheckCint('apcpsfc', 0, 140, 10, z=1, t=2) self._CheckCint('0.01*prmslmsl', 950, 1050, 10, z=1, t=1) self._CheckCint('hgtprs', 900, 1600, 100, z=1, t=1) self._CheckCint('rhprs', 0, 100, 10, z=1, t=1) self._CheckCint('tmpprs', 235, 300, 5, z=1, t=1) self._CheckCint('ugrdprs', -30, 30, 10, z=1, t=1) self._CheckCint('vgrdprs', -25, 35, 5, z=1, t=1) self._CheckCint('apcpsfc', 0, 80, 10, z=1, t=4) self._CheckCint('0.01*prmslmsl', 950, 1040, 10, z=1, t=4) self._CheckCint('hgtprs', 900, 1600, 100, z=1, t=4) self._CheckCint('rhprs', 0, 100, 10, z=1, t=4) self._CheckCint('tmpprs', 240, 300, 5, z=1, t=4) self._CheckCint('ugrdprs', -25, 30, 5, z=1, t=4) self._CheckCint('vgrdprs', -25, 30, 5, z=1, t=4) self._CheckCint('hgtprs', 10800, 12400, 200, z=3, t=4) self._CheckCint('rhprs', 0, 100, 10, z=3, t=4) self._CheckCint('tmpprs', 200, 235, 5, z=3, t=4) self._CheckCint('ugrdprs', -40, 100, 10, z=3, t=4) self._CheckCint('vgrdprs', -50, 50, 10, z=3, t=4) def _CheckCint(self, name, cmin, cmax, cint, z=1, t=1): """ Check contour intervals during display. """ self.ga('clear') self.ga('display %s(z=%d,t=%d)' % (name, z, t)) self.assertEqual(cmin, int(self.ga.rword(1, 2))) self.assertEqual(cmax, int(self.ga.rword(1, 4))) self.assertEqual(cint, int(self.ga.rword(1, 6))) def _GenericSetUp(self, bin): global GrADSTestFiles global GrADSBinaryFiles self.ga = GrADS(Bin=GrADSBinaryFiles[bin], Echo=False, Window=False) self.fh = self.ga.open(GrADSTestFiles['grb2'])
class TestModelUrl(unittest.TestCase): def tearDown(self): del self.ga # os.system("/bin/rm -rf output") def test_01_Open(self): """ Check whether file was opened correctly. """ type = 'Gridded' vars = ['ps', 'ts', 'pr', 'ua', 'va', 'zg', 'ta', 'hus'] var_levs = [0, 0, 0, 7, 7, 7, 7, 7] nx, ny, nz, nt = (72, 46, 7, 5) fh = self.fh self.assertEqual(type, fh.type) self.assertEqual(nx, fh.nx) self.assertEqual(ny, fh.ny) self.assertEqual(nz, fh.nz) self.assertEqual(nt, fh.nt) vars2 = fh.vars[:] var_levs2 = fh.var_levs[:] self.assertEqual(vars.sort(), vars2.sort()) self.assertEqual(var_levs.sort(), var_levs2.sort()) def test_03_Display(self): """ Displays several variables and checks contour intervals """ self._CheckCint('ps', 500, 1000, 50, z=1, t=1) self._CheckCint('ts', 240, 310, 10, z=1, t=1) self._CheckCint('10000*pr', 0, 8, 1, z=1, t=1) self._CheckCint('ps', 500, 1000, 50, z=1, t=5) self._CheckCint('ts', 240, 310, 10, z=1, t=5) self._CheckCint('10000*pr', 0, 10, 1, z=1, t=5) self._CheckCint('ua', -12, 18, 3, z=1, t=1) self._CheckCint('va', -15, 15, 3, z=1, t=1) self._CheckCint('zg', -100, 300, 50, z=1, t=1) self._CheckCint('ta', 245, 300, 5, z=1, t=1) self._CheckCint('1000*hus', 2, 20, 2, z=1, t=5) self._CheckCint('ua', -15, 50, 5, z=7, t=5) self._CheckCint('va', -20, 20, 5, z=7, t=5) self._CheckCint('zg', 14800, 16400, 200, z=7, t=5) self._CheckCint('ta', 195, 225, 5, z=7, t=5) self._CheckCint('10000*hus', 1, 9, 1, z=5, t=5) def _CheckCint(self, name, cmin, cmax, cint, z=1, t=1): """ Check contour intervals during display. """ sys.stdout.write(name + ' ... ') self.ga('clear') self.ga('display %s(z=%d,t=%d)' % (name, z, t)) self.assertEqual(cmin, int(self.ga.rword(1, 2))) self.assertEqual(cmax, int(self.ga.rword(1, 4))) self.assertEqual(cint, int(self.ga.rword(1, 6))) def _GenericSetUp(self, bin, dat): global GrADSTestFiles global GrADSBinaryFiles self.ga = GrADS(Bin=GrADSBinaryFiles[bin], Echo=False, Window=False) self.fh = self.ga.open(GrADSTestFiles[dat])
class TestModelFile(unittest.TestCase): def tearDown(self): del self.ga # os.system("/bin/rm -rf output") def test_01_Open(self): """ Check whether file was opened correctly. """ type = 'Gridded' vars = ['ps', 'ts', 'pr', 'ua', 'va', 'zg', 'ta', 'hus'] var_levs = [0, 0, 0, 7, 7, 7, 7, 7] nx, ny, nz, nt = (72, 46, 7, 5) fh = self.fh self.assertEqual(type, fh.type) self.assertEqual(nx, fh.nx) self.assertEqual(ny, fh.ny) self.assertEqual(nz, fh.nz) self.assertEqual(nt, fh.nt) vars2 = fh.vars[:] var_levs2 = fh.var_levs[:] self.assertEqual(vars.sort(), vars2.sort()) self.assertEqual(var_levs.sort(), var_levs2.sort()) def test_02_Execs(self): """ Exercises the exec command using both Unix and DOS text files. """ self.ga("exec Exec.ga") self.ga("exec Exec_dos.ga") def test_02_Prints(self): """ Exercises print/print file.eps/printim but does verify results. This is not really a test as it does not check the outcome. """ self.ga("display ps") #self.ga("print output/ps.eps") #self.ga("enable print output/ps.gx") self.ga("gxprint output/ps.eps") self.ga("gxprint output/ps.pdf") self.ga("gxprint output/ps.png") #self.ga("gxprint output/ps.jpg") self.ga("gxprint output/ps.svg") #self.ga("gxprint output/ps.gif") #self.ga("disable print") def test_02_Printim(self): """ Exercises printim - not really a test as it does not check outcome. """ self.ga("q config") cf = self.ga.rline(1) if 'printim' in cf: self.ga("printim output/ps.png") def test_03_Display(self): """ Displays several variables and checks contour intervals """ self._CheckCint('ps', 500, 1000, 50, z=1, t=1) self._CheckCint('ts', 240, 310, 10, z=1, t=1) self._CheckCint('10000*pr', 0, 8, 1, z=1, t=1) self._CheckCint('ps', 500, 1000, 50, z=1, t=5) self._CheckCint('ts', 240, 310, 10, z=1, t=5) self._CheckCint('10000*pr', 0, 10, 1, z=1, t=5) self._CheckCint('ua', -12, 18, 3, z=1, t=1) self._CheckCint('va', -15, 15, 3, z=1, t=1) self._CheckCint('zg', -100, 300, 50, z=1, t=1) self._CheckCint('ta', 245, 300, 5, z=1, t=1) self._CheckCint('1000*hus', 2, 20, 2, z=1, t=5) self._CheckCint('ua', -15, 50, 5, z=7, t=5) self._CheckCint('va', -20, 20, 5, z=7, t=5) self._CheckCint('zg', 14800, 16400, 200, z=7, t=5) self._CheckCint('ta', 195, 225, 5, z=7, t=5) self._CheckCint('10000*hus', 1, 9, 1, z=5, t=5) def test_04_Write_generic(self): self.ga("set x 1 72") self.ga( "lats4d -o output/sequential -format sequential -vars ps ta -func sqrt(@) -time = = 2 " ) def test_04_Write_stream(self): self.ga("set x 1 72") self.ga("lats4d -o output/stream -be -format stream") def test_05_Read_stream(self): fh = self.ga.open("stream.ctl") self._CompareFiles(self.fh, fh) self.ga('close %d' % fh.fid) def test_04_Write_sequential(self): self.ga("set x 1 72") self.ga("lats4d -o output/sequential -le -format sequential") def test_05_Read_sequential(self): fh = self.ga.open("sequential.ctl") self._CompareFiles(self.fh, fh) self.ga('close %d' % fh.fid) def test_04_stats(self): self.ga("set x 1 72") self.ga("lats4d -format stats") def test_04_Write_mean(self): self.ga("set x 1 72") self.ga("lats4d -o output/mean -format stream -mean") def xtest_06_regriding_linear(self): self._CheckCint2("re(ts,2,2,bl)", 240, 310, 10) self._CheckCint2("re(ts,2,1,bl)", 240, 310, 10) def xtest_06_regriding_bessel(self): self._CheckCint2("re(ts,2,2,bs)", 240, 310, 10) self._CheckCint2("re(ts,2,1,bs)", 240, 310, 10) def xtest_06_regriding_box_average(self): self._CheckCint2("re(ts,2,2,ba)", 240, 310, 10) self._CheckCint2("re(ts,2,1,ba)", 240, 310, 10) def xtest_06_regriding_box_voting(self): self._CheckCint2("1e4*re(pr,8,8,vt,0.6,0.2)", 0, 8, 1) def _CheckCint(self, name, cmin, cmax, cint, z=1, t=1): """ Check contour intervals during display. """ self.ga('clear') self.ga('display %s(z=%d,t=%d)' % (name, z, t)) self.assertEqual(cmin, int(self.ga.rword(1, 2))) self.assertEqual(cmax, int(self.ga.rword(1, 4))) self.assertEqual(cint, int(self.ga.rword(1, 6))) def _CheckCint2(self, name, cmin, cmax, cint): """ Check contour intervals during display. """ self.ga.cmd('clear') self.ga.cmd('display %s' % name) self.assertEqual(cmin, int(self.ga.rword(1, 2))) self.assertEqual(cmax, int(self.ga.rword(1, 4))) self.assertEqual(cint, int(self.ga.rword(1, 6))) def _CompareFiles(self, fh1, fh2): vars1 = fh1.vars[:] vars2 = fh2.vars[:] self.assertEqual(vars1.sort(), vars2.sort()) self.assertEqual(fh1.nt, fh2.nt) for i in range(len(fh1.vars)): var = fh1.vars[i] nz = fh1.var_levs[i] if nz == 0: nz = 1 if var == 'hus': nz = 5 nt = fh1.nt for t in range(1, nt + 1): for z in range(1, nz + 1): self.ga('clear') self.ga('display %s.%d(z=%d,t=%d) - %s.%d(z=%d,t=%d)'\ %(var,fh1.fid,z,t,var,fh2.fid,z,t)) # print ">>> t=%d, z=%d, %s --- %s "%(t,z,var,self.ga.rline(1)) self.assertEqual(self.ga.rline(1), \ 'Constant field. Value = 0') def _GenericSetUp(self, bin, dat): global GrADSTestFiles global GrADSBinaryFiles self.ga = GrADS(Bin=GrADSBinaryFiles[bin], Echo=False, Window=False) self.fh = self.ga.open(GrADSTestFiles[dat]) def notest_04_LATS_Coards_1(self): self.ga("set x 1 72") self.ga("lats4d -o output/model ") def notest_04_LATS_Coards_2(self): fh = self.ga.open("output/model.nc") self._CompareFiles(self.fh, fh) self.ga('close %d' % fh.fid) def notest_04_LATS_GaGrib_1(self): self.ga("set x 1 72") self.ga("lats4d -o output/model -format grads_grib") def notest_04_LATS_GaGrib_2(self): fh = self.ga.open("output/model.ctl") self._CompareFiles(self.fh, fh) self.ga('close %d' % fh.fid) def notest_04_LATS_grib(self): self.ga("set x 1 72") self.ga("lats4d -o output/model -format grib")
#!/usr/bin/env python # # Simple script for computing percentiles for each horizontal # gridpoint. # from pylab import * from numpy import float32 from grads import GrADS, GaField # Start GrADS and open the data file # ---------------------------------- ga = GrADS(Bin='gradsnc',Echo=False,Port=True) ga.open('../data/slp_djf.nc') # Extract a timeseries # -------------------- ga('set t 1 41') x = ga.exp('djfslp/100') g = x.grid # Transpose spatial/temporal dimensions # ------------------------------------- (nt,ny,nx) = x.shape; x = transpose(x.reshape((nt,nx*ny))) # Compute percentiles using Matlab compatible prctile function # ------------------------------------------------------------ p = ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ) y = zeros((nx*ny,10),dtype=float32) for i in range(nx*ny):