deliangwang的个人博客分享 http://blog.sciencenet.cn/u/deliangwang

博文

写一个与2MASS数据库做位置匹配的上传文件的IDL程序

已有 2553 次阅读 2013-1-29 23:02 |个人分类:编程笔记|系统分类:科研笔记| write, Source, Dec, 上传文件

Pro write_2mass_upfile,ra,dec,radius=radius,name=name, $
                       filename=filename,format=format

;+
;NAME:
;     write_2mass_upfile
;PURPOSE:
;     write a upfile for matched source list,matched with 2MASS
;CALLING SEQUENCE:
;     write_2mass_upfile,ra,dec,radius=radius,filename=filename,format=format,
;     /name
;INPUT:
;     RA        -----  RA for matched source list in Unit:degree
;     DEC       -----  DEC for matched source list in Unit:degree
;OPTIONAL KEYWORD INPUT:
;     radius    -----  match radius in Unit:arcsec
;                      default it,radius is 7.0 arcsec
;     name      -----  if set it,it will print source name.
;                      default it,it will print source sequence
;OPTIONAL KEYWORD OUTPUT:
;     filename  -----  name for output file
;                      default it,filename is '2mass_update.dat'
;     format    -----  format for output data
;
;EXAMPLE:
;     IDL> write_2mass_upfile,ra,dec,filename='rgb_2mass_update.dat'
;
;REVISION HISTORY:
;     Original by DL,Wang,Aug-17-2007
;-

    Npar = N_params()

    if ( Npar lt 2 ) then message, $
       'ERROR - RA and Declination do not have equal number of elements'

    if not keyword_set(radius) then radius=7.0
    if not keyword_set(format) then format='(1x,A14,1x,F10.6,1x,F10.6,1x,F3.1)'
    if not keyword_set(filename) then filename='2mass_update.dat'

    openw,lun,filename,/get_lun
    printf,lun,' Example of cone search'
    printf,lun,"EQUINOX = 'J2000.0'"
    printf,lun,'|   objname    |   ra     |   dec    |  radius  |'
    printf,lun,'|   string     |   double |   double |  double  |'
    printf,lun,'|   unit       | unit     | unit     | arcsec   |'
    if not keyword_set(name) then begin
       for i=0L,n_elements(ra)-1 do begin
           printf,lun,i+1,ra[i],dec[i],radius,F=format
       endfor
    endif else begin
       for i=0L,n_elements(ra)-1 do begin
           printf,lun,name[i],ra[i],dec[i],radius,F=format
       endfor
    endelse

    free_lun,lun

End



https://blog.sciencenet.cn/blog-456360-657731.html

上一篇:2MASS星等转化为流量的IDL程序
下一篇:由SDSS的测光坐标得到SDSS源的名字(IDL程序)
收藏 IP: 123.86.144.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-10-19 22:32

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部