[ncl-talk] problems with regriding

Vanúcia Schumacher vanucia-schumacher at hotmail.com
Mon Aug 25 13:07:06 MDT 2014


Hi Mary,

The script returns the following error:

Variable: sitType: floatTotal Size: 39266864 bytes            9816716 valuesNumber of Dimensions: 3Dimensions and sizes:	[time | 362] x [j | 149] x [i | 182]Coordinates:             time: [  15..3697.5]Number Of Attributes: 11  standard_name :	sea_ice_thickness  long_name :	Sea Ice Thickness  comment :	the mean thickness of sea ice in the ocean portion of the grid cell (averaging over the entire ocean portion, including the ice-free fraction).  Reported as 0.0 in regions free of sea ice.  units :	m  original_name :	iicethic  cell_methods :	time: mean (interval: 1 month) area: mean where sea  cell_measures :	area: areacello  missing_value :	1e+20  _FillValue :	1e+20  associated_files :	baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_seaIce_fx_CMCC-CM_decadal1980_r0i0p0.nc areacello: areacello_fx_CMCC-CM_decadal1980_r0i0p0.nc  coordinates :	lat lon(0)	write_grid_description: source lat dims = (447,182)(0)	write_grid_description: source lon dims = (447,182)(0)	write_grid_description: source grid type is 'curvilinear'(0)	curvilinear_to_SCRIP: Opt at Mask2D is not the correct dimensionality


---Vanúcia SchumacherMestranda em Meteorologia - UFVMeteorologista -UFPel
Departamento de Meteorologia Agrícola - DEACel: (31) 9978 2522 DEA: (31) 3899 1890

Date: Mon, 25 Aug 2014 10:49:16 -0600
Subject: Re: [ncl-talk] problems with regriding
From: haley at ucar.edu
To: vanucia-schumacher at hotmail.com

Please try the modified script.
The issue is that you have coordinate arrays I and J attached to your "sit" variable, but these are not lat/lon values, so you don't want to use them.

You do have "lat" and "lon" arrays on the file, and these are what you want to do.  So, I deleted your I/J coordinate arrays, and read in lat and lon for the regridding.

--Mary

On Sun, Aug 24, 2014 at 10:07 AM, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:




Hi Mary,
Follows the output:

