Re: System performances of repetitive NCL processes.

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 12 2010 - 09:09:46 MST

Hi Caroline,

My apologies, I don't think anybody answered this one.

Are you firing off one NCL job at a time, or running several in
parallel? Do you get any kind of error message when NCL hangs?

Is it possible that one of your NCL scripts is failing on its own,
and has nothing to do with any of the other scripts? In othter words,
it's possible that you have one NCL script that might be requesting
more memory that what's available on the machine, or
trying to read in a single variable that is larger than 2Gb.

I'm curious about your script below, as I see that you are creating a
contour/map plot, and then retrieving some
information from it to draw it over a different map projection.

I don't know if this will help, but instead of first creating the
plot over a lambert conformal and then going to mercator, have you
tried going directly to mercator? It looks like you have the 2D lat/
lon coordinates for your data, so you should be able to do this.

For example, comment this code out:

; res@mpProjection = "LambertConformal"
; res@mpLimitMode = "Corners" ; choose range of map
; res@mpLeftCornerLatF = lat2d@corners(0)
; res@mpLeftCornerLonF = lon2d@corners(0)
; res@mpRightCornerLatF = lat2d@corners(2)
; res@mpRightCornerLonF = lon2d@corners(2)
; res@mpLambertParallel1F = lat2d@Latin1 ; ncl adds from grib file
; res@mpLambertParallel2F = lat2d@Latin2 ; ncl adds from grib file
; res@mpLambertMeridianF = lat2d@Lov ; ncl adds from grib file

; res@tfDoNDCOverlay = True
; res@gsnDraw = False
; res@gsnFrame = False

and replace it with this code:

   tt@lat2d = lat2d ; lat2d/lon2d are special attributes
recognized by gsn_csm_xxxx routines
   tt@lon2d = lon2d ; for passing through 2D coordinate arrays.

   res@mpProjection = "mercator"
   res@mpLimitMode = "Corners"
   res@mpLeftCornerLatF = i_lat_min
   res@mpLeftCornerLonF = i_lon_min
   res@mpRightCornerLatF = i_lat_max
   res@mpRightCornerLonF = i_lon_max

and then call your plotting function:

   plot=gsn_csm_contour_map(wks,tt,res)

--Mary

On Mar 5, 2010, at 3:02 AM, Caroline Serraud wrote:

