Re: check_for_y_lat_coord

From: 朱学明 <557xiaozhu_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 05 2013 - 13:21:00 MDT

Adam,
   Thanks for your responding. I have added what you mentioned, but the error is still there.
(0) 19930101

Variable: u
Type: float
Total Size: 664692 bytes
            166173 values
Number of Dimensions: 2
Dimensions and sizes: [NbLongitudes | 579] x [NbLatitudes | 287]
Coordinates:
            NbLongitudes: [98.33333333332349..290.9999999999709]
            NbLatitudes: [-17.79766126545592..60.88112837177402]
Number Of Attributes: 5
  date : 1993-01-01 00:00:00.000000 UTC
  Date_CNES_JD : 15706
  units : cm/s
  long_name : U
  _FillValue : 1.844674e+19

Variable: v
Type: float
Total Size: 664692 bytes
            166173 values
Number of Dimensions: 2
Dimensions and sizes: [NbLongitudes | 579] x [NbLatitudes | 287]
Coordinates:
            NbLongitudes: [98.33333333332349..290.9999999999709]
            NbLatitudes: [-17.79766126545592..60.88112837177402]
Number Of Attributes: 5
  _FillValue : 1.844674e+19
  long_name : V
  units : cm/s
  Date_CNES_JD : 15706
  date : 1993-01-01 00:00:00.000000 UTC

Variable: speed
Type: float
Total Size: 664692 bytes
            166173 values
Number of Dimensions: 2
Dimensions and sizes: [579] x [287]
Coordinates:
Number Of Attributes: 1
  _FillValue : 1.844674e+19
(0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:
(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0) check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
(0) gsn_csm_map_ce: Warning: you set mpMaxLonF to a value > 180, but
(0) didn't set mpCenterLonF. Setting mpCenterLonF to 194.5

The newer code is

do nt=nb,ne
     time=in[:] ->time(nt-1)
     utc_date = cd_calendar(time, -3)
     print(""+utc_date)
     
;************************************************
; read in zonal [u] and meridional [v] winds
;************************************************
     tmp = in[:]->UGRD_10maboveground(nt-1,:,:)
     u = tmp({lat_min:lat_max},{lon_min:lon_max})/100.0
     tmp = in[:]->VGRD_10maboveground(nt-1,:,:)
     v = tmp({lat_min:lat_max},{lon_min:lon_max})/100.0
     speed = sqrt(u^2 + v^2)
     copy_VarCoords(u,speed)
     
     vcres@tiMainString = "Wind 10m above ground"
     vcres@gsnLeftString = utc_date
     vcres@gsnRightString = "m/s"

     wks = gsn_open_wks(wks_type ,"wind_"+utc_date) ; open a ps file
     gsn_define_colormap(wks,"rainbow") ;"BlAqGrYeOrRe") ; choose colormap
printVarSummary(u)
     printVarSummary(v)
     printVarSummary(speed)
     plot=gsn_csm_vector_scalar_map_ce(wks,u(NbLatitudes|:,NbLongitudes|:),v(NbLatitudes|:,NbLongitudes|:),speed(NbLatitudes|:,NbLongitudes|:),vcres) ; create plot
  end do

2013-09-06



朱学明



发件人:Adam Phillips <asphilli@ucar.edu>
发送时间:2013-09-06 02:56
主题:Re: [ncl-talk] check_for_y_lat_coord
收件人:"朱学明"<557xiaozhu@163.com>
抄送:"ncl-talk@ucar.edu USERS"<ncl-talk@ucar.edu>

Thanks for sending printVarSummary's of your three arrays, as that likely identifies the issue. Unlike your u and v arrays, your speed array does not have any metadata/coordinate variables associated with it.

Try adding this after you create your speed array:
copy_VarCoords(u,speed)

Alternatively, you can do this:
speed = u
speed = (/ sqrt(u^2 + v^2) /) ; overwrite speed values, but leave the metadata

