[ncl-talk] Coordinate syronising error

Najib Yusuf najibgal at yahoo.com
Fri Jun 18 05:34:07 MDT 2021


 Hello Dennis,
Sorry for my delay in adding the other variables.
Thank you for the added coordinate /glade/work/shea>ncl Najib_Script.ncl_v2.I have worked on Script.ncl_v2 by adding and converting the other variables from MOPITT files and it runs but the "cheyenne5-/glade/scratch/najiby>
Find attached the script and the varSummary. Thank you sir.
Najib


    On Monday, June 7, 2021, 04:31:44 PM GMT+1, Dennis Shea <shea at ucar.edu> wrote:  
 
 at 9:27am, I updates the simple test script to add another longitude value.

/glade/work/shea>ncl Najib_Script.ncl_v2
On Sun, Jun 6, 2021 at 10:00 PM Dennis Shea <shea at ucar.edu> wrote:

FYI: 
If the code is looking for a model value that was closest to 359.5, the script would return the following error.
Fatal:NclOneDValGetClosestIndex: finish coordinate index out of range, can't continuefatal:Could not obtain coordinate indexes, unable to perform subscriptfatal:["Execute.c":8637]:Execute: Error occurred at or near line 165 in file Annualaverage_MOPITTCO_nyg_modified.ncl ( under:  Collect equivalent profile)
This is because the MOPITT 359.5 exceeds MODEL 358.75
It may be that another function would have to be created that addes a bogus 360.5 coordinate variable.

On Sun, Jun 6, 2021 at 9:48 PM Dennis Shea <shea at ucar.edu> wrote:

I have not had much time to look.
%> cd to some directory of yours
%> cp /glade/work/shea/Najib_Script.ncl_v1 .
%> cp /glade/work/shea/Najib_Script.ncl_v2 .
These do not solve your pr. However, it shows you how I would handle data input.The _v2 uses a function to do multiple steps for code clarity and conciseness.
Please look at the printVarSummary(...)

These are included for you to see the data being manipulated.Look at dimension names, dimension ordering and coordinate values.
You can comment them out in your production code.
---
Take the _v2 script and add the code (appropriately changed) to work with *one* variable. No graphics. That can be added later.
I am not sure I follow you code [ 300+ line script is too much]
Keep your additional code minimal so we can focus on the error.
D





Use the 

On Sat, Jun 5, 2021 at 8:38 AM Najib Yusuf <najibgal at yahoo.com> wrote:

Dear Dennis, Thank you for this observation. I will appreciate you looking at it. Thank you for your support again. Waiting for your feedback. Thank you
Najib

Sent from Yahoo Mail on Android 
 
  On Sat, 5 Jun 2021 at 14:35, Dennis Shea<shea at ucar.edu> wrote:   Rashed. Thank you for your continued support.
---
Likely these are another source of error.

warning:Aggregated dimension coordinate values are non-monotonic; check aggregated file ordering
warning:Aggregated dimension coordinate values are non-monotonic; check aggregated file ordering
warning:Aggregated dimension coordinate values are non-monotonic; check aggregated file ordering

----
I did not realize this was on NCAR computers.
I still have some limited access to NCAR supers. I will try to look this weekend.

D

On Sat, Jun 5, 2021 at 4:08 AM Najib Yusuf <najibgal at yahoo.com> wrote:


OK. I will try it. Thank you all for your support.
Najib
Sent from Yahoo Mail on Android 
 
  On Fri, 4 Jun 2021 at 14:29, Rashed Mahmood<rashidcomsis at gmail.com> wrote:   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_retrType: floatTotal Size: 3110400 bytes            777600 valuesNumber of Dimensions: 3Dimensions 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_reorderType: floatTotal Size: 3110400 bytes            777600 valuesNumber of Dimensions: 3Dimensions 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_SNType: floatTotal Size: 3110400 bytes            777600 valuesNumber of Dimensions: 3Dimensions 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 continuefatal:Could not obtain coordinate indexes, unable to perform subscriptfatal:["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_flipDimensions 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_flipDimensions 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 
 
  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_modelType: floatTotal Size: 148635648 bytes            37158912 valuesNumber of Dimensions: 4Dimensions 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_flipType: floatTotal Size: 3110400 bytes            777600 valuesNumber of Dimensions: 3Dimensions 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 continuefatal:Could not obtain coordinate indexes, unable to perform subscriptfatal:["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-to180You can use lonFlip  to accomplish this.
Variable: co_modelDimensions 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 continuefatal:Could not obtain coordinate indexes, unable to perform subscriptfatal:["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/20210618/594297e7/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Den_Naj_varSum.txt
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210618/594297e7/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Den_Naj_script.txt
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210618/594297e7/attachment-0001.txt>


More information about the ncl-talk mailing list