> Hello everyone,
>
> I am facing some system problems while running ncl: I am running
> several shell scripts which loop on many netcdf files with native
> Lambert grid, then launch NCL and plot one parameter in a mercator
> projection.
> In a unpredictable way, NCL breaks sometimes when requiring too
> much system ressources or if other processes are running on my system.
> A ncl process is "blocked" in my system processlist, and my shell
> is then hanging for an unlimited period. Each time, ncl process is
> stuck at 100% cpu.
> Does anyone has already experienced this problem?
> Could I make some optimizations to make ncl processes less consuming?
>
> I enclose one of my ncl scripts if it helps..
> Kind regards,
> Caroline
>
> --
> Caroline Serraud - Ingénieur Etudes & Développements
> ------------------------------------------------------
> METEO CONSULT / La Chaine Météo - Groupe Figaro
> Département Informatique
> Domaine de Marsinval F-78540 Vernouillet, FRANCE
> Tél : 01 39 28 1990 - Fax : 01 39 71 85 31
> e-mail : cs@meteoconsult.fr
> ------------------------------------------------------
> Toute la météo sur le Web : http://www.meteoconsult.fr
> Toute la météo par téléphone : 3201
> ;*************************************************
> ; barb_3.ncl
> ;
> ; Concepts illustrated:
> ; - Drawing colored wind barbs vectors over a cylindrical
> equidistant map
> ; - Changing the length of the wind barbs
> ; - Changing the size of the wind barbs
> ; - Decreasing the number of vectors drawn
> ; - Adding a color to an existing color map
> ; - Using the full color map for colored wind barbs
> ; - Changing the length of a wind barb tick
> ; - Changing the distance between wind barb ticks
> ; - Turning off the vector reference annotation label
> ; - Drawing a map using the medium resolution map outlines
> ; - Thinning vectors using a minimum distance resource
> ;
> ;************************************************
> 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/csm/shea_util.ncl"
> ;************************************************
> begin
> if (.not.isvar("v_file")) then
> print("Le nom du fichier source n'est pas defini")
> exit()
> end if
> ;************************************************
> ; read in netCDF file
> ;************************************************
> a = addfile(v_file,"r")
> ;************************************************
> ; read in zonal [u] and meridional [v] winds
> ;************************************************
> t = a->TMP_GDS3_HTGL_10(:,:)
> tt = t/10.
>
> LAT2D= a->g3_lat_0
> LON2D= a->g3_lon_1
> lon2d=LON2D(g3_y_1|:,g3_x_0|:)
> lat2d=LAT2D(g3_y_1|:,g3_x_0|:)
>
> dimll = dimsizes(lat2d)
> nlon = dimll(0)
> nlat = dimll(1)
>
>
> i_lat_min = v_lat_min + 0
> i_lat_max = v_lat_max + 0
> i_lon_min = v_lon_min + 0
> i_lon_max = v_lon_max + 0
>
> ;************************************************
> ; create plot
> ;************************************************
> wks_type = "ps"
> wks =gsn_open_wks(wks_type,"tempe")
>
> gsn_define_colormap(wks,"BlWhRe") ; choose color map
>
> res = True ; plot
> mods desired
>
> res@gsnMaximize = True
> res@gsnPaperOrientation = "landscape"
> res@gsnBoxMargin = 0.0
>
> res@lbLabelBarOn = False
>
> res@tmXBOn = False ; don't draw axis nor axis labels
> res@tmXTOn = False
> res@tmYLOn = False
> res@tmYROn = False
>
> res@cnLevelSelectionMode = "ManualLevels"
> res@cnMinLevelValF = -15.
> res@cnMaxLevelValF = 35.
> res@cnLevelSpacingF = 1.
> res@cnFillOn = True ; turn on color for
> contours
> res@cnLinesOn = False ; turn off contour
> lines
> res@cnLineLabelsOn = False ; turn off contour
> line labels
> res@cnFillColors = (/
> 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50
> ,
> 52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,9
> 8,100,102/)
> res@cnInfoLabelOn = False
>
> res@gsnAddCyclic = False ; regional data
>
>
> ; zoom in on map
>
>
> res@mpDataBaseVersion = "RANGS_GSHHS" ; high
> resolution coastline
> res@mpDataResolution = "FinestResolution"
> res@mpFillOn = False
> res@mpOutlineOn = False
> res@mpPerimOn = False
> ; res@mpShapeMode = "FixedAspectNoFitBB"
>
> res@mpProjection = "LambertConformal"
> res@mpLimitMode = "Corners" ; choose range of map
> res@mpLeftCornerLatF = lat2d@corners(0)
> res@mpLeftCornerLonF = lon2d@corners(0)
> res@mpRightCornerLatF = lat2d@corners(2)
> res@mpRightCornerLonF = lon2d@corners(2)
> res@mpLambertParallel1F = lat2d@Latin1 ; ncl adds from grib file
> res@mpLambertParallel2F = lat2d@Latin2 ; ncl adds from grib file
> res@mpLambertMeridianF = lat2d@Lov ; ncl adds from grib file
>
> res@tfDoNDCOverlay = True
> res@gsnDraw = False
> res@gsnFrame = False
>
> plot=gsn_csm_contour_map(wks,tt,res)
>
> getvalues plot
> "vpXF" : x
> "vpYF" : y
> "vpWidthF" : w
> "vpHeightF" : h
> end getvalues
> print("x: " + x + " y: " + y + " w: " + w + " h: " + h)
>
> ndcx = fspan(x, x + w,nlon)
> ndcy = fspan(y-h,y,nlat)
>
> eps = 5e-7
> ndcx(0) = ndcx(0) + eps
> ndcx(nlon-1) = ndcx(nlon -1) - eps
> ndcy(0) = ndcy(0) + eps
> ndcy(nlat-1) = ndcy(nlat -1) - eps
>
> print( "calculating lat/lon fields")
> tndcy = new(nlon, float)
> outlat = new((/nlat,nlon/), float)
> outlon = new((/nlat,nlon/), float)
>
> do i = 0, nlat-1
> tndcy = ndcy(i)
> ndctodata(plot,ndcx,tndcy,outlon(i,:),outlat(i,:))
> end do
>
>
> res@gsnAddCyclic = False
> res@sfXArray = outlon
> res@sfYArray = outlat
> res@tfDoNDCOverlay = False
>
>
> res@mpProjection = "mercator"
> res@mpLimitMode = "Corners"
> res@mpLeftCornerLatF = i_lat_min
> res@mpLeftCornerLonF = i_lon_min
> res@mpRightCornerLatF = i_lat_max
> res@mpRightCornerLonF = i_lon_max
>
>
> plot=gsn_csm_contour_map(wks,tt,res)
> draw(plot)
> frame(wks)
>
>
> end
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 12 09:10:49 2010

This archive was generated by hypermail 2.1.8 : Fri Mar 12 2010 - 09:11:56 MST