[ncl-talk] phase difference

Alan Brammer abrammer at albany.edu
Tue Jan 23 12:27:55 MST 2018


Assuming the latitudes and longitudes don't change across the multiple
files, you can read the coordinates just from a single file.  At the
moment, you're reading the lat lon from all files and NCL is concatenating
the first dimension (latitude).

e.g.
; filess = systemfunc ("ls /home1/omid/Marjani/DATA/
CMIP5/GFDL-CM3_curv2/hisGFDL-CM3/tos_Omon_GFDL-CM3_historical_r1i1p1*.nc")
;H = addfiles(filess,"r")
;ListSetType (H, "cat") ; concatenate (=default)
;SSTH= H[:]->tos
; lat2dH = H[
​0​
]->lat
; lon2dH=H[0]->lon


​re question 2:
https://www.ncl.ucar.edu/Applications/latlon_subset.shtml


Good luck,


​

On Tue, Jan 23, 2018 at 10:59 AM, sjd.marjani via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hello
>
> I have 2 important question and they are about curvilinear Oceanic Data ,
> SST.
>
> I really need HElp.
>
> ============================================
>
> first Question:==>
>
> these are my data files
>
> tos_Omon_GFDL-CM3_historical_r1i1p1_192501-192912.nc
>
> tos_Omon_GFDL-CM3_historical_r1i1p1_193001-193412.nc
>
> tos_Omon_GFDL-CM3_historical_r1i1p1_193501-193912.nc
>
> tos_Omon_GFDL-CM3_historical_r1i1p1_194001-194412.nc
>
> .
>
> .
>
> .
>
> tos_Omon_GFDL-CM3_historical_r1i1p1_199501-199912.nc
>
> tos_Omon_GFDL-CM3_historical_r1i1p1_200001-200412.nc
>
> *****************************************************
>
> and it is the attribute of one of these files :
>
> netcdf tos_Omon_GFDL-CM3_historical_r1i1p1_192501-192912 {
> dimensions:
> time = UNLIMITED ; // (60 currently)
> bnds = 2 ;
> rlat = 200 ;
> rlon = 360 ;
> vertices = 4 ;
> variables:
> double average_DT(time) ;
> average_DT:long_name = "Length of average period" ;
> average_DT:units = "days" ;
> double average_T1(time) ;
> average_T1:long_name = "Start time for average period" ;
> average_T1:units = "days since 1860-01-01 00:00:00" ;
> double average_T2(time) ;
> average_T2:long_name = "End time for average period" ;
> average_T2:units = "days since 1860-01-01 00:00:00" ;
> double bnds(bnds) ;
> bnds:long_name = "vertex number" ;
> bnds:cartesian_axis = "N" ;
> float tos(time, rlat, rlon) ;
> tos:missing_value = 1.e+20f ;
> tos:original_name = "sst + 273.15" ;
> tos:cell_methods = "time: mean" ;
> tos:valid_range = 263.f, 373.f ;
> tos:units = "K" ;
> tos:long_name = "Sea Surface Temperature" ;
> tos:coordinates = "lat lon" ;
> tos:_FillValue = 1.e+20f ;
> tos:standard_name = "surface_temperature" ;
> tos:cell_measures = "area: areacello" ;
> tos:comments = "Note: This model output is presented on the model\'s
> tripolar grid. The North Pole singularity is avoided by using this
> nonregular grid north of 65N. More information about the ocean and sea ice
> model\'s grid can be found at http://nomads.gfdl.noaa.gov/." ;
> tos:associated_files = "baseURL: http://cmip-pcmdi.llnl.gov/
> CMIP5/dataLocation gridspecFile: gridspec_ocean_fx_GFDL-CM3_
> historical_r0i0p0.nc areacello: areacello_fx_GFDL-CM3_historical_r0i0p0.nc"
> ;
> tos:original_units = "K" ;
> double time(time) ;
> time:long_name = "time" ;
> time:units = "days since 1860-01-01 00:00:00" ;
> time:cartesian_axis = "T" ;
> time:calendar_type = "noleap" ;
> time:calendar = "noleap" ;
> time:bounds = "time_bnds" ;
> time:standard_name = "time" ;
> time:axis = "T" ;
> double time_bnds(time, bnds) ;
> time_bnds:long_name = "time axis boundaries" ;
> time_bnds:units = "days since 1860-01-01 00:00:00" ;
> double rlon(rlon) ;
> rlon:long_name = "longitude in rotated pole grid" ;
> rlon:units = "degrees" ;
> rlon:axis = "X" ;
> rlon:standard_name = "grid_longitude" ;
> double rlat(rlat) ;
> rlat:long_name = "latitude in rotated pole grid" ;
> rlat:units = "degrees" ;
> rlat:axis = "Y" ;
> rlat:standard_name = "grid_latitude" ;
> float lat(rlat, rlon) ;
> lat:long_name = "latitude coordinate" ;
> lat:units = "degrees_north" ;
> lat:standard_name = "latitude" ;
> lat:bounds = "lat_vertices" ;
> double lat_vertices(rlat, rlon, vertices) ;
> lat_vertices:units = "degrees_north" ;
> float lon(rlat, rlon) ;
> lon:long_name = "longitude coordinate" ;
> lon:units = "degrees_east" ;
> lon:standard_name = "longitude" ;
> lon:bounds = "lon_vertices" ;
> double lon_vertices(rlat, rlon, vertices) ;
> lon_vertices:units = "degrees_east" ;
> int vertices(vertices) ;
>
> // global attributes:
> :title = "NOAA GFDL GFDL-CM3, historical (run 1) experiment output for
> CMIP5 AR5" ;
> :institute_id = "NOAA GFDL" ;
> :source = "GFDL-CM3 2010 atmosphere: AM3 (AM3p9,C48L48); sea ice: SIS
> (SISp2,Tripolar360x200); land: LM3 (LM3p7_cCM3,C48); ocean: MOM4
> (MOM4p1_x1_Z50_cCM3,Tripolar360x200L50)" ;
> :contact = "gfdl.climate.model.info at noaa.gov" ;
> :project_id = "CMIP5" ;
> :table_id = "Table Omon (31 Jan 2011)" ;
> :experiment_id = "historical" ;
> :realization = 1 ;
> :modeling_realm = "ocean" ;
> :tracking_id = "b062901f-bdec-46e5-ba81-f6dd63777987" ;
> :Conventions = "CF-1.4" ;
> :references = "The GFDL Data Portal (http://nomads.gfdl.noaa.gov/)
> provides access to NOAA/GFDL\'s publicly available model input and output
> data sets. From this web site one can view and download data sets and
> documentation, including those related to the GFDL coupled models
> experiments run for the IPCC\'s 5th Assessment Report and the US CCSP." ;
> :comment = "GFDL experiment name: CM3Z_D1_1860-2005_AllForc_H1\n",
> "GFDL parent experiment name: CM3Z_Control-1860_D1\n",
> "CMIP5 experiment ID: historical\n",
> "Initial conditions from this experiment (CMIP5 expt. 3.2 Core) were taken
> from 01Jan0001 of the 1860 control model experiment
> CM3Z_Control-1860_D1.\n",
> "Forcing agents (7 WMGGs, tropospheric and stratospheric ozone, land use,
> volcanoes, solar, sulfate, black carbon,\n",
> "organic carbon, dust, and sea salt) vary historically from 1860-2005
> following prescribed emission or concentration\n",
> "timeseries or internally calculated emissions. This model includes direct
> and indirect aerosol effects." ;
> :gfdl_experiment_name = "CM3Z_D1_1860-2005_AllForc_H1" ;
> :creation_date = "2011-08-22T06:05:17Z" ;
> :model_id = "GFDL-CM3" ;
> :branch_time = "0.0" ;
> :experiment = "historical" ;
> :forcing = "GHG,SA,Oz,LU,Sl,Vl,SS,BC,MD,OC (GHG includes CO2, CH4, N2O,
> CFC11, CFC12, HCFC22, CFC113)" ;
> :frequency = "mon" ;
> :initialization_method = 1 ;
> :parent_experiment_id = "piControl" ;
> :physics_version = 1 ;
> :product = "output1" ;
> :institution = "NOAA GFDL(201 Forrestal Rd, Princeton, NJ, 08540)" ;
> :history = "File was processed by fremetar (GFDL analog of CMOR).
> TripleID: [exper_id_1XhP9uft45,realiz_id_4e0zLckGg3,run_id_HhaU8NYVBh]" ;
> :parent_experiment_rip = "r1i1p1" ;
>
> ************************************************************
> ***********************************************************
>
> when I read just one of these files ,my script can plot the Sea Surface
> Temperature
>
> but
>
> when I read all the 16 files, the ncl plot it with "phase difference".
>
> In below you can see
>
> the result of printVarSummary(lat2d) for the single file and multiple files
>
> =======================
>
> Variable: lat2d
> Type: float
> Total Size: 288000 bytes
> 72000 values
> Number of Dimensions: 2
> Dimensions and sizes: [rlat | 200] x [rlon | 360]
> Coordinates:
> rlat: [-81.5..89.50000080000001]
> rlon: [-279.5..79.5]
> Number Of Attributes: 4
> long_name : latitude coordinate
> units : degrees_north
> standard_name : latitude
> bounds : lat_vertices
>
> ====================
>
> Variable: lat2dH
> Type: float
> Total Size: 4608000 bytes
> 1152000 values
> Number of Dimensions: 2
> Dimensions and sizes: [rlat | 3200] x [rlon | 360]
> Coordinates:
> rlat: [-81.5..89.50000080000001]
> rlon: [-279.5..79.5]
> Number Of Attributes: 4
> long_name : latitude coordinate
> units : degrees_north
> standard_name : latitude
> bounds : lat_vertices
>
> ==============
>
> my script is in below:
>
> ==============================================>>>
>
> ;***********************************************
> begin
> ;************************************************
>
> diri = "/home1/omid/Marjani/DATA/CMIP5/GFDL-CM3_curv2/hisGFDL-CM3/" ;
> input directory
> fili = "tos_Omon_GFDL-CM3_historical_r1i1p1_192501-192912.nc" ; your file
> tos(1872*300*360)
> pthi = diri+fili
> f = addfile( pthi, "r")
> SST = f->tos
> lat2d = f->lat
> lon2d =f->lon
>
>
> ; filess = systemfunc ("ls /home1/omid/Marjani/DATA/
> CMIP5/GFDL-CM3_curv2/hisGFDL-CM3/tos_Omon_GFDL-CM3_historical_r1i1p1*.nc")
> ;H = addfiles(filess,"r")
> ;ListSetType (H, "cat") ; concatenate (=default)
> ;SSTH= H[:]->tos
> ; lat2dH = H[:]->lat
> ; lon2dH=H[:]->lon
>
> ;***********************************************************
> **********************************
>
> ; printVarSummary(SST)
> ;printVarSummary(SSTH)
>
> ;printVarSummary(lat2d)
> ;printVarSummary(lat2dH)
>
> ;===========================================================
> ==================
> ;   First Part=> PLOT SST
> ;===========================================================
> ====================
> wks = gsn_open_wks("x11","marjani")
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; choose colormap
> res = True
> res at cnFillOn = True ; turn on color
> res at cnFillMode = "RasterFill" ; turn on raster mode ... optional
> res at cnLinesOn = False ; turn off contour lines
> res at cnLineLabelsOn = False
>
> res at cnLineLabelsOn = False
> res at cnFillPalette = "BlAqGrYeOrReVi200" ; your choice
> res at gsnAddCyclic = True ;-- lon < 360 degrees
> res at tiMainString = "SST_I" ; title
>
> SST at lat2d = lat2d
> SST at lon2d = lon2d
>
> ; ******************************************************
> res at mpMinLonF = 0
> res at mpMaxLonF = 360
> res at mpCenterLonF = 180 ; This is necessary to get the correct ma
>
>
> ;===========================================================
> ===============
> plot = gsn_csm_contour_map_ce(wks,SSTH(4,:,:),res) ; Can not plot it by
> the use of systemfunc and just can do it when i use  1data file
>
> ;.................................................................
> ;SSTmean=dim_avg_n_Wrap(SST(0:59,:,:),0)
> ;copy_VarCoords(SST, SSTmean)
> ;plot = gsn_csm_contour_map_ce(wks,SSTmean,res)
> ;......................................................
> ;s=SST(10,:,:)
> ;anom = s - SSTmean
> ;copy_VarCoords(SSTmean, anom)
> ;copy_VarAtts(SSTmean, anom)
> ;plot = gsn_csm_contour_map_ce(wks,anom,res) ;nemitoone
> ;.............................................................
> ;anomSST = dim_rmvmean_n_Wrap(SST(11:611:12,:,:),0)
> ;plot = gsn_csm_contour_map_ce(wks,anomSST(1,:,:),res)
>
>
> ;===========================================================
> =============================
>
> ;       Second Part
>
> ;========================================================================
>
> ....................................................................
> ...................................................................
> ;print("--------print(lat2d(:,160))----------------")
> ;print(lat2d(:,160))
> ;print("--------print(lon2d(:,160))----------------")
> ;print(lon2d(:,160))
>
> ;print("--------print(lat2d(:,190)----------------")
> ;print(lat2d(:,190))
> ;print("--------print(lon2d(:,190)----------------")
>
> ;==============================
>
> ;print("--------print(lat2d(:,64))----------------")
> ;print(lat2d(:,64))
> ;print("--------print(lon2d(:,64))----------------")
> ;print(lon2d(:,64))
>
> ;print("--------print(lat2d(:,87))----------------")
> ;print(lat2d(:,87))
> ;print("--------print(lon2d(:,87))----------------")
> ;print(lon2d(:,87))
> ;==============================================================
> end
>
>
> ======================
>
> I have  another question,
>
> the second question is a bout the Second part of my script.
>
> the second part is a way that i use to find for example Nino3.4 region .
>
> would you please tell me the right way to read the lat and lon of
> curvilinear grid,,and is there any method to find an exact region?
>
> ;=============================
>
> I wait for your Help .
>
> THank YOu in ADvance
>
>
>    Sajede
>
>
>
> _______________________________________________
> 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/20180123/3a1014ea/attachment.html>


More information about the ncl-talk mailing list