Re: HDF question about lat and lon indices

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 21 Mar 2008 21:48:32 -0600 (MDT)

;*****************************************************
; Create TRMM coordinate variables
;*****************************************************
   nlat = 400
   mlon = 1440
   lat = ispan(0,nlat-1,1)*0.25 - 49.875
   lon = ispan(0,mlon-1,1)*0.25 - 179.875
  
   lat!0 = "lat"
   lat&lat = lat
   lat_at_long_name = "latitude"
   lat_at_units = "degrees_north"
 
   lon!0 = "lon"
   lon&lon = lon
   lon_at_long_name = "longitude"
   lon_at_units = "degrees_east"

   R&longitude = lon
   R&latitude = lat
   printVarSummary( R )

To access data between latS, latN, lonL, lonR

   r = R(:,{longitude|lonL:lonR},{latitude|latS:latN})

Note for map plotting you should reorder to (time,latitude,longitude)

 

On Fri, 21 Mar 2008, Erik Noble wrote:

> Hi.
> I have lots of TRMM data files. I used NCL to read in the precipitation
> variable and merge it all together. Does anyone have any familiarity with
> specifying the latitudes and longitudes in an HDF file? I want to use the
> data over a certain domain.
>
> Sincerely,
> Erik
>
> Erik_at_noble:/Volumes/Data_and_Models/Precipitation_data/observed/TRMM:ncl
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ncl 5> fils = systemfunc ("ls *.HDF")
> ncl 6> d = dimsizes(fils)
> ncl 7> print(d)
>
>
> Variable: d
> Type: integer
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 488
> ncl 8> f = addfiles (fils, "r")
> ncl 9> R = addfiles_GetVar (f, fils, "precipitation")
> ncl 10> printVarSummary(R)
>
>
> Variable: R
> Type: float
> Total Size: 1124352000 bytes
> 281088000 values
> Number of Dimensions: 3
> Dimensions and sizes: [scan | 488] x [longitude | 1440] x [latitude |
> 400]
> Coordinates:
> Number Of Attributes: 1
> hdf_name : precipitation
> ncl 11>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 21 2008 - 21:48:32 MDT

This archive was generated by hypermail 2.2.0 : Sun Mar 23 2008 - 15:01:36 MDT