[ncl-talk] Coordinate syronising error

Rashed Mahmood rashidcomsis at gmail.com
Fri Jun 4 07:29:44 MDT 2021


I work at BSC in Barcelona, so no I do not have access to NCAR machines.

I think the problem is that the longitudes of the MOPIT data and model data
are not exactly the same. From your print summaries:

MOPIT: XDim_MOP03:
*[ 0.5..359.5] *

Model: lon:

*[   0..358.75] *

You are using longitudes of MOPIT to subset model values.
So when your loop reaches: *lon=359.5*, this value is beyond the
maximum value of model longitude (which is *358.75*),and hence the
error message.
It's up to you to decide what you want to do about this, e.g. regrid
option etc. You can easily test this by adding print(""+n) statement
inside the loop that is being used to subscript model values.










On Fri, Jun 4, 2021 at 12:17 PM Najib Yusuf <najibgal at yahoo.com> wrote:

> Dear Rasheed,
>
> Thank you for this explanation. I have effected the lonFlip and it works
> giving similar longitude with model output. However, am still missing
> something as similar error comes again. As you have suggested I attached
> the VarSummary file and the script Najib_script for your further assistance
> please. I really appreciate you and Dennis for your help. I dont know if
> you are working at NCAR and you have access to cheyenne so you can access
> the files in my directory (VarSummary file) for the files are large to
> attached. I know Dennis can access them.
>
> Thank you
>
> Najib
> On Thursday, June 3, 2021, 10:11:08 PM GMT+1, Rashed Mahmood <
> rashidcomsis at gmail.com> wrote:
>
>
>
> As the documentation for lonFlip says "The rightmost dimension must be the
> longitude dimension...". So now you can use lonFlip for the reordered
> variable "cocol_retr_reorder":
> lonFlip(cocol_retr_reorder)
>
> Since your original variable "cocol_retr" and the reordered variable
> "cocol_retr_reorder" have latitudes that are already south to north *(note:
> - to +) *according to the variable summary, so you do not need south to
> north conversion. If this does not work then please share the latest
> (minimum script) and if possible a data file that you are reading.
>
>
>
> On Thu, Jun 3, 2021 at 10:27 PM Najib Yusuf <najibgal at yahoo.com> wrote:
>
> Hello Dennis,
>
> Thank you. I have effected the corrections, I think the interchanged was
> as a result of "lonFlip" when I undo the "lonFlip" function and use the
> "reorder" and reorder S to N" functions/command you have suggested, the Lat
> and Lon became okay like this;
>
> Variable: cocol_retr
> Type: float
> Total Size: 3110400 bytes
>             777600 values
> Number of Dimensions: 3
> Dimensions and sizes:   [ncl_join | 12] x [XDim_MOP03 | 360] x [YDim_MOP03
> | 180]
> Coordinates:
>             XDim_MOP03: [-179.5..179.5]
>             YDim_MOP03: [-89.5..89.5]
> Number Of Attributes: 4
>   long_name :   Retrieved CO Total Column Day
>   units :       mol/cm^2
>   _FillValue :  -9999
>   projection :  Geographic
>
> Variable: cocol_retr_reorder
> Type: float
> Total Size: 3110400 bytes
>             777600 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 12] x [YDim_MOP03 | 180] x [XDim_MOP03 |
> 360]
> Coordinates:
>             YDim_MOP03: [-89.5..89.5]
>             XDim_MOP03: [-179.5..179.5]
> Number Of Attributes: 4
>   projection :  Geographic
>   _FillValue :  -9999
>   units :       mol/cm^2
>   long_name :   Retrieved CO Total Column Day
>
> Variable: cocol_retr_SN
> Type: float
> Total Size: 3110400 bytes
>             777600 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 12] x [YDim_MOP03 | 180] x [XDim_MOP03 |
> 360]
> Coordinates:
>             YDim_MOP03: [89.5..-89.5]
>             XDim_MOP03: [-179.5..179.5]
> Number Of Attributes: 4
>   long_name :   Retrieved CO Total Column Day
>   units :       mol/cm^2
>   _FillValue :  -9999
>   projection :  Geographic
>
> but running gave similar error:
>
> fatal:NclOneDValGetClosestIndex: finish coordinate index out of range,
> can't continue
> fatal:Could not obtain coordinate indexes, unable to perform subscript
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 191 in
> file Annualaverage_MOPITTCO_nyg_modified.ncl
>
> Thank you
>
> Najib
>
> On Thursday, June 3, 2021, 04:31:56 AM GMT+1, Dennis Shea <shea at ucar.edu>
> wrote:
>
>
> Rashad is correct.
>
> Variable: cocol_retr_flip
> Dimensions and sizes:   [ncl_join | 12] x [XDim_MOP03 | 360] x [YDim_MOP03
> | 180]
> Coordinates:
>             XDim_MOP03: [-179.5..179.5]    <=== these are longitudes
>             YDim_MOP03: [ 0.5..359.5]        <=== these are longitudes
> also
>
> Both coordinate variables have ranges for longitudes. These values are not
> suitable for latitudes.
>
> Further, you have:
>
> Variable: cocol_retr_flip
> Dimensions and sizes:   [ncl_join | 12] x [XDim_MOP03 | 360] x [YDim_MOP03
> | 180]
>
> For comparison the model output, it should be  [lat,lon]
>     [ncl_join | 12] x [YDim_MOP03 | 180] x [XDim_MOP03 | 360]
>
> -----
>
>
> I have one [old] MOP03 file the latitudes range from:
>
> YDim_MOP03:: 89.5 ..-89.5  [North to south ordering]
>
> The variables do have ( XDim_MOP03, YDim_MOP03 ) ordering.
>
> This can be rectified by using NCL's named dimension reordering.
>
> After *addfiles*:
>     cocol_retr_flip :=  cocol_retr_flip(:,YDim_MOP03|:,XDim_MOP03|:)   ;
> reorder to (12,lat,lon)
>     printVarSummary( cocol_retr_flip )    ; ***LOOK at this*** especially
> the ordering
> Now reorder from N->S  to  S->N
>     cocol_retr_flip := cocol_retr_flip(:,::-1,:)
>     printVarSummary( cocol_retr_flip )    ; ***LOOK at this*** especially
> the latitude coordinates
> =========
>
> I suggest that you  only work on the one MOP03 variable to workk out the
> ordering.
>
>
>
>
>
>
> On Wed, Jun 2, 2021 at 10:03 AM Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
> But even if it is the case, then still the range in your: XDim_MOP03:
> [-179.5..179.5], does not make sense for a latitude range. latitude range
> should be within -90 to 90. You need to look into your data to make sure it
> is read correctly. Also a suggestion, please reduce your script for
> debugging and test it with one input file.
>
> On Wed, Jun 2, 2021 at 5:52 PM Najib Yusuf <najibgal at yahoo.com> wrote:
>
> No Rashed, could it be interchanged with longitude?
>
> Sent from Yahoo Mail on Android
> <https://go.onelink.me/107872968?pid=InProduct&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers&af_wl=ym&af_sub1=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature>
>
> On Wed, 2 Jun 2021 at 16:32, Rashed Mahmood
> <rashidcomsis at gmail.com> wrote:
> The latitude range from the variable summary looks strange:
> Coordinates:
>             XDim_MOP03: [-179.5..179.5]
>             *YDim_MOP03: [ 0.5..359.5]*
> Do you know why latitudes are expanding from 0.5 to 359.5?
>
> On Wed, Jun 2, 2021 at 4:39 PM Najib Yusuf via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> Dear Dennis,
>
> Thank you for this quick response. I have effected the suggestion, the
> printVarSummary is:
>
> Variable: co_model
> Type: float
> Total Size: 148635648 bytes
>             37158912 values
> Number of Dimensions: 4
> Dimensions and sizes:   [time | 12] x [lev | 56] x [lat | 192] x [lon |
> 288]
> Coordinates:
>             time: [  31.. 365]
>             lev: [1.867879997007549..992.5000106104562]
>             lat: [ -90..  90]
>             lon: [   0..358.75]
> Number Of Attributes: 4
>   mdims :       1
>   units :       mol/mol
>   long_name :   CO concentration
>   cell_methods :        time: mean
>
> Variable: cocol_retr_flip
> Type: float
> Total Size: 3110400 bytes
>             777600 values
> Number of Dimensions: 3
> Dimensions and sizes:   [ncl_join | 12] x [XDim_MOP03 | 360] x [YDim_MOP03
> | 180]
> Coordinates:
>             XDim_MOP03: [-179.5..179.5]
>             YDim_MOP03: [ 0.5..359.5]
> Number Of Attributes: 5
>   long_name :   Retrieved CO Total Column Day
>   units :       mol/cm^2
>   _FillValue :  -9999
>   projection :  Geographic
>   lonFlip :     longitude coordinate variable has been reordered via
> lonFlip
>
> However, when I run I get similar error:
> fatal:NclOneDValGetClosestIndex: finish coordinate index out of range,
> can't continue
> fatal:Could not obtain coordinate indexes, unable to perform subscript
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 172 in
> file Annualaverage_MOPITTCO_nyg_modified.ncl
>
> I know you are busy, kindly spare some time to assist me look at the
> script as you use to.
>
> Thank you sir.
>
> Najib
>
>
>
> On Tuesday, June 1, 2021, 09:29:32 PM GMT+1, Dennis Shea <shea at ucar.edu>
> wrote:
>
>
> I don't have the time to look at your script right now.
>
> However, The lat/lon ranges are different.
>
> In particular the longitudes. Likely, you will have to make the longitudes
> both be (nominally) 0-to-360 or -180-to180
> You can use *lonFlip*
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/lonFlip.shtml>
> to accomplish this.
>
> Variable: co_model
> Dimensions and sizes:   [time | 12] x [lev | 56] x [lat | 192] x [lon |
> 288]
> Coordinates:
>             time: [  31.. 365]
>             lev: [1.867879997007549..992.5000106104562]
>
> *            lat: [ -90..  90]            lon: [   0..358.75*]
>
> Variable: cocol_retr
> Dimensions and sizes:   [ncl_join | 12] x [XDim_MOP03 | 360] x [YDim_MOP03
> | 180]
> Coordinates:
>
> *          XDim_MOP03: [-179.5..179.5]            YDim_MOP03:
> [-89.5..89.5]*
> ~
>
> On Tue, Jun 1, 2021 at 5:17 AM Najib Yusuf via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> Dear NCL users,
>
> I am comparing CO from MOPITT satellite retrieval and model CAM output
> with averaging kernel been considered. I am having trouble synchronising
> the coordinates amd the error is:
> fatal:NclOneDValGetClosestIndex: finish coordinate index out of range,
> can't continue
> fatal:Could not obtain coordinate indexes, unable to perform subscript
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 165 in
> file Annualaverage_MOPITTCO_nyg_modified.ncl ( under:  Collect equivalent
> profile)
>
> I look around NCL examples but couldn't figure out how to resolve the
> issue and get the plot.
> Kindly assist to figure out the solution to this. The script Annualaverage_MOPITTCO_nyg_modified.ncl
> and the run CO_MOPITT_MODEL_Comparison_run are attached.
>
> Thank you for your support.
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210604/0f9c5650/attachment.html>


More information about the ncl-talk mailing list