[ncl-talk] Assign lat lon cordinates to polar stereographic coordinate
Dennis Shea
shea at ucar.edu
Thu Sep 15 15:59:24 MDT 2016
Sorry, To my knowledge, the short answer is "no". Sorry. D
On Thu, Sep 15, 2016 at 2:28 PM, Sourav Chatterjee <srvsxc at outlook.com>
wrote:
> Thanks alot Dennis
>
>
> Is there any way to average this variable only with latitude? I have done
> after regriding using ESMF_regrid function, but is it possible without
> regriding this temperature variable?
>
> I want to plot a depth vs longitude contour plot averaged over time and
> latitude.
>
> Regards
> Sourav
> ------------------------------
> From: Dennis Shea <shea at ucar.edu>
> Sent: 13-09-2016 17:11
> To: Sourav Chatterjee <srvsxc at outlook.com>
> Cc: ncl-talk at ucar.edu; Guido Cioni <guidocioni at gmail.com>
>
> Subject: Re: [ncl-talk] Assign lat lon cordinates to polar stereographic
> coordinate
>
> See:
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.
> shtml
> and/or
> http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml
>
> Then
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave2.shtml
>
> Ideally, the weights (areas represented by each grid point) would be
> available in 'some file.' Or, perhaps you could construct them
>
> or, perhaps, just use
>
> wgt2d = cos(rsd*lat2d) ; rad converts degrees to radians
>
> Good luck
>
>
>
>
>
> On Tue, Sep 13, 2016 at 2:19 AM, Guido Cioni <guidocioni at gmail.com> wrote:
>
>> Also make sure to perform the short to float conversion before working
>> with your data!!!
>>
>> http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
>>
>> Guido Cioni
>> http://guidocioni.altervista.org
>>
>> On 13 Sep 2016, at 10:15, Guido Cioni <guidocioni at gmail.com> wrote:
>>
>> Assuming from your filedump you do have coordinate variables associated,
>> so the following should easily work.
>>
>> temp_avg=dim_avg_n_Wrap(temp(:,:,{40:50},{-30:-10}),(/2,3/))
>>
>> Otherwise you would have to convert the latitude/longitude variables from
>> 2D to 1D, use the ind function to find all the indices that map into your
>> box, convert again into 2D indices with ind_resolve, subset temp with these
>> indices, do the average.
>>
>> Guido Cioni
>> http://guidocioni.altervista.org
>>
>> On 13 Sep 2016, at 09:10, Sourav Chatterjee <srvsxc at outlook.com> wrote:
>>
>> Thanks alot Mary for the explanation.
>>
>> Actually I need to do some area averaging for which I have the lat lon
>> information e.g say, surface temperature averaged over 40-50N and -30:-10E.
>> How to perform this spatial averaging with this temperature(time,depth,y,x)
>> variable?
>>
>> Thanks
>> Sourav
>> ------------------------------
>> From: Mary Haley <haley at ucar.edu>
>> Sent: 12-09-2016 23:38
>> To: Sourav Chatterjee <srvsxc at outlook.com>
>> Cc: ncl-talk at ucar.edu
>> Subject: Re: [ncl-talk] Assign lat lon cordinates to polar stereographic
>> coordinate
>>
>> Sourav,
>>
>> I'm not sure what you mean by "converting my variable".
>>
>> Since your latitude and longitude arrays are two-dimensional, you cannot
>> associate them with "temperature" in the same way that "y" and "x" are
>> currently associated with "temperature" as coordinate variables. This is a
>> NetCDF limitation that requires that coordinate variables be
>> one-dimensional and the same length as the dimension they represent.
>>
>> You already have a "coordinates" *attribute* associated with
>> "temperature", that indicates which variables represent the lat/lon arrays
>> for your data:
>>
>> temperature:coordinates = "longitude latitude" ;
>>
>> This is how we would normally suggest that you "associate" 2D lat/lon
>> arrays with a variable on a NetCDF file, so really, your "temperature"
>> variable looks pretty good as it is.
>>
>> --Mary
>>
>>
>> On Fri, Sep 9, 2016 at 4:19 AM, Sourav Chatterjee <srvsxc at outlook.com>
>> wrote:
>>
>>> Hi all
>>>
>>>
>>> I want convert my variable (temperature) to temperature
>>> (time,depth,lat,lon) from temperature(time,depth,x,y)
>>>
>>>
>>>
>>> here is how it looks like now.
>>>
>>>
>>> Any help!
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>> dimensions:
>>> depth = 12 ;
>>> time = UNLIMITED ; // (288 currently)
>>> x = 428 ;
>>> y = 403 ;
>>> variables:
>>> int stereographic ;
>>> stereographic:grid_mapping_name = "polar_stereographic" ;
>>> stereographic:latitude_of_projection_origin = 90. ;
>>> stereographic:longitude_of_projection_origin = -45. ;
>>> stereographic:scale_factor_at_projection_origin = 1. ;
>>> stereographic:straight_vertical_longitude_from_pole = -45. ;
>>> stereographic:false_easting = 0. ;
>>> stereographic:false_northing = 0. ;
>>> float x(x) ;
>>> x:axis = "X" ;
>>> x:standard_name = "projection_x_coordinate" ;
>>> x:units = "100 km" ;
>>> float y(y) ;
>>> y:standard_name = "projection_y_coordinate" ;
>>> y:axis = "Y" ;
>>> y:units = "100 km" ;
>>> float depth(depth) ;
>>> depth:long_name = "depth" ;
>>> depth:units = "m" ;
>>> depth:standard_name = "depth" ;
>>> depth:positive = "down" ;
>>> depth:axis = "Z" ;
>>> double time(time) ;
>>> time:units = "hour since 1950-1-1T00:00:00Z" ;
>>> time:long_name = "forecast time" ;
>>> float longitude(y, x) ;
>>> longitude:standard_name = "longitude" ;
>>> longitude:units = "degrees_east" ;
>>> float latitude(y, x) ;
>>> latitude:standard_name = "latitude" ;
>>> latitude:units = "degrees_north" ;
>>> short temperature(time, depth, y, x) ;
>>> temperature:_FillValue = -32767s ;
>>> temperature:missing_value = -32767s ;
>>> temperature:add_offset = 23.5 ;
>>> temperature:scale_factor = 0.000808839239385893 ;
>>> temperature:units = "Celsius" ;
>>> temperature:standard_name = "sea_water_potential_temperature" ;
>>> temperature:grid_mapping = "stereographic" ;
>>> temperature:coordinates = "longitude latitude" ;
>>> temperature:cell_methods = "area: mean" ;
>>>
>>> // global attributes:
>>> :title = "Arctic Ocean Physics Reanalysis (1991-2014), 12.5km
>>> monthly mean (dataset-ran-arc-myoceanv2-be)" ;
>>> :institution = "NERSC, Thormoehlens gate 47, N-5006 Bergen,
>>> Norway" ;
>>> :history = "20160112:Created by program hyc2proj, version V0.3" ;
>>> :source = "NERSC-HYCOM model fields" ;
>>> :references = "http://topaz.nersc.no" ;
>>> :field_type = "Files based on file type nersc_weekly" ;
>>> :Conventions = "CF-1.4" ;
>>> :field_date = "2014-11-15" ;
>>> :bulletin_date = "2014-11-15" ;
>>> }
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> 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/20160915/a521fa82/attachment.html
More information about the ncl-talk
mailing list