load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCL_FXN_PATH/time_conversion_module.ncl" load "../../../shapefiles/shapefile_mask_data.ncl" ; USAGE: ; ncl 'plot_typ="dfm10hr"' 'wrf_file="../wrfout_day00_1300LST.nc"' 'file_out="dfm10hr_day00_1300lst"' 'fl_typ="png"' dfm_1300lst_plot.ncl ; ; ; begin ; double time(time) ; ; time:long_name = "forecast time" ; ; time:calendar = "standard" ; ; time:units = "hours since 1900-01-01 00:00:00" ; ; float latitude(south_north, west_east) ; ; latitude:units = "degrees_north" ; ; latitude:cell_methods = "record: mean" ; ; latitude:long_name = "latitude coordinate" ; ; latitude:standard_name = "latitude" ; ; float longitude(south_north, west_east) ; ; longitude:units = "degrees_east" ; ; longitude:cell_methods = "record: mean" ; ; longitude:long_name = "longitude coordinate" ; ; longitude:standard_name = "longitude" ; ; float erc(south_north, west_east) ; ; erc:_FillValue = -99.f ; ; erc:units = "" ; ; erc:cell_methods = "record: mean" ; ; erc:coordinates = "latitude longitude" ; ; erc:grid_mapping = "Lambert_Conformal" ; ; float dfm1hr(south_north, west_east) ; ; dfm1hr:_FillValue = -99.f ; ; dfm1hr:units = "g/g" ; ; dfm1hr:cell_methods = "record: mean" ; ; dfm1hr:coordinates = "latitude longitude" ; ; dfm1hr:grid_mapping = "Lambert_Conformal" ; ; float dfm10hr(south_north, west_east) ; ; dfm10hr:_FillValue = -99.f ; ; dfm10hr:units = "g/g" ; ; dfm10hr:cell_methods = "record: mean" ; ; dfm10hr:coordinates = "latitude longitude" ; ; dfm10hr:grid_mapping = "Lambert_Conformal" ; ; float dfm100hr(south_north, west_east) ; ; dfm100hr:_FillValue = -99.f ; ; dfm100hr:units = "g/g" ; ; dfm100hr:cell_methods = "record: mean" ; ; dfm100hr:coordinates = "latitude longitude" ; ; dfm100hr:grid_mapping = "Lambert_Conformal" ; ; float dfm1000hr(south_north, west_east) ; ; dfm1000hr:_FillValue = -99.f ; ; dfm1000hr:units = "g/g" ; ; dfm1000hr:cell_methods = "record: mean" ; ; dfm1000hr:coordinates = "latitude longitude" ; ; dfm1000hr:grid_mapping = "Lambert_Conformal" ; ; // global attributes: ; :creation_date = "Wed Jun 29 05:33:16 PDT 2016" ; ; :Conventions = "None" ; ; :source_file = "/home/scapps/projects/usfs/wrf/dfm_nfdrs/wrfout_d02_2016-06-29_00:00:00_dfm_nfdrs.nc" ; ; :title = "DFM NFDRS OUTPUT" ; ; :grid_mapping = "Lambert_Conformal" ; ; :MAP_PROJ_CHAR = "Lambert Conformal" ; ; :POLE_LON = 0.f ; ; :POLE_LAT = 90.f ; ; :STAND_LON = -120.273f ; ; :MOAD_CEN_LAT = 35.961f ; ; :TRUELAT2 = 39.f ; ; :TRUELAT1 = 32.f ; ; :CEN_LON = -118.2734f ; ; :CEN_LAT = 35.78233f ; ; :DY = 6000.f ; ; :DX = 6000.f ; ; :BOTTOM_TOP_GRID_DIMENSION = 38 ; ; :SOUTH_NORTH_GRID_DIMENSION = 133 ; ; :WEST_EAST_GRID_DIMENSION = 136 ; ; :institution = "USFS" ; ; Dimensions: time,south_north,west_east file1 = addfile(wrf_file,"r") ;global_attnames = getvaratts(file1) lat2d = file1->latitude lon2d = file1->longitude lat2d@units = "degrees_north" lon2d@units = "degrees_east" tmp = dimsizes(lon2d) mlon = tmp(1) nlat = tmp(0) cen_lon = file1@CEN_LON cen_lat = file1@CEN_LAT true_lat1 = file1@TRUELAT1 true_lat2 = file1@TRUELAT2 stand_lon = file1@STAND_LON ; ; utc_yyyy = fall[:]->YYYY ; utc_mm = fall[:]->MM ; utc_dd = fall[:]->DD ; utc_hh = fall[:]->HH ; ntimes = dimsizes(utc_yyyy) ; lst_yy = new((/ntimes/),integer) ; lst_mm = new((/ntimes/),integer) ; lst_dd = new((/ntimes/),integer) ; lst_hh = new((/ntimes/),integer) ; utc_to_local_time(offset,utc_yyyy,utc_mm,utc_dd,utc_hh,lst_yy,lst_mm,lst_dd,lst_hh) ; ;print("UTC: "+utc_mm+"/"+utc_dd+"/"+utc_yyyy+" "+utc_hh+" Local Time: "+lst_mm+"/"+lst_dd+"/"+lst_yy+" "+lst_hh) ; delete(utc_mm) ; delete(utc_dd) ; delete(utc_yyyy) ; delete(utc_hh) plot = new(1,graphic) res = True ;res@gsnPaperOrientation = "portrait" res@gsnMaximize = True res@gsnDraw = False ; don't draw res@gsnFrame = False ; don't advance frame res@mpFillOn = False res@mpProjection = "LambertConformal" res@mpLambertParallel1F = get_res_value_keep(res, "mpLambertParallel1F",true_lat1) res@mpLambertParallel2F = get_res_value_keep(res, "mpLambertParallel2F",true_lat2) res@mpLambertMeridianF = get_res_value_keep(res, "mpLambertMeridianF",stand_lon) res@lbOrientation = "vertical" res@lbLabelPosition = "left" res@lbTitlePosition = "Right" res@lbTitleDirection = "Across" res@pmLabelBarOrthogonalPosF = -1.10 res@pmLabelBarHeightF = 0.4 res@mpLimitMode = "Corners" res@mpLeftCornerLatF = lat2d(0,0) ; REMOVE relaxed boundary data res@mpLeftCornerLonF = lon2d(0,0) ; REMOVE relaxed boundary data res@mpRightCornerLatF = lat2d(nlat-1,mlon-1) ; REMOVE relaxed boundary data res@mpRightCornerLonF = lon2d(nlat-1,mlon-1) ; REMOVE relaxed boundary data res@mpPerimOn = False res@mpCenterLonF = cen_lon res@mpCenterLatF = cen_lat res@mpLambertParallel1F = true_lat1 res@mpLambertParallel2F = true_lat2 res@mpLambertMeridianF = stand_lon res@lbTitleFontHeightF = .012 res@mpOutlineBoundarySets = "GeophysicalAndUSStates"; turn on states res@mpDataSetName = "Earth..2" res@mpDataBaseVersion = "MediumRes" res@mpOutlineOn = False res@mpInlandWaterFillPattern = 1 res@mpUSStateLineThicknessF = 1 res@mpNationalLineThicknessF = 1 res@mpGeophysicalLineThicknessF = 1 res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last res@mpPerimDrawOrder = "PostDraw" ; force map perim ;calif_counties = \ ;(/"Orange","San Diego","Los Angeles","Riverside","San Bernardino", \ ;"Ventura","Imperial","Santa Barbara","Kern","San Luis Obispo"/) ;res@mpOutlineSpecifiers = "California . " + calif_counties ; res@gsnAddCyclic = False res@cnInfoLabelOn = False ; turn off cn info label res@cnFillOn = True ; turn on color res@cnLinesOn = False res@cnLineLabelsOn = False res@gsnSpreadColors = True ; spread out color table if (plot_typ.eq."dfm10hr") then left_title = "10hr Dead Fuel Moisture (%)" ;res@cnLevelSelectionMode = "ManualLevels" ;res@cnMinLevelValF = 0. ;res@cnMaxLevelValF = 35. ;res@cnLevelSpacingF = 0.25 res@cnLevelSelectionMode = "ExplicitLevels" res@lbLabelFontHeightF =.014 res@cnLevels = (/1,3,5,7,9,12,15,18,20,25,30/) ;res@lbLabelPosition = "Center" ; label position ;res@lbLabelAlignment = "BoxCenters" ; label orientation res@lbLabelStride = 1 ;res@lbLabelsOn = False res@gsnLeftString = "" res@gsnCenterString = "" res@gsnRightString = "" res@lbTitleOn = False ;res@lbTitleString =left_title ;res@lbTitleFontHeightF= .011 ;res@lbTitlePosition = "Bottom" lblstrd = 1 plot_var = file1->dfm10hr plot_var = plot_var*100. plot_var@units = "%" end if plot_var@lat2d = lat2d plot_var@lon2d = lon2d delete(file1) res@tfDoNDCOverlay = True wks = gsn_open_wks(fl_typ,file_out) gsn_define_colormap(wks,"dfm10hr_colorbar") ;wrf_smooth_2d(plot_var,5) data_mask = shapefile_mask_data(plot_var,"../../../shapefiles/psa_southops_shapefiles/New_PSAs.shp",True) plot = gsn_csm_contour_map(wks,data_mask,res) ; plres = True plres@gsLineColor = "black" plres@gsLineThicknessF = 2 id = gsn_add_shapefile_polylines(wks,plot,"../../../shapefiles/psa_southops_shapefiles/New_PSAs.shp",plres) plres@gsLineColor = "gray" plres@gsLineThicknessF = 1 id2 = gsn_add_shapefile_polylines(wks,plot,"../../../shapefiles/us_county_shapefiles/USCounties.shp",plres) draw(plot) frame(wks) delete(plot_var) ;delete(wks) ;cmd = "convert -delay 40 -density 80x80 "+dir_out+fl_out+".ps "+dir_out+fl_out+".gif" ;system(cmd) end