(no subject)

From: Emiliano Gomez <egolol87_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 13 2012 - 08:34:17 MST

Hi, mi name is Emiliano and im learning the NCL language. Sorry for my bad
english its not my native language. Im trying to write a script that does
several things, the one im having trouble with is the one that calculates
the maxima and minima of RAINC & RAINNC every 24 hours out of a WRF file.
I have read some examples you have in the NCL-talk, but my scripts needs a
transformation of the 00z to local time, in my case its Mexico City local
time i think its -6 hr, the resolution we have is periods of 3 hours and
then for some reason change the starting hour to 8am. I mean, i have day
periods of 8am -7am. How can i solve this? This is the script im writing.

;script para graficar temperatura y precipitacion vs el tiempo
;En un punto especifico
;Use el ejemplo 4,7,9 de los ejemplos de la pagina de ncl
;Y ejemplos de la pagina del WRF

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/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
begin

;que cosas leera

londf = (/-98.768158/)
latdf = (/19.500596/)
f = addfile("/media/sims/SMN/simulaciones/wrfout_d01_2010-11-30_00:00:00.nc
","r")
lat2d = f->XLAT (0,:,:)
lon2d = f->XLONG (0,:,:)
t = f->T2 ; (:,londf,x) ; lee de f la variable T2
rnc = f->RAINNC ; (:,y,x) ;lee la variable RAINNC
rc = f->RAINC ;lee la variable RAINC
times=f->Times ; Lee la variable times, es un tipo caracter
time =WRF_Times2Udunits_c(times,0) ; convierte a "horas desde"
timeLST=time
ntimes=dimsizes(time)
do i=0,ntimes-1
    timeLST(i)=time(i)-6
    if(timeLST(i) .lt. 0) then
        timeLST(i)=24+timeLST(i)
    end if
end do
timeLST&Time=timeLST
print(time)
print(timeLST)

;la interpolacion bilineal de temperatura, rainnc, rainc
tdf = rcm2points (lat2d,lon2d,t,latdf,londf,2)
rncdf = rcm2points (lat2d,lon2d,rnc,latdf,londf,2)
rcdf = rcm2points (lat2d,lon2d,rc,latdf,londf,2)
;printVarSummary (tdf)
;printVarSummary (rdf)
;printVarSummary (time)
raT = rcdf + rncdf

nr=dimsizes(raT)
rT=new(nr(0),"float")
do i=1,nr(0)-1
    rT(i)=raT(i,0)-raT(i-1,0)
end do
rT(0)=0
printVarSummary(timeLST)
;separacion en dias falta quitar los dos puntos del dia previo.
;timeLST@_FillValue = 0
dia1=new(8,double)
do i=2,9
if (timeLST(i) .le. 21) then
    dia1(i-2)=timeLST(i)
end if
;timeLST(i) = where (timeLST(i) .le. 21, dia1(i), timeLST@_FillValue)
;timeLST(i)=i+1
end do
print(dia1)
;dia2=new(8,float)
;do i=0,7
;timeLST(i)= where (timeLST(i) .ge. 24 .le. 45, dia2(i), timeLST@_FillValue)
;timeLST(i)=i+1
;end do
;dia3=new(8,float)
;do i=0,7
;timeLST(i) = where (timeLST(i) .ge. 48 .le. 69, dia3(i), timeLST@_FillValue)

;timeLST(i)=i+1
;end do
;dia4=new(8,float)
;do i=0,7
;timeLST(i) = where (timeLST(i) .ge. 72 .le. 90, dia4(i), timeLST@_FillValue)

;timeLST(i)=i+1
;end do
;calculo de maximos y minimos por dia.
dia1max=dim_max_n(dia1,0)
dia1min=dim_min_n(dia1,0)
dia2max=dim_max_n(dia2,0)
dia2min=dim_min_n(dia2,0)
dia3max=dim_max_n(dia3,0)
dia3min=dim_min_n(dia3,0)
dia4max=dim_max_n(dia4,0)
dia4min=dim_min_n(dia4,0)

print (dia1max)
print (dia1min)
print (dia2max)
print (dia2min)
print (dia3max)
print (dia3min)
print (dia4max)
print (dia4min)

;calcula maximo cada 24 horas aqui hay un problema ya que es para todos
los puntos
; no se como pedirle que sea para los puntos pedidos
;dailymax = timeLST(2:9) ; copia la metadata, es del numero 14 al 38 que
serian desde las 8am del dia al 7 am del dia siguiente.
;dailymax = dailymax@_FillValue
;dailymin = dailymax ; no entiendo por que esta linea pero asi esta en el
ejemplo
;cntr = 0
;do gg = 0,dimsizes(time)-1
;dailymax(cntr,:,:) = dim_max_n(tdf(cntr:cntr+7,:,:),0) ;falta escoger el
punto de la malla donde se desea obtener
;dailymin(cntr,:,:) = dim_min_n(tdf(cntr:cntr+7,:,:),0)
;cntr = cntr+7
;end do
;print (dailymax)
;print (dailymin)

;crea el wks
wks= gsn_open_wks("ps","WRF_xy_maxmin")

;lado izquierdo que sera temperatura
resL = True
resL@tiMainString = "Temperatura y RAINNC vs Tiempo" ; titulo de la
grafica
;resL@xyLineThicknesses = 2 ;grueso de linea
resL@xyMarkLineModes = "Markers"
resL@xyMarkers = 16 ;tipo de marcador
resL@xyMarkerColor = "red" ; color del marcador
resL@xyMarkerSizeF= 0.01 ; tamaņo del marcador
resL@tmLabelAutoStride = True ; creo que hace grueso al marcador hehe
;resL@tiYAxisString = t@long_name + "temperatura "+"[solid]" ; nombre en y
izquierdo

;lado derecho que sera precipitacion
resR = True
;resR@xyDashPatterns = 1 ; hace la linea punteada
;resR@xyLineThicknesses =2 ;hace gruesa la linea
resR@xyMarkLineModes = "Markers"
resR@xyMarkers = 16 ;tipo de marcador
resR@xyMarkerColor = "blue" ; color del marcador
resR@xyMarkerSizeF= 0.01 ; tamaņo del marcador
resR@tmLabelAutoStride = True ; creo que hace grueso al marcador hehe
;resR@tiYAxisString = r@long_name +"rainnc"+"[dash]" ; nombre en y derecho

plot =gsn_csm_xy2(wks,timeLST,tdf(:,0),rT,resL,resR)

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 13 08:34:51 2012

This archive was generated by hypermail 2.1.8 : Tue Nov 13 2012 - 14:27:24 MST