[JOB] Extracting subset of dataset using latitude and longitude

Hello, I am looking for some help extracting a subset of data from a large dataset. The data is being read from a wgrib2 (World Meterological Organization standard gridded data) using the pygrib library. The data values, latitudes and longitudes are in separate lists (arrays?), and I would like a regional subset. The budget is not very large, but I am hoping that this is pretty simple job. I am just way too green at Python / numpy to know how to proceed, or even what to search for on Google. If interested, please e-mail jlounds@dynamiteinc.com Thank you! Jeremy Lounds DynamiteInc.com 1-877-762-7723, ext 711 Fax: 877-202-3014

Hi, I don't know if numpy has ready tool for this. I also have this use in my study. So I write a simple code for my personal use. It might no be great. I hope others can also respond as this is very basic function in earth data analysis. ############################################################3 import numpy as np lat=np.arange(89.75,-90,-0.5) lon=np.arange(-179.75,180,0.5) lon0,lat0=np.meshgrid(lon,lat) #crate the grid from demonstration def Get_GridValue(data,(vlat1,vlat2),(vlon1,vlon2)): index_lat=np.nonzero((lat[:]>=vlat1)&(lat[:]<=vlat2))[0] index_lon=np.nonzero((lon[:]>=vlon1)&(lon[:]<=vlon2))[0] target=data[...,index_lat[0]:index_lat[-1]+1,index_lon[0]:index_lon[-1]+1] return target Get_GridValue(lat0,(40,45),(-30,-25)) Get_GridValue(lon0,(40,45),(-30,-25)) ############################################################ Chao 2012/1/13 Jeremy Lounds <jlounds@dynamiteinc.com>
Hello,
I am looking for some help extracting a subset of data from a large dataset. The data is being read from a wgrib2 (World Meterological Organization standard gridded data) using the pygrib library.
The data values, latitudes and longitudes are in separate lists (arrays?), and I would like a regional subset.
The budget is not very large, but I am hoping that this is pretty simple job. I am just way too green at Python / numpy to know how to proceed, or even what to search for on Google.
If interested, please e-mail jlounds@dynamiteinc.com
Thank you!
Jeremy Lounds DynamiteInc.com 1-877-762-7723, ext 711 Fax: 877-202-3014 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
-- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************
participants (2)
-
Chao YUE
-
Jeremy Lounds