Re: Questions for projection or coordinates problems using MODIS data with ncl

From: H. Joe Lee <hyoklee_at_nyahnyahspammersnyahnyah>
Date: Tue Dec 17 2013 - 20:19:36 MST

Hi, Miae!

  You need to add .he2 to the HDF file name as illustrated in [1] to
retrieve lat/lon. You can find more MOIDS examples from [2].

  Regards,

[1]
http://hdfeos.org/zoo/LPDAAC/MYD09A1.A2007273.h03v07.005.2007285103507_sur_refl_b02.ncl
[2] http://hdfeos.org/zoo/index_openLPDAAC_Examples.php#MOD

--
HDF: Software that Powers Science
On Tue, Dec 17, 2013 at 7:44 PM, 김미애 <toa0710@naver.com> wrote:
> Hello,
>
>
>
> I am Miae Kim at Ulsan National Institute of Science and Technology
> (UNIST) in South Korea.
>
> I am using MODIS data including MOD11A2, MOD13A2, MOD15A2, MOD17A2,
> MOD16A2, MOD09A1 with NCAR Command Language (NCL) for my study.
>
> To do weighted average from 8-day MODIS data to monthly data, I did coding
> for the average with function named "dim_avg_wgt_n_Wrap".
>
> Although I got all the averaged monthly data, they did not have any
> projection information.
>
> Therefore, I could not define their projection in ArcGIS because there was
> no spatial information in the calculated data.
>
> I think.. I cannot make coding for projection information because the
> MODIS data (.hdf) do not have longitude and latitude information.
>
> Is there any way I can add projection information in the code? The
> following is my code for weighted average.
>
>
>
> Thank you so much.
>
>
>
> ==========================================================================
>
>    fpath = "/MODIS/2009/h28v05/"
>
>    fpaths = systemfunc("ls "+fpath+"MOD11A2.A2009*.hdf")
>
>    f1 = addfiles(fpaths,"r")
>
>    variable= f1[:]->LST_Day_1km
>
>
>
>    dims= dimsizes(variable)
>
>    ny=dims(0)
>
>    nx=dims(1)
>
>    nfile = ny/nx
>
>
>
>    input=new((/nfile,nx,nx/),float)
>
>     do i=0,nfile-1
>
>       input(i,:,:) = variable(i*nx:i*nx+nx-1,:)*0.02    ;t*x*y
>
>     end do
>
>    input@_FillValue=0
>
>
>
> wgt1=(/1, 1, 1, 0.875/)
>
> wgt2=(/0.125, 1, 1, 1, 0.5/)
>
> wgt3=(/0.5, 1, 1, 1, 0.375/)
>
> wgt4=(/0.625, 1, 1, 1, 0.125/)
>
> wgt5=(/0.875, 1, 1, 1/)
>
> wgt6=(/1, 1, 1, 0.75/)
>
> wgt7=(/0.25, 1, 1, 1, 0.625/)
>
> wgt8=(/0.375, 1, 1, 1, 0.5/)
>
> wgt9=(/0.5, 1, 1, 1, 0.25/)
>
> wgt10=(/0.75, 1, 1, 1, 0.125/)
>
> wgt11=(/0.875, 1, 1, 0.875/)
>
> wgt12=(/0.125, 1, 1, 1, 0.75/)
>
>
>
> avg1=dim_avg_wgt_n_Wrap(input(0:3,:,:), wgt1, 1, 0)
>
> avg2=dim_avg_wgt_n_Wrap(input(3:7,:,:), wgt2, 1, 0)
>
> avg3=dim_avg_wgt_n_Wrap(input(7:11,:,:), wgt3, 1, 0)
>
> avg4=dim_avg_wgt_n_Wrap(input(11:15,:,:), wgt4, 1, 0)
>
> avg5=dim_avg_wgt_n_Wrap(input(15:18,:,:), wgt5, 1, 0)
>
> avg6=dim_avg_wgt_n_Wrap(input(19:22,:,:), wgt6, 1, 0)
>
> avg7=dim_avg_wgt_n_Wrap(input(22:26,:,:), wgt7, 1, 0)
>
> avg8=dim_avg_wgt_n_Wrap(input(26:30,:,:), wgt8, 1, 0)
>
> avg9=dim_avg_wgt_n_Wrap(input(30:34,:,:), wgt9, 1, 0)
>
> avg10=dim_avg_wgt_n_Wrap(input(34:38,:,:), wgt10, 1, 0)
>
> avg11=dim_avg_wgt_n_Wrap(input(38:41,:,:), wgt11, 1, 0)
>
> avg12=dim_avg_wgt_n_Wrap(input(41:45,:,:), wgt12, 1, 0)
>
>
>
> printVarSummary(avg1)
>
> fout=addfile("lst_mon1.nc","c")
>
> fout->lst=avg1
>
> fout=addfile("lst_mon2.nc","c")
>
> fout->lst=avg2
>
> fout=addfile("lst_mon3.nc","c")
>
> fout->lst=avg3
>
> fout=addfile("lst_mon4.nc","c")
>
> fout->lst=avg4
>
> fout=addfile("lst_mon5.nc","c")
>
> fout->lst=avg5
>
> fout=addfile("lst_mon6.nc","c")
> fout->lst=avg6
> fout=addfile("lst_mon7.nc","c")
> fout->lst=avg7
> fout=addfile("lst_mon8.nc","c")
> fout->lst=avg8
> fout=addfile("lst_mon9.nc","c")
> fout->lst=avg9
> fout=addfile("lst_mon10.nc","c")
> fout->lst=avg10
> fout=addfile("lst_mon11.nc","c")
> fout->lst=avg11
> fout=addfile("lst_mon12.nc","c")
> fout->lst=avg12
>
> end
> =======================================================================
>
>
> Thank you so much again.
>
> Sincerely
>
>
>
> Miae
>
> -------------------------------------------------
> Miae Kim
> School of Urban and Environment Engineering
> Ulsan National Institute of Science and Technology (UNIST)
> UNIST-gil 50, Ulsan 689-798, South Korea
> Mobile: +82-10-9421-8287
> E-mail: toa0710@naver.com
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 17 20:20:08 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 18 2013 - 14:29:51 MST