co2/06.read_ascci_98.ncl
author Forrest Hoffman <forrest@climatemodeling.org>
Mon, 26 Jan 2009 22:08:20 -0500
changeset 0 0c6405ab2ff4
permissions -rw-r--r--
Initial commit of C-LAMP Diagnostics from Jeff Lee
forrest@0
     1
;************************************************
forrest@0
     2
;    Read ascii, Write nc                         
forrest@0
     3
;************************************************
forrest@0
     4
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  
forrest@0
     5
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"  
forrest@0
     6
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"   
forrest@0
     7
;************************************************
forrest@0
     8
begin
forrest@0
     9
; final output
forrest@0
    10
  diro  = "/fis/cgd/cseg/people/jeff/clamp_data/co2/"
forrest@0
    11
  filo =  "co2_globalView_98.nc"
forrest@0
    12
  c = addfile(diro+filo,"c")
forrest@0
    13
  filedimdef(c,"time",-1,True)
forrest@0
    14
forrest@0
    15
; input ascii files
forrest@0
    16
  diri  = "/fis/cgd/cseg/people/jeff/clamp_data/co2/globalView-C4Mip/seas/"
forrest@0
    17
  b = (/ \
forrest@0
    18
"aia005_02D2", \
forrest@0
    19
"alt_01D0", \
forrest@0
    20
"ams_01D0", \
forrest@0
    21
"asc_01D0", \
forrest@0
    22
"ask_01D0", \
forrest@0
    23
"avi_01D0", \
forrest@0
    24
"azr_01D0", \
forrest@0
    25
"bal_01D1", \
forrest@0
    26
"bgu_11D0", \
forrest@0
    27
"bhd_15C0", \
forrest@0
    28
"bme_01D0", \
forrest@0
    29
"bmw_01D0", \
forrest@0
    30
"brw_01C0", \
forrest@0
    31
"bsc_01D0", \
forrest@0
    32
"car030_01D2", \
forrest@0
    33
"cba_01D0", \
forrest@0
    34
"cfa_02D0", \
forrest@0
    35
"cgo_01D0", \
forrest@0
    36
"chr_01D0", \
forrest@0
    37
"cmn_17C0", \
forrest@0
    38
"cmo_01D0", \
forrest@0
    39
"coi_20C0", \
forrest@0
    40
"cpt_36C0", \
forrest@0
    41
"cri_02D0", \
forrest@0
    42
"crz_01D0", \
forrest@0
    43
"csj_06D0", \
forrest@0
    44
"daa_02D0", \
forrest@0
    45
"eic_01D0", \
forrest@0
    46
"esp_02D0", \
forrest@0
    47
"frd040_06C3", \
forrest@0
    48
"gmi_01D0", \
forrest@0
    49
"goz_01D0", \
forrest@0
    50
"gsn_24D0", \
forrest@0
    51
"haa005_01D2", \
forrest@0
    52
"hat_20C0", \
forrest@0
    53
"hba_01D0", \
forrest@0
    54
"hfm005_01D2", \
forrest@0
    55
"hun010_35C3", \
forrest@0
    56
"ice_01D0", \
forrest@0
    57
"itn051_01C3", \
forrest@0
    58
"izo_01D0", \
forrest@0
    59
"jbn_29C0", \
forrest@0
    60
"key_01D0", \
forrest@0
    61
"kum_01D0", \
forrest@0
    62
"kzd_01D0", \
forrest@0
    63
"kzm_01D0", \
forrest@0
    64
"lef011_01C3", \
forrest@0
    65
"ljo_04D0", \
forrest@0
    66
"lmp_28D0", \
forrest@0
    67
"maa_02D0", \
forrest@0
    68
"mbc_01D0", \
forrest@0
    69
"mhd_01D0", \
forrest@0
    70
"mid_01D0", \
forrest@0
    71
"mlo_01C0", \
forrest@0
    72
"mnm_19C0", \
forrest@0
    73
"mqa_02D0", \
forrest@0
    74
"nwr_01D0", \
forrest@0
    75
"obs023_06C3", \
forrest@0
    76
"opw_01D0", \
forrest@0
    77
"orl005_11D2", \
forrest@0
    78
"palcbc_30C0", \
forrest@0
    79
"pdm_11D0", \
forrest@0
    80
"pfa015_01D2", \
forrest@0
    81
"poc000_01D1", \
forrest@0
    82
"pocn05_01D1", \
forrest@0
    83
"pocs05_01D1", \
forrest@0
    84
"prs_21C0", \
forrest@0
    85
"psa_01D0", \
forrest@0
    86
"rpb_01D0", \
forrest@0
    87
"rta005_01D2", \
forrest@0
    88
"ryo_19C0", \
forrest@0
    89
"sbl_06C0", \
forrest@0
    90
"sch_23C0", \
forrest@0
    91
"scsn03_01D1", \
forrest@0
    92
"sey_01D0", \
forrest@0
    93
"shm_01D0", \
forrest@0
    94
"sis_02D0", \
forrest@0
    95
"smo_01C0", \
forrest@0
    96
"spo_01C0", \
forrest@0
    97
"stm_01D0", \
forrest@0
    98
"stp_12D0", \
forrest@0
    99
"sum_01D0", \
forrest@0
   100
"syo_01D0", \
forrest@0
   101
"tap_01D0", \
forrest@0
   102
"tdf_01D0", \
forrest@0
   103
"trm_11D0", \
forrest@0
   104
"uta_01D0", \
forrest@0
   105
"uum_01D0", \
forrest@0
   106
"wes_23C0", \
forrest@0
   107
"wis_01D0", \
forrest@0
   108
"wkt009_01C3", \
forrest@0
   109
"wlg_01D0", \
forrest@0
   110
"wpo000_10D2", \
forrest@0
   111
"wpon05_10D2", \
forrest@0
   112
"wpos05_10D2", \
forrest@0
   113
"yon_19C0", \
forrest@0
   114
"zep_01D0", \
forrest@0
   115
"zot005_45D2"/) 
forrest@0
   116
