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" load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl" begin ;0 1 2 3 4 5 6 7 8 9 10 11 12 ; year month GPP(tonC/ha) NPP(tonC/ha) Rh(tonC/ha) Ra(tonC/ha) NEE(tonC/ha) Evap(mm/yr) Runoff(mm/yr) H LE USOLO ;1 2001 1 0.8687E+00 -0.1092E+00 0.2437E+00 0.9779E+00 0.3529E+00 0.3212E+02 0.1359E+03 0.8193E+06 -0.8063E+08 0.2454E+07 ; linhas e colunas do arquivo lin = 143 col = 13 ctrl = asciiread("ctrl.txt",(/lin,col/),"float") var1 = asciiread("co2-370ppm.txt",(/lin,col/),"float") var2 = asciiread("co2-700ppm.txt",(/lin,col/),"float") tstart = 2001 ; jan/2001 tend = 2012 ; dez/2012 yyyymm = yyyymm_time(tstart, tend, "integer") yyyyfrac = yyyymm_to_yyyyfrac(yyyymm,0) ; create fractional years for do coluna = 3,7 if (coluna .eq. 3) then titulo = "Gross Primary Productivity (GPP)" eixoy = "GPP (tonC ha~S~-1~N~)" nome = "GPP" end if if (coluna .eq. 4) then titulo = "Net Primary Productivity (NPP)" eixoy = "NPP (tonC ha~S~-1~N~)" nome = "NPP" end if if (coluna .eq. 5) then titulo = "Heterotrofic Respiration (RH)" eixoy = "RH (tonC ha~S~-1~N~)" nome = "RH" end if if (coluna .eq. 6) then titulo = "Autotrofic Respiration (RA)" eixoy = "RA (tonC ha~S~-1~N~)" nome = "RA" end if if (coluna .eq. 7) then titulo = "Net Ecosystem Exchange (NEE)" eixoy = "NEE (tonC ha~S~-1~N~)" nome = "NEE" end if print("Variavel --> " + nome) x = ctrl(84:,0) yctrl = ctrl(84:,coluna) yvar1 = var1(84:,coluna) yvar2 = var2(84:,coluna) data1 = new((/3,dimsizes(x)/),float ) data1(0,:) = yctrl data1(1,:) = yvar1 data1(2,:) = yvar2 wks = gsn_open_wks("ps","FIG."+nome) res = True res@gsnFrame = False ; avança (True) ou nao (False) as figuras res@tiMainString = titulo res@gsnLeftString = "" res@gsnCenterString = "" res@gsnRightString = "" res@tiXAxisString = "Month" res@tiYAxisString = eixoy res@tmYLMinorOn = True ; desabilita (False) o minortick do eixo y res@gsnYRefLine = 0.0 ; linha de referência no valor zero res@trYMinF = 0.0 ; valor mínimo do eixo y res@trYMaxF = 0.06 ; valor máximo do eixo y res@pmLegendDisplayMode = "Always" ; liga a legenda res@xyExplicitLegendLabels = (/"CTRL","CO2_370ppm","CO2_700ppm"/) res@xyLineThicknesses = (/4.0,2.0,2.0/) ; espessura das linhas res@xyLineColors = (/"black","red","green"/) res@xyDashPattern = 0 ; força todas as linhas para estilo sólido res@xyMarkLineMode = "MarkLines" ; res@xyMarkers = (/12,11,16/) res@xyMarkers = (/1,1,1/) res@xyMarkerColors = (/"black","red","green"/) ; 3 different colors ; res@lgJustification = "TopRight" res@pmLegendParallelPosF = 0.8 ; desloca legenda em x res@pmLegendOrthogonalPosF = -1.19 ; desloca legenda em y res@pmLegendWidthF = 0.3 ; largura da linha da legenda res@pmLegendHeightF = 0.15 ; altura entre as palavras da legenda res@lgBoxMinorExtentF = 0.15 ; Shorten the legend lines res@lgLabelFontHeightF = 0.02 ; altera o tamanho da fonte da legenda res@lgPerimOn = False ; True = liga caixa da legenda res@lgItemOrder = (/2,1,0/) ; Reorder the legends res@tmXBLabelAngleF = 0.0 ; rotaciona os valores do eixo x res@tmXBLabelConstantSpacingF = 0.90 ; espaçamento horizontal das palavras do eixo x res@tmXBFormat = "f" ; remove os pontos decimais do eixo x res@tmXBLabelStride = 1 res@txFontHeightF = 0.01 ; modifica texto esquerdo, central e direito res@tmYROn = True ; retira o tickmark da direita da figura res@tmXTOn = True ; retira o tickmark da esquerda da figura res@tmXBLabelFontHeightF = 0.025 ; tamanho da fonte do eixo y res@trXMaxF = 2013 res@tmXBMode = "Explicit" res@tmXBValues = yyyyfrac(84:) res@tmXBLabels = (/" Jan ~C~2008" ," "," "," "," "," "," "," "," "," "," "," ", \ " Jan ~C~2009" ," "," "," "," "," "," "," "," "," "," "," ", \ " Jan ~C~2010" ," "," "," "," "," "," "," "," "," "," "," ", \ " Jan ~C~2011" ," "," "," "," "," "," "," "," "," "," "," ", \ " Jan ~C~2012" ," "," "," "," "," "," "," "," "," "," "," "," "/) plot = gsn_csm_xy(wks,yyyyfrac(84:),data1,res) system("convert -trim FIG."+nome+".ps FIG."+nome+".png ; rm -f FIG."+nome+".ps *~ ") end do end