beta/06.biome_model.ncl
changeset 1 4be95183fbcd
equal deleted inserted replaced
-1:000000000000 0:40308381be19
       
     1 ;********************************************************
       
     2 ; using model biome
       
     3 ;
       
     4 ; required command line input parameters:
       
     5 ;  ncl 'model_name="10cn" model_grid="T42" dirm="/.../ film="..."' 01.npp.ncl
       
     6 ;
       
     7 ;**************************************************************
       
     8 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
       
     9 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
       
    10 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
       
    11 ;**************************************************************
       
    12 procedure set_line(lines:string,nline:integer,newlines:string) 
       
    13 begin
       
    14 ; add line to ascci/html file
       
    15     
       
    16   nnewlines = dimsizes(newlines)
       
    17   if(nline+nnewlines-1.ge.dimsizes(lines))
       
    18     print("set_line: bad index, not setting anything.") 
       
    19     return
       
    20   end if 
       
    21   lines(nline:nline+nnewlines-1) = newlines
       
    22 ;  print ("lines = " + lines(nline:nline+nnewlines-1))
       
    23   nline = nline + nnewlines
       
    24   return 
       
    25 end
       
    26 ;**************************************************************
       
    27 ; Main code.
       
    28 begin
       
    29  
       
    30  plot_type     = "ps"
       
    31  plot_type_new = "png"
       
    32 
       
    33 ;************************************************
       
    34 ; read data: model       
       
    35 ;************************************************
       
    36  co2_i = 283.1878
       
    37  co2_f = 364.1252
       
    38 
       
    39  model_grid = "T42"
       
    40 
       
    41 ;model_name_i = "i01.07cn"
       
    42 ;model_name_f = "i01.10cn"
       
    43 
       
    44  model_name_i = "i01.07casa"
       
    45  model_name_f = "i01.10casa"
       
    46 
       
    47  model_name = model_name_f
       
    48 
       
    49  dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
       
    50  film_i = model_name_i + "_1990-2004_ANN_climo.nc"
       
    51  film_f = model_name_f + "_1990-2004_ANN_climo.nc"
       
    52 
       
    53  fm_i   = addfile (dirm+film_i,"r")
       
    54  fm_f   = addfile (dirm+film_f,"r")
       
    55   
       
    56  xm     = fm_f->lon  
       
    57  ym     = fm_f->lat
       
    58 
       
    59  npp_i  = fm_i->NPP
       
    60  npp_f  = fm_f->NPP
       
    61 
       
    62  delete (fm_i)
       
    63  delete (fm_f)
       
    64 
       
    65 ;Units for these variables are:
       
    66 ;npp_i: g C/m^2/s
       
    67 
       
    68  nsec_per_year = 60*60*24*365
       
    69   
       
    70  npp_i = npp_i *  nsec_per_year
       
    71  npp_f = npp_f *  nsec_per_year 
       
    72    
       
    73 ;===================================================
       
    74 ; read data: observed at stations
       
    75 ;===================================================
       
    76 
       
    77  station = (/"DukeFACE" \
       
    78             ,"AspenFACE" \
       
    79             ,"ORNL-FACE" \
       
    80             ,"POP-EUROFACE" \
       
    81             /)
       
    82 
       
    83  lat_ob = (/ 35.58,  45.40,  35.54, 42.22/)
       
    84  lon_ob = (/-79.05, -89.37, -84.20, 11.48/)
       
    85  lon_ob = where(lon_ob.lt.0.,lon_ob+360.,lon_ob)
       
    86 ;print (lon_ob)
       
    87 
       
    88  n_sta  = dimsizes(station)
       
    89  beta_4_ob = new((/n_sta/),float)
       
    90  beta_4_ob = 0.60
       
    91 
       
    92 ;===================================================
       
    93 ; get model data at station 
       
    94 ;===================================================
       
    95 
       
    96  npp_i_4  =linint2_points(xm,ym,npp_i,True,lon_ob,lat_ob,0)
       
    97 
       
    98  npp_f_4  =linint2_points(xm,ym,npp_f,True,lon_ob,lat_ob,0)
       
    99 
       
   100 ;print (npp_i_4)
       
   101 ;print (npp_f_4)
       
   102 
       
   103 ;============================
       
   104 ;compute beta_4
       
   105 ;============================
       
   106 
       
   107  beta_4 = new((/n_sta/),float)
       
   108 
       
   109  beta_4 = ((npp_f_4/npp_i_4) - 1.)/log(co2_f/co2_i)
       
   110 
       
   111  beta_4_avg = avg(beta_4)
       
   112 
       
   113 ;print (beta_4)
       
   114 ;print (beta_4_avg)
       
   115 
       
   116 ;M_beta = abs((beta_4_avg/beta_4_ob) - 1.)* 3.
       
   117 
       
   118  bias = sum(abs(beta_4-beta_4_ob)/(abs(beta_4)+abs(beta_4_ob))) 
       
   119  M_beta  = (1. - (bias/n_sta))*3.
       
   120  
       
   121  print (M_beta)
       
   122 
       
   123 ;=========================
       
   124 ; for html table - station
       
   125 ;=========================
       
   126 
       
   127   output_html = "table_station.html"
       
   128 
       
   129 ; column (not including header column)
       
   130 
       
   131   col_head = (/"Latitude","Longitude","CO2_i","CO2_f","NPP_i","NPP_f","Beta_model","Beta_ob"/)
       
   132 
       
   133   ncol = dimsizes(col_head)
       
   134 
       
   135 ; row (not including header row)
       
   136   row_head = (/"DukeFACE" \
       
   137               ,"AspenFACE" \
       
   138               ,"ORNL-FACE" \
       
   139               ,"POP-EUROFACE" \
       
   140               ,"All Station" \                
       
   141               /)  
       
   142   nrow = dimsizes(row_head)                  
       
   143 
       
   144 ; arrays to be passed to table. 
       
   145   text4 = new ((/nrow, ncol/),string )
       
   146 
       
   147  do i=0,nrow-2
       
   148   text4(i,0) = sprintf("%.1f",lat_ob(i))
       
   149   text4(i,1) = sprintf("%.1f",lon_ob(i))
       
   150   text4(i,2) = sprintf("%.1f",co2_i)
       
   151   text4(i,3) = sprintf("%.1f",co2_f)
       
   152   text4(i,4) = sprintf("%.1f",npp_i_4(0,i))
       
   153   text4(i,5) = sprintf("%.1f",npp_f_4(0,i))
       
   154   text4(i,6) = sprintf("%.2f",beta_4(i))
       
   155   text4(i,7) = "-"
       
   156  end do
       
   157   text4(nrow-1,0) = "-"
       
   158   text4(nrow-1,1) = "-"
       
   159   text4(nrow-1,2) = "-"
       
   160   text4(nrow-1,3) = "-"
       
   161   text4(nrow-1,4) = "-"
       
   162   text4(nrow-1,5) = "-"
       
   163   text4(nrow-1,6) = sprintf("%.2f",beta_4_avg)
       
   164   text4(nrow-1,7) = sprintf("%.2f",avg(beta_4_ob))
       
   165 
       
   166 ;-----------
       
   167 ; html table
       
   168 ;-----------
       
   169 
       
   170   header_text = "<H1>Beta Factor: Model "+model_name+"</H1>" 
       
   171 
       
   172   header = (/"<HTML>" \
       
   173             ,"<HEAD>" \
       
   174             ,"<TITLE>CLAMP metrics</TITLE>" \
       
   175             ,"</HEAD>" \
       
   176             ,header_text \
       
   177             /) 
       
   178   footer = "</HTML>"
       
   179 
       
   180   table_header = (/ \
       
   181         "<table border=1 cellspacing=0 cellpadding=3 width=80%>" \
       
   182        ,"<tr>" \
       
   183        ,"   <th bgcolor=DDDDDD >Station</th>" \
       
   184        ,"   <th bgcolor=DDDDDD >"+col_head(0)+"</th>" \
       
   185        ,"   <th bgcolor=DDDDDD >"+col_head(1)+"</th>" \
       
   186        ,"   <th bgcolor=DDDDDD >"+col_head(2)+"</th>" \
       
   187        ,"   <th bgcolor=DDDDDD >"+col_head(3)+"</th>" \
       
   188        ,"   <th bgcolor=DDDDDD >"+col_head(4)+"</th>" \
       
   189        ,"   <th bgcolor=DDDDDD >"+col_head(5)+"</th>" \
       
   190        ,"   <th bgcolor=DDDDDD >"+col_head(6)+"</th>" \
       
   191        ,"   <th bgcolor=DDDDDD >"+col_head(7)+"</th>" \
       
   192        ,"</tr>" \
       
   193        /)
       
   194   table_footer = "</table>"
       
   195   row_header = "<tr>"
       
   196   row_footer = "</tr>"
       
   197 
       
   198   lines = new(50000,string)
       
   199   nline = 0
       
   200 
       
   201   set_line(lines,nline,header)
       
   202   set_line(lines,nline,table_header)
       
   203 ;-----------------------------------------------
       
   204 ;row of table
       
   205 
       
   206   do n = 0,nrow-1
       
   207      set_line(lines,nline,row_header)
       
   208 
       
   209      txt1  = row_head(n)
       
   210      txt2  = text4(n,0)
       
   211      txt3  = text4(n,1)
       
   212      txt4  = text4(n,2)
       
   213      txt5  = text4(n,3)
       
   214      txt6  = text4(n,4)
       
   215      txt7  = text4(n,5)
       
   216      txt8  = text4(n,6)
       
   217      txt9  = text4(n,7)
       
   218 
       
   219      set_line(lines,nline,"<th>"+txt1+"</th>")
       
   220      set_line(lines,nline,"<th>"+txt2+"</th>")
       
   221      set_line(lines,nline,"<th>"+txt3+"</th>")
       
   222      set_line(lines,nline,"<th>"+txt4+"</th>")
       
   223      set_line(lines,nline,"<th>"+txt5+"</th>")
       
   224      set_line(lines,nline,"<th>"+txt6+"</th>")
       
   225      set_line(lines,nline,"<th>"+txt7+"</th>")
       
   226      set_line(lines,nline,"<th>"+txt8+"</th>")
       
   227      set_line(lines,nline,"<th>"+txt9+"</th>")
       
   228 
       
   229      set_line(lines,nline,row_footer)
       
   230   end do
       
   231 ;-----------------------------------------------
       
   232   set_line(lines,nline,table_footer)
       
   233   set_line(lines,nline,footer) 
       
   234 
       
   235 ; Now write to an HTML file.
       
   236   idx = ind(.not.ismissing(lines))
       
   237   if(.not.any(ismissing(idx))) then
       
   238     asciiwrite(output_html,lines(idx))
       
   239   else
       
   240    print ("error?")
       
   241   end if
       
   242 
       
   243   delete (col_head)
       
   244   delete (row_head)
       
   245   delete (text4)
       
   246   delete (table_header)
       
   247   delete (idx)
       
   248 
       
   249 ;------------------------------------------------
       
   250 ; read biome data: model
       
   251 
       
   252   biome_name_mod = "Model PFT Class"
       
   253 
       
   254   dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
       
   255   film = "class_pft_"+model_grid+".nc"
       
   256 
       
   257   fm = addfile(dirm+film,"r")
       
   258  
       
   259   classmod = fm->CLASS_PFT               
       
   260 
       
   261   delete (fm)
       
   262 
       
   263 ; model data has 17 land-type classes
       
   264 
       
   265   nclass_mod = 17
       
   266 
       
   267 ;------------------------------------------------
       
   268 ; read biome data: observed
       
   269 
       
   270   biome_name_ob = "MODIS LandCover"
       
   271 
       
   272   diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/ob/"
       
   273   filo = "land_class_"+model_grid+".nc"
       
   274 
       
   275   fo = addfile(diro+filo,"r")
       
   276  
       
   277   classob = tofloat(fo->LAND_CLASS)               
       
   278 
       
   279   delete (fo)
       
   280 
       
   281 ; input observed data has 20 land-type classes
       
   282 
       
   283   nclass_ob = 20
       
   284                 
       
   285 ;********************************************************************
       
   286 ; use land-type class to bin the data in equally spaced ranges
       
   287 ;********************************************************************
       
   288 
       
   289 ; using observed biome class  
       
   290 ; nclass      = nclass_ob
       
   291 ; using model biome class
       
   292   nclass      = nclass_mod
       
   293 
       
   294   nclassn     = nclass + 1
       
   295   range       = fspan(0,nclassn-1,nclassn)
       
   296 ; print (range)
       
   297 
       
   298 ; Use this range information to grab all the values in a
       
   299 ; particular range, and then take an average.
       
   300 
       
   301   nr           = dimsizes(range)
       
   302   nx           = nr-1
       
   303   xvalues      = new((/2,nx/),float)
       
   304   xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2.
       
   305   dx           = xvalues(0,1) - xvalues(0,0)       ; range width
       
   306   dx4          = dx/4                              ; 1/4 of the range
       
   307   xvalues(1,:) = xvalues(0,:) - dx/5.
       
   308 
       
   309 ;==============================
       
   310 ; put data into bins
       
   311 ;==============================
       
   312 
       
   313 ; using observed biome class
       
   314 ; base_1D  = ndtooned(classob)
       
   315 ; using model biome class
       
   316   base_1D  = ndtooned(classmod)
       
   317 
       
   318   data1_1D = ndtooned(npp_i)
       
   319   data2_1D = ndtooned(npp_f)
       
   320 
       
   321 ; output
       
   322 
       
   323   yvalues = new((/2,nx/),float)
       
   324   count   = new((/2,nx/),float)
       
   325 
       
   326   do nd=0,1
       
   327 
       
   328 ;   See if we are doing data1 (nd=0) or data2 (nd=1).
       
   329 
       
   330     base = base_1D
       
   331 
       
   332     if(nd.eq.0) then
       
   333       data = data1_1D
       
   334     else
       
   335       data = data2_1D
       
   336     end if
       
   337 
       
   338 ; Loop through each range, using base.
       
   339 
       
   340     do i=0,nr-2
       
   341       if (i.ne.(nr-2)) then
       
   342 ;        print("")
       
   343 ;        print("In range ["+range(i)+","+range(i+1)+")")
       
   344          idx = ind((base.ge.range(i)).and.(base.lt.range(i+1)))
       
   345       else
       
   346 ;        print("")
       
   347 ;        print("In range ["+range(i)+",)")
       
   348          idx = ind(base.ge.range(i))
       
   349       end if
       
   350 
       
   351 ;     Calculate average 
       
   352 
       
   353       if(.not.any(ismissing(idx))) then
       
   354         yvalues(nd,i) = avg(data(idx))
       
   355         count(nd,i)   = dimsizes(idx)
       
   356       else
       
   357         yvalues(nd,i) = yvalues@_FillValue
       
   358         count(nd,i)   = 0
       
   359       end if
       
   360 
       
   361 ;#############################################################
       
   362 ;using observed biome class:
       
   363 ; 
       
   364 ;     set the following 4 classes to _FillValue:
       
   365 ;     Water Bodies(0), Urban and Build-Up(13),
       
   366 ;     Permenant Snow and Ice(15), Unclassified(17)
       
   367 
       
   368 ;     if (i.eq.0 .or. i.eq.13 .or. i.eq.15 .or. i.eq.17) then
       
   369 ;        yvalues(nd,i) = yvalues@_FillValue
       
   370 ;        count(nd,i)   = 0
       
   371 ;     end if
       
   372 ;############################################################# 
       
   373 
       
   374 ;#############################################################
       
   375 ;using model biome class:
       
   376 ;
       
   377 ;     set the following 4 classes to _FillValue:
       
   378 ;     (3)Needleleaf Deciduous Boreal Tree,
       
   379 ;     (8)Broadleaf Deciduous Boreal Tree,
       
   380 ;     (9)Broadleaf Evergreen Shrub,
       
   381 ;     (16)Wheat
       
   382 
       
   383       if (i.eq.3 .or. i.eq.8 .or. i.eq.9 .or. i.eq.16) then
       
   384          yvalues(nd,i) = yvalues@_FillValue
       
   385          count(nd,i)   = 0
       
   386       end if
       
   387 ;############################################################# 
       
   388 
       
   389 ;     print(nd + ": " + count(nd,i) + " points, avg = " + yvalues(nd,i))
       
   390 
       
   391 ; Clean up for next time in loop.
       
   392 
       
   393       delete(idx)
       
   394     end do
       
   395 
       
   396     delete(data)
       
   397   end do
       
   398 
       
   399 ;============================
       
   400 ;compute beta
       
   401 ;============================
       
   402 
       
   403  u       = yvalues(0,:)
       
   404  v       = yvalues(1,:)
       
   405  u_count = count(0,:)
       
   406  v_count = count(1,:)
       
   407 
       
   408  good = ind(.not.ismissing(u) .and. .not.ismissing(v))
       
   409 
       
   410  uu       = u(good)
       
   411  vv       = v(good)
       
   412  uu_count = u_count(good)
       
   413  vv_count = v_count(good) 
       
   414 
       
   415  n_biome = dimsizes(uu)
       
   416  beta_biome = new((/n_biome/),float)
       
   417 
       
   418  beta_biome = ((vv/uu) - 1.)/log(co2_f/co2_i)
       
   419 
       
   420 ;beta_biome_avg = avg(beta_biome)
       
   421  beta_biome_avg = (sum(vv*vv_count)/sum(uu*uu_count) - 1.)/log(co2_f/co2_i)
       
   422   
       
   423 ;print (beta_biome_avg)
       
   424 
       
   425 ;===========================
       
   426 ; for html table - biome
       
   427 ;===========================
       
   428 
       
   429   output_html = "table_biome.html"
       
   430 
       
   431 ; column (not including header column)
       
   432 
       
   433   col_head = (/"CO2_i","CO2_f","NPP_i","NPP_f","Beta_model"/)
       
   434 
       
   435   ncol = dimsizes(col_head)
       
   436 
       
   437 ; row (not including header row)
       
   438 
       
   439 ;----------------------------------------------------
       
   440 ; using observed biome class:
       
   441 ;  
       
   442 ; row_head  = (/"Evergreen Needleleaf Forests" \
       
   443 ;              ,"Evergreen Broadleaf Forests" \
       
   444 ;              ,"Deciduous Needleleaf Forest" \
       
   445 ;              ,"Deciduous Broadleaf Forests" \
       
   446 ;              ,"Mixed Forests" \                      
       
   447 ;              ,"Closed Bushlands" \                   
       
   448 ;              ,"Open Bushlands" \                     
       
   449 ;              ,"Woody Savannas (S. Hem.)" \           
       
   450 ;              ,"Savannas (S. Hem.)" \                 
       
   451 ;              ,"Grasslands" \                         
       
   452 ;              ,"Permanent Wetlands" \                 
       
   453 ;              ,"Croplands" \                                           
       
   454 ;              ,"Cropland/Natural Vegetation Mosaic" \             
       
   455 ;              ,"Barren or Sparsely Vegetated" \                             
       
   456 ;              ,"Woody Savannas (N. Hem.)" \           
       
   457 ;              ,"Savannas (N. Hem.)" \
       
   458 ;              ,"All Biome" \                
       
   459 ;              /)
       
   460 
       
   461 ;----------------------------------------------------
       
   462 ; using model biome class:
       
   463 ;  
       
   464   row_head  = (/"Not Vegetated" \
       
   465                ,"Needleleaf Evergreen Temperate Tree" \
       
   466                ,"Needleleaf Evergreen Boreal Tree" \
       
   467 ;              ,"Needleleaf Deciduous Boreal Tree" \
       
   468                ,"Broadleaf Evergreen Tropical Tree" \
       
   469                ,"Broadleaf Evergreen Temperate Tree" \
       
   470                ,"Broadleaf Deciduous Tropical Tree" \
       
   471                ,"Broadleaf Deciduous Temperate Tree" \
       
   472 ;              ,"Broadleaf Deciduous Boreal Tree" \
       
   473 ;              ,"Broadleaf Evergreen Shrub" \
       
   474                ,"Broadleaf Deciduous Temperate Shrub" \
       
   475                ,"Broadleaf Deciduous Boreal Shrub" \
       
   476                ,"C3 Arctic Grass" \
       
   477                ,"C3 Non-Arctic Grass" \
       
   478                ,"C4 Grass" \
       
   479                ,"Corn" \
       
   480 ;              ,"Wheat" \                      
       
   481                ,"All Biome" \                
       
   482                /)  
       
   483 
       
   484   nrow = dimsizes(row_head)                  
       
   485 
       
   486 ; arrays to be passed to table. 
       
   487   text4 = new ((/nrow, ncol/),string )
       
   488  
       
   489  do i=0,nrow-2
       
   490   text4(i,0) = sprintf("%.1f",co2_i)
       
   491   text4(i,1) = sprintf("%.1f",co2_f)
       
   492   text4(i,2) = sprintf("%.1f",uu(i))
       
   493   text4(i,3) = sprintf("%.1f",vv(i))
       
   494   text4(i,4) = sprintf("%.2f",beta_biome(i))
       
   495  end do
       
   496   text4(nrow-1,0) = "-"
       
   497   text4(nrow-1,1) = "-"
       
   498   text4(nrow-1,2) = "-"
       
   499   text4(nrow-1,3) = "-"
       
   500   text4(nrow-1,4) = sprintf("%.2f",beta_biome_avg)
       
   501 
       
   502 ;**************************************************
       
   503 ; html table
       
   504 ;**************************************************
       
   505 
       
   506   header_text = "<H1>Beta Factor: Model "+model_name+"</H1>" 
       
   507 
       
   508   header = (/"<HTML>" \
       
   509             ,"<HEAD>" \
       
   510             ,"<TITLE>CLAMP metrics</TITLE>" \
       
   511             ,"</HEAD>" \
       
   512             ,header_text \
       
   513             /) 
       
   514   footer = "</HTML>"
       
   515 
       
   516   table_header = (/ \
       
   517         "<table border=1 cellspacing=0 cellpadding=3 width=80%>" \
       
   518        ,"<tr>" \
       
   519        ,"   <th bgcolor=DDDDDD >Biome Class</th>" \
       
   520        ,"   <th bgcolor=DDDDDD >"+col_head(0)+"</th>" \
       
   521        ,"   <th bgcolor=DDDDDD >"+col_head(1)+"</th>" \
       
   522        ,"   <th bgcolor=DDDDDD >"+col_head(2)+"</th>" \
       
   523        ,"   <th bgcolor=DDDDDD >"+col_head(3)+"</th>" \
       
   524        ,"   <th bgcolor=DDDDDD >"+col_head(4)+"</th>" \
       
   525        ,"</tr>" \
       
   526        /)
       
   527   table_footer = "</table>"
       
   528   row_header = "<tr>"
       
   529   row_footer = "</tr>"
       
   530 
       
   531   lines = new(50000,string)
       
   532   nline = 0
       
   533 
       
   534   set_line(lines,nline,header)
       
   535   set_line(lines,nline,table_header)
       
   536 ;-----------------------------------------------
       
   537 ;row of table
       
   538 
       
   539   do n = 0,nrow-1
       
   540      set_line(lines,nline,row_header)
       
   541 
       
   542      txt1  = row_head(n)
       
   543      txt2  = text4(n,0)
       
   544      txt3  = text4(n,1)
       
   545      txt4  = text4(n,2)
       
   546      txt5  = text4(n,3)
       
   547      txt6  = text4(n,4)
       
   548 
       
   549      set_line(lines,nline,"<th>"+txt1+"</th>")
       
   550      set_line(lines,nline,"<th>"+txt2+"</th>")
       
   551      set_line(lines,nline,"<th>"+txt3+"</th>")
       
   552      set_line(lines,nline,"<th>"+txt4+"</th>")
       
   553      set_line(lines,nline,"<th>"+txt5+"</th>")
       
   554      set_line(lines,nline,"<th>"+txt6+"</th>")
       
   555 
       
   556      set_line(lines,nline,row_footer)
       
   557   end do
       
   558 ;-----------------------------------------------
       
   559   set_line(lines,nline,table_footer)
       
   560   set_line(lines,nline,footer) 
       
   561 
       
   562 ; Now write to an HTML file.
       
   563   idx = ind(.not.ismissing(lines))
       
   564   if(.not.any(ismissing(idx))) then
       
   565     asciiwrite(output_html,lines(idx))
       
   566   else
       
   567    print ("error?")
       
   568   end if
       
   569 
       
   570 end
       
   571