Re: Do loops overwriting inner loops

From: Cannavina, Dominique <d.cannavina11_at_nyahnyahspammersnyahnyah>
Date: Sat Jun 30 2012 - 11:42:10 MDT

That is great thanks Dennis, I will have a go with that.

It is also much appreciated you answering at the weekend, so thank you also for that.

________________________________________
From: Dennis Shea [shea@ucar.edu]
Sent: 30 June 2012 18:27
To: Cannavina, Dominique
Cc: ncl-talk@ucar.edu
Subject: Re: Do loops overwriting inner loops

[1]
My initial advice is to run a small test script on one model and only
one file. Get a 'feel' for the dim_numrun_n function.

[2]
I looked at your loops

    do iensemble = 0,8,1 ; ENSEMBLE LOOP MODELS 0,1...7,8
      do itime = 24,4320,24 ; TIME LOOP DAYS 1,2....178,180 FOR EACH RUN

      end do ;end of time loop
    end do ;end of ensemble loop

I do not see any references to either 'iensemble' or 'itime'.
So why use any loops? In fact, you just keep overwriting the arrays
cold_uk, cold_uk0 and cold_uk1. This is part of the problem!

If for each file and each ensemble you want
ukmo(ncl_join,step,number,latitude,longitude) => ukmo(0,1,2,3,4)

   tStrt = 24
   tLast = 4320
   tSkip = 24
                                               ; temporary variable
   tc2 = tc2_uk(:,tStrt:tLast:tSkip,:,:,:) ; convenience/clarity
   printVarSummary(ic2) ; does this look right?

   uk_cold = where(tc2.le.tcrit, 1, 0) ; 0/1 array
   printVarSummary(uk_cold)

   cold_uk0 = dim_numrun_n(cold_uk, 0, 0) ; opt = 0 means total
   cold_uk1 = dim_numrun_n(cold_uk, 1, 0) ; opt = 1 means unique

   cold_uk0@long_name = "total cold runs"
   cold_uk0@cold_crit_value = tcrit
   copy_VarCoords(tc2, cold_uk0)

   cold_uk1@long_name = "unique cold runs"
   cold_uk1@cold_crit_value = tcrit
   copy_VarCoords(tc2, cold_uk1)

This is a start ...

Cheers
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Jun 30 11:42:57 2012

This archive was generated by hypermail 2.1.8 : Tue Jul 03 2012 - 15:40:39 MDT