This is all assuming that your NbLongitudes / NbLatitudes have units attributes set. See this FAQ here:
http://www.ncl.ucar.edu/FAQ/#err_msgs_027

Finally, note that your u/v/speed arrays are dimensioned longitude by latitude. The gsn_csm_vector_scalar_map_ce plotting function expects the order to be latitude by longitude. Thus, you will have to reorder your dimensions like this:
plot=gsn_csm_vector_scalar_map_ce(wks,u(NbLatitudes|:,NbLongitudes|:),v(NbLatitudes|:,NbLongitudes|:),speed(NbLatitudes|:,NbLongitudes|:),vcres)

Hope that helps. If you have any further questions please respond only to the ncl-talk email list.
Adam


On 09/05/2013 12:39 PM, 朱学明 wrote:

Hi All,
   I am trying to plot the geostrophic current fields from aviso. And get some screen output and error messages as follow,

(0) 19930101

Variable: u
Type: float
Total Size: 664692 bytes
            166173 values
Number of Dimensions: 2
Dimensions and sizes: [NbLongitudes | 579] x [NbLatitudes | 287]
Coordinates:
            NbLongitudes: [98.33333333332349..290.9999999999709]
            NbLatitudes: [-17.79766126545592..60.88112837177402]
Number Of Attributes: 5
  date : 1993-01-01 00:00:00.000000 UTC
  Date_CNES_JD : 15706
  units : cm/s
  long_name : U
  _FillValue : 1.844674e+19

Variable: v
Type: float
Total Size: 664692 bytes
            166173 values
Number of Dimensions: 2
Dimensions and sizes: [NbLongitudes | 579] x [NbLatitudes | 287]
Coordinates:
            NbLongitudes: [98.33333333332349..290.9999999999709]
            NbLatitudes: [-17.79766126545592..60.88112837177402]
Number Of Attributes: 5
  _FillValue : 1.844674e+19
  long_name : V
  units : cm/s
  Date_CNES_JD : 15706
  date : 1993-01-01 00:00:00.000000 UTC

Variable: speed
Type: float
Total Size: 664692 bytes
            166173 values
Number of Dimensions: 2
Dimensions and sizes: [579] x [287]
Coordinates:
Number Of Attributes: 1
  _FillValue : 1.844674e+19
(0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:
(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0) check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
(0) gsn_csm_map_ce: Warning: you set mpMaxLonF to a value > 180, but
(0) didn't set mpCenterLonF. Setting mpCenterLonF to 194.5

My code is as follow,

  do nt=nb,ne
     in = addfile(infile(nt-1),"r")
     utc_date = str_get_cols(infile(nt-1),44,51)
     print(""+utc_date)
     
;************************************************
; read in zonal [u] and meridional [v] winds
;************************************************
     tmp = in->Grid_0001
     u = tmp({lon_min:lon_max},{lat_min:lat_max}) ;/100.0
     tmp = in->Grid_0002
     v = tmp({lon_min:lon_max},{lat_min:lat_max}) ;/100.0
     speed = sqrt(u^2 + v^2)
     
     vcres@tiMainString = "Geostrophic Current Field"
     vcres@gsnLeftString = utc_date
     vcres@gsnRightString = "m/s"

     wks = gsn_open_wks(wks_type ,"uv_"+utc_date) ; open a ps file
     gsn_define_colormap(wks,"rainbow") ;"BlAqGrYeOrRe") ; choose colormap
     printVarSummary(u)
     printVarSummary(v)
     printVarSummary(speed)
     plot=gsn_csm_vector_scalar_map_ce(wks,u,v,speed,vcres) ; create plot
  end do

Anyone can help me for figuring out the error? Thanks.

2013-09-06



朱学明

 

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



--
______________________________________________________________
Adam Phillips asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division (303) 497-1726
P.O. Box 3000
Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 5 13:21:25 2013

This archive was generated by hypermail 2.1.8 : Mon Sep 16 2013 - 13:43:52 MDT