Variable: unnamedType: filefilename:	sit_OImon_CMCC-CM_decadal1980_r1i1p1_198011-199012
path:	sit_OImon_CMCC-CM_decadal1980_r1i1p1_198011-199012.nc   file global attributes:
      institution : CMCC - Centro Euro-Mediterraneo per i Cambiamenti Climatici, Bologna, Italy      institute_id : CMCC
      experiment_id : decadal1980      source : CMCC-CM      model_id : CMCC-CM
      forcing : Nat,Ant,GHG,SA,TO,Sl      parent_experiment_id : N/A      parent_experiment_rip : N/A
      branch_time :    0      contact : Silvio Gualdi (gualdi at bo.ingv.it)
      history : Model output postprocessed with  CDO (https://code.zmaw.de/projects) 2012-07-24T13:45:46Z CMOR rewrote data to comply with CF standards and CMIP5 requirements.
      comment : Decadal hindcasts/predictions, some extended to 30 years      references : model described in the documentation at http://www.cmcc.it/data-models/models
      initialization_method : 1      physics_version : 1      tracking_id : a76e8d74-18ad-408f-ae28-d4a228f3eddc
      product : output      experiment : 10- or 30-year run initialized in year 1980      frequency : mon
      creation_date : 2012-07-24T13:45:46Z      Conventions : CF-1.4      project_id : CMIP5
      table_id : Table OImon (27 April 2011) f04ba250f3acd5b9e847c21d5752eb85      title : CMCC-CM model output prepared for CMIP5 10- or 30-year run initialized in year 1980
      parent_experiment : N/A      modeling_realm : seaIce ocean      realization : 1
      cmor_version : 2.7.1   dimensions:      time = 122  // unlimited
      j = 149      i = 182      bnds = 2      vertices = 4
   variables:      double time ( time )         bounds :	time_bnds
         units :	days since 1980-11-01         calendar :	standard
         axis :	T         long_name :	time
         standard_name :	time
      double time_bnds ( time, bnds )

      integer j ( j )         units :	1
         long_name :	cell index along second dimension
      integer i ( i )
         units :	1         long_name :	cell index along first dimension

      float lat ( j, i )         standard_name :	latitude
         long_name :	latitude coordinate         units :	degrees_north
         bounds :	lat_vertices
      float lon ( j, i )
         standard_name :	longitude         long_name :	longitude coordinate
         units :	degrees_east         bounds :	lon_vertices

      float lat_vertices ( j, i, vertices )         units :	degrees_north

      float lon_vertices ( j, i, vertices )         units :	degrees_east

      float sit ( time, j, i )         standard_name :	sea_ice_thickness
         long_name :	Sea Ice Thickness         comment :	the mean thickness of sea ice in the ocean portion of the grid cell (averaging over the entire ocean portion, including the ice-free fraction).  Reported as 0.0 in regions free of sea ice.
         units :	m         original_name :	iicethic
         cell_methods :	time: mean (interval: 1 month) area: mean where sea         cell_measures :	area: areacello
         missing_value :	1e+20         _FillValue :	1e+20
         associated_files :	baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_seaIce_fx_CMCC-CM_decadal1980_r0i0p0.nc areacello: areacello_fx_CMCC-CM_decadal1980_r0i0p0.nc
         coordinates :	lat lon


Variable: sitType: floatTotal Size: 39266864 bytes            9816716 values
Number of Dimensions: 3Dimensions and sizes:	[time | 362] x [j | 149] x [i | 182]
Coordinates:             time: [  15..11002.5]            j: [1..149]            i: [1..182]
Number Of Attributes: 11  standard_name :	sea_ice_thickness  long_name :	Sea Ice Thickness
  comment :	the mean thickness of sea ice in the ocean portion of the grid cell (averaging over the entire ocean portion, including the ice-free fraction).  Reported as 0.0 in regions free of sea ice.
  units :	m  original_name :	iicethic  cell_methods :	time: mean (interval: 1 month) area: mean where sea
  cell_measures :	area: areacello  missing_value :	1e+20
  _FillValue :	1e+20  associated_files :	baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_seaIce_fx_CMCC-CM_decadal1980_r0i0p0.nc areacello: areacello_fx_CMCC-CM_decadal1980_r0i0p0.nc
  coordinates :	lat lon

---
Vanúcia SchumacherMestranda em Meteorologia - UFV
Meteorologista -UFPel
Departamento de Meteorologia Agrícola - DEA
Cel: (31) 9978 2522 DEA: (31) 3899 1890


Date: Sun, 24 Aug 2014 09:53:12 -0600
Subject: Re: [ncl-talk] problems with regriding
From: haley at ucar.edu
To: vanucia-schumacher at hotmail.com


Sorry, I hit <send> before I was done editing the message.  Here's the short script I want you to run, and then send me *all* the output:










  fils = systemfunc("ls *.nc")
  f  = addfiles(fils, "r")


  print(f[0])
  sit = f[:]->SST


  printVarSummary(sit)
--Mary






On Sun, Aug 24, 2014 at 9:50 AM, Mary Haley <haley at ucar.edu> wrote:


I think we need to start at the beginning, because it's confusing about what your variable originally looked like.



Can you run just this short program, and let me know what the output is.  I need to know if you even have latitude or longitude values on your file:











fils = systemfunc("ls *.nc")
f  = addfiles(fils, "r")


printVarSummary(f)




;ListSetType(f,"join")                                                                                      




;---Read data                                                                                               

  sit      = f[:]->SST

printVarSummary(sit)




On Sat, Aug 23, 2014 at 6:02 PM, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:






fatal:No valid instance of variable lat found in file list





---


Vanúcia SchumacherMestranda em Meteorologia - UFV


Meteorologista -UFPel
Departamento de Meteorologia Agrícola - DEA


Cel: (31) 9978 2522 DEA: (31) 3899 1890




Date: Sat, 23 Aug 2014 18:00:03 -0600
Subject: Re: [ncl-talk] problems with regriding
From: haley at ucar.edu
To: vanucia-schumacher at hotmail.com




What is the exact error message?
--Mary



On Fri, Aug 22, 2014 at 5:13 PM, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:







I tried deleting the i and j coordinates, but returns the error that does not recognize lat and lon, already tried everything and nothing works!




Variable: sitType: doubleTotal Size: 78099840 bytes



            9762480 valuesNumber of Dimensions: 3Dimensions and sizes:	[TIME | 360] x [J | 149] x [I | 182]



Coordinates:             TIME: [76.5..11002.5]Number Of Attributes: 4



  missing_value :	-9.999999999999999e+33  _FillValue :	-9.999999999999999e+33



  long_name :	TOS[L=3:122]  history :	From tos_Omon_CMCC-CM_decadal1980_r1i1p1_198011-199012



fatal:No valid instance of variable lat found in file list




---



Vanúcia SchumacherMestranda em Meteorologia - UFV



Meteorologista -UFPel
Departamento de Meteorologia Agrícola - DEA



Cel: (31) 9978 2522 DEA: (31) 3899 1890





Date: Fri, 22 Aug 2014 16:07:04 -0600
Subject: Re: [ncl-talk] problems with regriding
From: haley at ucar.edu
To: vanucia-schumacher at hotmail.com




CC: ncl-talk at ucar.edu

​The problem is that you have those "I" and "J" coordinate arrays attached to your variable. By default, if ESMF_regrid sees coordinate arrays, it will try to use them in regridding.





Try deleting them before you do any regridding​:

delete(sit&I)delete(sit&J)

--Mary

On Fri, Aug 22, 2014 at 2:50 PM, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:








Hi Mary,
I tried with the ESM and the following error appears:






Variable: sit
Type: doubleTotal Size: 78099840 bytes            9762480 valuesNumber of Dimensions: 3




Dimensions and sizes:	[TIME | 360] x [J | 149] x [I | 182]Coordinates:             TIME: [76.5..11002.5]




            J: [1..149]            I: [1..182]Number Of Attributes: 4
  missing_value :	-9.999999999999999e+33  _FillValue :	-9.999999999999999e+33




  long_name :	TOS[L=3:122]  history :	From tos_Omon_CMCC-CM_decadal1980_r1i1p1_198011-199012




warning:Non-monotonic coordinate array generated -- check validity of the aggregated (leftmost) dimensionwarning:Non-monotonic coordinate array generated -- check validity of the aggregated (leftmost) dimension





Variable: sitType: doubleTotal Size: 78099840 bytes




            9762480 valuesNumber of Dimensions: 3Dimensions and sizes:	[time | 360] x [lat | 149] x [lon | 182]




Coordinates:             time: [76.5..11002.5]            lat: [1..149]            lon: [1..182]




Number Of Attributes: 6  lon2d :	<ARRAY of 546 elements>  lat2d :	<ARRAY of 447 elements>




  missing_value :	-9.999999999999999e+33  _FillValue :	-9.999999999999999e+33




  long_name :	TOS[L=3:122]  history :	From tos_Omon_CMCC-CM_decadal1980_r1i1p1_198011-199012





warning:Non-monotonic coordinate array generated -- check validity of the aggregated (leftmost) dimensionwarning:Non-monotonic coordinate array generated -- check validity of the aggregated (leftmost) dimension




(0)	get_src_grid_info: source lat dims = (447)(0)	get_src_grid_info: source lon dims = (546)




(0)	get_src_grid_info: SrcGridType and/or SrcGridLat/SrcGridLon were not set.(0)	          Cannot determine the source grid type.







---Vanúcia Schumacher




Mestranda em Meteorologia - UFVMeteorologista -UFPel

Departamento de Meteorologia Agrícola - DEA




Cel: (31) 9978 2522 DEA: (31) 3899 1890






Date: Fri, 22 Aug 2014 14:29:44 -0600
Subject: Re: [ncl-talk] problems with regriding
From: haley at ucar.edu
To: vanucia-schumacher at hotmail.com






D, 
My guess is she's missing:

tos at lat2d = f->lattos at lon2d = f->lon

See:
http://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_7.ncl







--M




On Fri, Aug 22, 2014 at 6:33 AM, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:




Hi Dennis,
I still do not understand what can I do to solve this problem, because when I change the resolution, I choose the option of lat and lon (0,358),(-87.86, 87.86), ncview and ferret programs  I can plot the data without problems (global), but when I try plot the data without changing the resolution they are confused on the map (attached).






print(var&lon)print(var&lat)






Variable: lat (coordinate)Type: integer





Total Size: 596 bytes            149 valuesNumber of Dimensions: 1Dimensions and sizes:	[lat | 149]





Coordinates: Number Of Attributes: 4  units :	1





  long_name :	cell index along second dimension  point_spacing :	even





  axis :	Y
ncdump -h 






	time = UNLIMITED ; // (122 currently)





	j = 149 ;	i = 182 ;	bnds = 2 ;





	vertices = 4 ;variables:	double time(time) ;





		time:bounds = "time_bnds" ;		time:units = "days since 1980-11-01" ;





		time:calendar = "standard" ;		time:axis = "T" ;





		time:long_name = "time" ;		time:standard_name = "time" ;





	double time_bnds(time, bnds) ;	int j(j) ;





		j:units = "1" ;		j:long_name = "cell index along second dimension" ;





	int i(i) ;		i:units = "1" ;





		i:long_name = "cell index along first dimension" ;	float lat(j, i) ;





		lat:standard_name = "latitude" ;		lat:long_name = "latitude coordinate" ;





		lat:units = "degrees_north" ;		lat:bounds = "lat_vertices" ;





	float lon(j, i) ;		lon:standard_name = "longitude" ;





		lon:long_name = "longitude coordinate" ;		lon:units = "degrees_east" ;





		lon:bounds = "lon_vertices" ;	float lat_vertices(j, i, vertices) ;





		lat_vertices:units = "degrees_north" ;	float lon_vertices(j, i, vertices) ;





		lon_vertices:units = "degrees_east" ;	float tos(time, j, i) ;





		tos:standard_name = "sea_surface_temperature" ;		tos:long_name = "Sea Surface Temperature" ;





		tos:comment = "\"this may differ from \"\"surface temperature\"\" in regions of sea ice.\"" ;





		tos:units = "K" ;		tos:original_name = "sosstsst" ;





		tos:original_units = "degC" ;		tos:history = "2012-07-24T13:46:07Z altered by CMOR: Converted units from \'degC\' to \'K\'." ;





		tos:cell_methods = "time: mean (interval: 1 month)" ;		tos:cell_measures = "area: areacello" ;





		tos:missing_value = 1.e+20f ;		tos:_FillValue = 1.e+20f ;





		tos:associated_files = "baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_ocean_fx_CMCC-CM_decadal1980_r0i0p0.nc areacello: areacello_fx_CMCC-CM_decadal1980_r0i0p0.nc" ;





		tos:coordinates = "lat lon" ;
// global attributes:





		:institution = "CMCC - Centro Euro-Mediterraneo per i Cambiamenti Climatici, Bologna, Italy" ;		:institute_id = "CMCC" ;





		:experiment_id = "decadal1980" ;		:source = "CMCC-CM" ;





		:model_id = "CMCC-CM" ;		:forcing = "Nat,Ant,GHG,SA,TO,Sl" ;





		:parent_experiment_id = "N/A" ;		:parent_experiment_rip = "N/A" ;





		:branch_time = 0. ;		:contact = "Silvio Gualdi (gualdi at bo.ingv.it)" ;





		:history = "Model output postprocessed with  CDO (https://code.zmaw.de/projects) 2012-07-24T13:46:07Z CMOR rewrote data to comply with CF standards and CMIP5 requirements." ;





		:comment = "Decadal hindcasts/predictions, some extended to 30 years" ;		:references = "model described in the documentation at http://www.cmcc.it/data-models/models" ;





		:initialization_method = 1 ;		:physics_version = 1 ;





		:tracking_id = "105250cc-615d-478c-b242-b72f4735fb74" ;		:product = "output" ;





		:experiment = "10- or 30-year run initialized in year 1980" ;		:frequency = "mon" ;





		:creation_date = "2012-07-24T13:46:07Z" ;		:Conventions = "CF-1.4" ;





		:project_id = "CMIP5" ;		:table_id = "Table Omon (27 April 2011) 340eddd4fd838d90fa9ffe1345ecbd73" ;





		:title = "CMCC-CM model output prepared for CMIP5 10- or 30-year run initialized in year 1980" ;		:parent_experiment = "N/A" ;





		:modeling_realm = "ocean" ;		:realization = 1 ;





		:cmor_version = "2.7.1" ;


---





Vanúcia SchumacherMestranda em Meteorologia - UFV





Meteorologista -UFPel
Departamento de Meteorologia Agrícola - DEA





Cel: (31) 9978 2522 DEA: (31) 3899 1890







Date: Thu, 21 Aug 2014 15:12:20 -0600
Subject: Re: [ncl-talk] problems with regriding
From: shea at ucar.edu
To: vanucia-schumacher at hotmail.com






CC: ncl-talk at ucar.edu

[1]
I would say it is highly unlikely that "NCL is not correctly plotting the data"!







NCL is plotting what you sent it. 

[2]
Did you examine the output from


printVarSummary(var)

[snip]








Dimensions and sizes:	[TIME | 360] x [lat | 149] x [lon | 182]Coordinates:             TIME: [76.5..3636.5]






            lat: [1..149]                  <================
            lon: [1..182]                <====================


The coordinates associated with 'var' are numbers spanning 1-149 and 1-182
These are *not* latitudes or longitudes. So, when you  use

new_var = linint2_Wrap(var&lon,var&lat,var,True,new_lon,new_lat,0)







You could do you own 'debugging by printing the input

print(var&lon)
print(var&lat)








Punch line ... you are inputting number 1 to 149 and 1 to 182
NCL is interpolating to those values.








Use 

ncl_filedump

or








ncdump  -h

on your source file. That should have some lat.lon info












On Thu, Aug 21, 2014 at 2:12 PM, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:










Hi users,
I do regridding data for resolution of 2 degrees and the NCL is not correctly plotting the data, it is cutting the data to the new resolution as opposed to a new lat and lon.







>begin     






>var = f[:]->SST
>var!1="lat">var!2="lon"






>j=var!1>i=var!2   
newfile = "tos_90x180.nc"







file_create = addfile(newfile, "c")    
new_lon = fspan(0,358, 180)     






new_lon at units = "degrees_east"new_lon!0 = "lon"  
new_lat = fspan(-87.86, 87.86, 90)






new_lat at units = "degrees_north"new_lat!0 = "lat"        







new_var = linint2_Wrap(var&lon,var&lat,var,True,new_lon,new_lat,0)
file_create->tos = new_var








Variable: var






Type: doubleTotal Size: 78099840 bytes            9762480 valuesNumber of Dimensions: 3






Dimensions and sizes:	[TIME | 360] x [lat | 149] x [lon | 182]Coordinates:             TIME: [76.5..3636.5]






            lat: [1..149]            lon: [1..182]Number Of Attributes: 4  missing_value :	-9.999999999999999e+33






  _FillValue :	-9.999999999999999e+33  long_name :	TOS[L=3:122]






  history :	From tos_Omon_CMCC-CM_decadal1980_r1i1p1_198011-199012
Variable: new_var






Type: doubleTotal Size: 46656000 bytes            5832000 valuesNumber of Dimensions: 3






Dimensions and sizes:	[TIME | 360] x [lat | 90] x [lon | 180]Coordinates:             TIME: [76.5..3636.5]






            lat: [-87.86..87.86]            lon: [ 0..358]Number Of Attributes: 4






  missing_value :	-9.999999999999999e+33  _FillValue :	-9.999999999999999e+33






  long_name :	TOS[L=3:122]  history :	From tos_Omon_CMCC-CM_decadal1980_r1i1p1_198011-199012









---Vanúcia Schumacher






Mestranda em Meteorologia - UFVMeteorologista -UFPel

Departamento de Meteorologia Agrícola - DEA






Cel: (31) 9978 2522 DEA: (31) 3899 1890






 		 	   		  

_______________________________________________

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



 		 	   		  

 		 	   		  

 		 	   		  



 		 	   		  

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140825/228bc879/attachment.html 


More information about the ncl-talk mailing list