[ncl-talk] How to correct the co ordinates?

Ipshita Majhi ipmajhi at alaska.edu
Tue Mar 1 11:39:26 MST 2016


HI Mary,

Thank you for the input. Here are the printVarSummary of the two variables.
When I multiply the two variables I get this

*************************************************************************************
fatal:Mat: One of the operands exceeds the rank of 2, can't continue
*************************************************************************************
Variable: sce
Type: byte
Total Size: 19259328 bytes
            19259328 values
Number of Dimensions: 3
Dimensions and sizes: [time | 2487] x [lat | 88] x [lon | 88]
Coordinates:
            time: [7..17409]
Number Of Attributes: 10
  lon2d : <ARRAY of 7744 elements>
  lat2d : <ARRAY of 7744 elements>
  long_name : NOAA/NCDC Climate Data Record of snow cover extent
  standard_name : surface_snow_binary_mask
  grid_mapping : coord_system
  coordinates : longitude latitude time snow_cover_threshold
  valid_range : ( 0, 1 )
  flag_values : ( 0, 1 )
  flag_meanings : no_snow snow_covered
  _FillValue : -9
(0) 2487
(1) 6

***********************************************************************************
Variable: sce_area
Type: float
Total Size: 30976 bytes
            7744 values
Number of Dimensions: 2
Dimensions and sizes: [rows | 88] x [cols | 88]
Coordinates:
Number Of Attributes: 7
  long_name : cell area in km^2
  standard_name : cell_area
  grid_mapping : coord_system
  coordinates : longitude latitude
  units : km^2
  valid_range : ( 10676.8, 41804.6 )
  _FillValue : -999.9

*********************************************************************************



On Tue, Mar 1, 2016 at 7:39 AM, Mary Haley <haley at ucar.edu> wrote:

> You didn't actually state what the problem was, so I guess you meant to
> say that the plot is incorrect?
>
> You didn't provide any information about your data.  As we tell users
> frequently, use "printVarSummary" to help us see what what your variables
> look like:
>
> printVarSummary(B)
>
> You shouldn't need to allocate space for B and then fill it. Try replacing
> this code:
>
>    B = new((/2487,88,88/),float)
>    do i = 0,2486
>       B(i,:,:)=sce(i,:,:)#sce_area(:,:)
>    end do
>
> with:
>
> sce_area_3d = conform_dims(dimsizes(sce),sce_area,(/1,2/))
> B           = sce # sce_area_3d
>
> One idea for the plot: maybe you need to turn off the addition of a cyclic
> point:
>
> res at gsnAddCyclic = False
>
> If none of this helps, then please include output from "printVarSummary"
> of all your variables.
>
> Thanks,
>
> --Mary
>
>
> On Mon, Feb 29, 2016 at 12:12 PM, Ipshita Majhi <ipmajhi at alaska.edu>
> wrote:
>
>> Dear NCL,
>>
>> I want to plot snow cover extent after multiplying it with snow cover
>> area. Here is the code for it. I am also attaching the figure with this
>> email.
>>
>> ;*******************************************
>> ;Reading in the weekly snow cover extent
>> ;*******************************************
>>
>> a=addfile("~/Documents/NCL_files/Sea_ice/
>> nhsce_v01r01_19661004_20140602.nc","r")
>> sce=a->snow_cover_extent ; The values are either 0 or 1
>>
>> lat=a->latitude
>> lon=a->longitude
>>
>> sce!1="lat"
>> sce!2="lon"
>>
>> sce at lat2d=lat
>> sce at lon2d=lon
>>
>> ;********************************************
>> :Reading in the snow cover are
>> ;********************************************
>>
>> sce_area=a->area
>>
>> sce_area!0="lat"
>> sce_area!1="lon"
>>
>> copy_VarAtts(sce,sce_area)
>> copy_VarCoords_1(sce,sce_area)
>>
>> ;*******************************************
>> ;Muliplying Snow cover extent and Area
>> ;*******************************************
>>
>> B = new((/2487,88,88/),float)
>>
>>      do i = 0,2486
>>       B(i,:,:)=sce(i,:,:)#sce_area(:,:)
>>       end do
>>
>> B!0="time"
>> B!1="lat"
>> B!2="lon"
>>
>> B at lat2d=lat
>> B at lon2d=lon
>>
>> copy_VarAtts(sce,B)
>> copy_VarCoords_1(sce,B)
>>
>> printVarSummary(B)
>>
>> B at _FillValue = -9
>>
>>
>> ;************************************************
>> ; create plot
>> ;************************************************
>>   wks = gsn_open_wks("pdf" ,"Snow_cover_area")
>>   res            = True                          ; plot mods desired
>>   res at gsnPolar   = "NH"                          ; specify the hemisphere
>>   plot = gsn_csm_contour_map_polar(wks,B(0,:,:),res)    ; create the plot
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>


-- 
Ipshita Majhi
PhD Candidate
University of Alaska , Fairbanks
Atmospheric Science Department
(907)978-4220 ipmajhi at alaska.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160301/98f57a90/attachment.html 


More information about the ncl-talk mailing list