louis Vonder wrote:
> Hi every body,
>
> There is someone who know how to convert "TRMM Monthly
> 0.5° x 0.5° Convective/Stratiform Heating" from HDF to
> NETCDF?
>
> Here link to the files
> http://daac.gsfc.nasa.gov/daac-bin/whom/mk_page_cgi.pl?PATH=datapool/TRMM_DP/01_Data_Products/02_Gridded/09_Monthly_Heating_CSH/1998
>
>
=====[1]============
%> ncl_convert2nc CSH.980101.6.HDF
http://www.ncl.ucar.edu/Document/Tools/ncl_convert2nc.shtml
=====[2]============
to examine the HDF file's contents *directly*
%> ncl_filedump CSH.980101.6.HDF
http://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml
=====[3]=============
From an NCL script there is *no need* to convert to netCDF.
Read the HDF directly
=====[4]=============
This is typical of HDF created by satellite people.
A lot of the information in the header is superfluous .... a template is
used
[a] There is wrong info. The missing value code says -9999.0
but it is -9999.9
x@_FillValue = -9999.9
[b] There is no information on the units.
[c] There is no height information.
I modified an existing script to read this file. It is atteached.
Cheers!
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
;************************************************
; open/read file
;************************************************
diri = "./"
;fili = systemfunc("cd "+diri+" ; ls CSH*HDF")
;nfil = dimsizes(fili)
fili = "CSH.980101.6.HDF"
f = addfile(diri+fili,"r")
x = f->LatentHeating ; (scan, height, longitude, latitude)
dimx = dimsizes( x )
nscan = dimx(0)
khgt = dimx(1)
mlon = dimx(2)
nlat = dimx(3)
print(dimx)
printVarSummary( x )
printMinMax( x, True )
;************************************************
; Manually add meta data
; lat/lon information part of HDF objects ... must manually specify
; lat/lon resolution is 0.5
;************************************************
x_at_long_name = "latent heating"
x_at_units = "???"
x@_FillValue = -9999.9 ; header says -9999.0 but it is wrong
lon = lonGlobeFo(mlon, "lon", "longitude", "degrees_east")
lat = fspan(-36.75,36.75,nlat)
lat!0 = "lat"
lat_at_units = "degrees_north"
;height= ??????
;height_at_long_name = "???"
;height_at_units = "???"
x&longitude = lon
x&latitude = lat
printVarSummary( x )
printMinMax( x, True )
;************************************************
; create plot
; gsn_csm want the rightmost dimensions to be (...latitude,longtitude)
;************************************************
wks = gsn_open_wks("ps" ,"CSH") ; open a ps file
gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
res = True ; plot mods desired
res_at_cnFillOn = True ; turn on color fill
res_at_cnLinesOn = False ; turn of contour lines
;res_at_cnLevelSpacingF = 0.5 ; contour spacing
res_at_gsnSpreadColors = True ; use full range of color map
res_at_lbLabelAutoStride = True
res_at_mpMinLatF = min(lat)
res_at_mpMaxLatF = max(lat)
hgt = 1
res_at_gsnCenterString = "hgt="+hgt
plot = gsn_csm_contour_map_ce(wks,x(scan|0,height|hgt,latitude|:,longitude|:), res)
end
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Feb 25 2008 - 10:51:25 MST
This archive was generated by hypermail 2.2.0 : Fri Feb 29 2008 - 11:15:04 MST