Re: Non-monotonic coordinate value being used, can't compete coordinate subscript

From: Cannavina, Dominique <d.cannavina11_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 18 2012 - 00:03:50 MDT

Thanks Dave I was looking at completely the wrong thing. I had played about the a previous line relating to the variable run length (when I changed addfile from join to cat my number of variables reduced by one dimension) and this was causing the error.

Can I ask another NCL-Talk question which relates to this error?

fatal:Dimension sizes of left hand side and right hand side of assignment do not match
fatal:["Execute.c":7556]:Execute: Error occurred at or near line 96 in file ECMWF_DEMETER/demeter_v1_models_check_wrap.ncl

where line 96 is cold_uk0&run_length= ispan(1,ntimes,1) ; no longer 'step'

This is the part of the script it relates to and the complete script is attached

I tried changing the line to cold_uk0&run_length= ispan(24,ntimes,24) ; no longer 'step'
as I thought perhaps it was using the increment for the time/step rather then the ncl prefix if that makes sense

tcrit = 0 ; specify cut off temperature 'tcrit'
 
 cold_uk = where(t2_uk.le.tcrit, 1, 0) ;create 0/1 array
                                                               ; ( 0 , 1 , 2 , 3) so second 0 in each bracket below is for step
  cold_uk0 = dim_numrun_n(cold_uk, 0, 0) ; opt = 0 means total (step,ens,lat,lon)
  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(t2_uk, cold_uk0)
  cold_uk0!0 = "run_length" ; more appropriate for variable
  cold_uk0&run_length= ispan(1,ntimes,1) ; no longer 'step'

  cold_uk1@long_name ="unique cold runs"
  cold_uk1@cold_crit_values = tcrit
  copy_VarCoords(t2_uk, cold_uk1)
  cold_uk1!0 = "run_length"
  cold_uk1&run_length= ispan(1,ntimes,1)

Kind regards

Dominique
________________________________________
From: Dave Allured [dave.allured@noaa.gov]
Sent: 17 July 2012 21:41
To: Cannavina, Dominique
Cc: ncl-talk@ucar.edu
Subject: Re: Non-monotonic coordinate value being used, can't compete coordinate subscript

Dominique,

The only coordinate subscripting in line 213 is {spell(nr)}. The
leading error message suggests that there is something wrong with the
associated coordinate variable.

Try printing cold_uk1&run_length, and look for unexpected values. The
information that you aready printed suggests that cold_uk1&run_length
is supposed to be a smoothly ascending sequence of 360 values, from 24
to 4320, i.e., "monotonic".

--Dave

On Tue, Jul 17, 2012 at 1:29 PM, Cannavina, Dominique
<d.cannavina11@imperial.ac.uk> wrote:
> Hi NCL Talk,
>
>
>
> I get the following error when I run the attached script. Looking at some
> previous online posts I think it is something to do with how it is picking
> up my lat/lon range but I am not sure how to resolve it.
>
>
>
> fatal:NclOneDValGetClosestIndex: Non-monotonic coordinate value being used,
> can't complete coordinate subscript
>
> fatal:Could not obtain coordinate indexes, unable to perform subscript
>
> fatal:["Execute.c":7556]:Execute: Error occurred at or near line 213 in file
> ECMWF_DEMETER/demeter_v1_models_check_wrap.ncl
>
>
>
> The line is is referring to is
>
>
>
> spell_tot_uk(nr,:,:) = dim_sum_n(cold_uk1({spell(nr)},:,:,:),0)
>
>
>
> which is part of a do loop
>
> do nr=0,nspell-1
>
> spell_tot_uk(nr,:,:) = dim_sum_n(cold_uk1({spell(nr)},:,:,:),0)
>
> end do
>
>
>
> I replaced the line ukmo = short2flt(a[:]->ukmo)
>
>
>
> with the line below (just looking at some of the previous posts on similar
> error messages)
>
> ukmo= short2flt(a[:]->ukmo(:,:,{32.5:75},{-27.5:45})) but I get the same
> error
>
>
>
> The variables I extracted from the files (concat) were ukmo used to get tc2,
> the number of cold spells when tc2 falls below a critical value is extracted
> to using dim_numrum_n and then the number of each of the cold runs totalled
> up using the dim_sum_n loop above. The main variables are given below and a
> copy of the full script and all the variables attached. The length of the
> spell or run (1,2.....59,60) is manually entered in the script.
>
>
>
> Any help would be much appreciated.
>
>
>
> kind regards
>
>
>
> Dominique
>
>
>
> Variable: ukmo
>
> Type: float
>
> Total Size: 6998400 bytes
>
> 1749600 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes: [step | 360] x [number | 9] x [latitude | 18] x
> [longitude | 30]
>
> Coordinates:
>
> step: [24..4320]
>
> number: [0..8]
>
> latitude: [32.5..75]
>
> longitude: [-27.5..45]
>
> Number Of Attributes: 6
>
> _FillValue_original : -32767
>
> _FillValue : -32767
>
> missing_value_original : -32767
>
> units : K
>
> long_name : Minimum 2 metre temperature
>
> missing_value : -32767
>
>
>
> Variable: t2_uk
>
> Type: float
>
> Total Size: 6998400 bytes
>
> 1749600 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes: [step | 360] x [number | 9] x [latitude | 18] x
> [longitude | 30]
>
> Coordinates:
>
> step: [24..4320]
>
> number: [0..8]
>
> latitude: [32.5..75]
>
> longitude: [-27.5..45]
>
> Number Of Attributes: 6
>
> missing_value : -32767
>
> long_name : Minimum 2 metre temperature
>
> units : degC
>
> missing_value_original : -32767
>
> _FillValue : -32767
>
> _FillValue_original : -32767
>
>
>
> Variable: cold_uk1
>
> Type: integer
>
> Total Size: 6998400 bytes
>
> 1749600 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes: [run_length | 360] x [number | 9] x [latitude | 18] x
> [longitude | 30]
>
> Coordinates:
>
> run_length: [24..4320]
>
> number: [0..8]
>
> latitude: [32.5..75]
>
> longitude: [-27.5..45]
>
> Number Of Attributes: 2
>
> cold_crit_values : 0
>
> long_name : unique cold runs
>
>
>
> Variable: spell_tot_uk
>
> Type: float
>
> Total Size: 129600 bytes
>
> 32400 values
>
> Number of Dimensions: 3
>
> Dimensions and sizes: [60] x [latitude | 18] x [longitude | 30]
>
> Coordinates:
>
> latitude: [32.5..75]
>
> longitude: [-27.5..45]
>
> Number Of Attributes: 1
>
> _FillValue : 9.96921e+36
>
>
> _______________________________________________
> 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 Wed Jul 18 00:06:38 2012

This archive was generated by hypermail 2.1.8 : Wed Jul 18 2012 - 14:33:00 MDT