forrest@0
   117
  ntime = 12
forrest@0
   118
  ncase = dimsizes(b)
forrest@0
   119
  print (ncase)
forrest@0
   120
forrest@0
   121
  mean = new((/ncase,ntime/),float)
forrest@0
   122
  lat  = new((/ncase/),float)
forrest@0
   123
  lon  = new((/ncase/),float)
forrest@0
   124
  elev = new((/ncase/),float) 
forrest@0
   125
forrest@0
   126
  do n = 0,dimsizes(b)-1
forrest@0
   127
     fili = diri + b(n) + "_seas.co2"
forrest@0
   128
     print (fili)
forrest@0
   129
                    
forrest@0
   130
     ncol1 = 4
forrest@0
   131
     data1 = readAsciiTable(fili, ncol1, "float", (/10,17/))
forrest@0
   132
forrest@0
   133
     lat(n)  = data1(0,0)
forrest@0
   134
     lon(n)  = data1(0,1)
forrest@0
   135
     elev(n) = data1(0,2)
forrest@0
   136
forrest@0
   137
     ncol2 = 5
forrest@0
   138
     data2 = readAsciiTable(fili, ncol2, "float", 16)
forrest@0
   139
forrest@0
   140
     mean(n,:) = data2(:,1)
forrest@0
   141
  end do
forrest@0
   142
forrest@0
   143
; mean!0  = "case"
forrest@0
   144
; mean!1  = "time"
forrest@0
   145
; mean&case= ispan(1,ncase,1)
forrest@0
   146
; mean&time= ispan(1,ntime,1)
forrest@0
   147
  mean@units      = "u mol/mol"
forrest@0
   148
  mean@long_name  = "CO2 GlobalView seasonal"
forrest@0
   149
forrest@0
   150
; lat!0     = "case"
forrest@0
   151
; lon!0     = "case"
forrest@0
   152
; elev!0    = "case"
forrest@0
   153
; lat&case  = mean&case
forrest@0
   154
; lon&case  = mean&case
forrest@0
   155
; elev&case = mean&case
forrest@0
   156
forrest@0
   157
  lat@units      = "degrees_north"
forrest@0
   158
  lat@long_name  = "Latitude"
forrest@0
   159
  lon@units      = "degrees_ease"
forrest@0
   160
  lon@long_name  = "Longitude"        
forrest@0
   161
  elev@units      = "m"
forrest@0
   162
  elev@long_name  = "Elevation above sea level"
forrest@0
   163
  b@units      = ""
forrest@0
   164
  b@long_name  = "Station"
forrest@0
   165
forrest@0
   166
  print (lat)
forrest@0
   167
  print (mean)
forrest@0
   168
  print (b)
forrest@0
   169
  
forrest@0
   170
  c->LAT       = lat
forrest@0
   171
  c->LON       = lon
forrest@0
   172
  c->ELEV      = elev
forrest@0
   173
  c->CO2_SEAS  = mean
forrest@0
   174
  c->STATION   = stringtochar(b)  
forrest@0
   175
end