Commit bc328ed3 authored by Carl Schreck's avatar Carl Schreck

Automated Nightly Commit - Wed Feb 12 09:12:36 EST 2020

parent 9d7e17fd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; rmm_to_netcdf.ncl
; Carl Schreck (carl@cicsnc.org)
; August 2012
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: Read one of Matt Wheeler's RMM text files and write it to
; netCDF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
begin
print_clock( "Here we go!" )
; These are some parameters that could be useful to have up top
basePath = "/home/carl/data/eof_store/wheeler/"
fileName = "mjoindex_IHR_20CRV3"
asciiPath = basePath + fileName + ".dat.txt"
ncPath = basePath + fileName + ".nc"
timeUnits = "days since 1800-01-01 00:00:00"
minTime = cd_inv_calendar( 1879, 01, 01, 0, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( 2113, 02, 28, 0, 0, 0, timeUnits, 0 )
fltInput = readAsciiTable( asciiPath, 07, "float", 2 )
intInput = round( fltInput, 3 )
year = intInput(:,0)
month = intInput(:,1)
day = intInput(:,2)
rmm1 = fltInput(:,3)
rmm2 = fltInput(:,4)
amp = fltInput(:,5)
phase = intInput(:,6)
zeros = year * 0
time = cd_inv_calendar( year, month, day, zeros, zeros, zeros, timeUnits, 0 )
time!0 = "time"
time&time = time
copy_VarCoords( time, rmm1 )
copy_VarCoords( time, rmm2 )
copy_VarCoords( time, phase )
copy_VarCoords( time, amp )
rmm1@long_name = "RMM1"
rmm2@long_name = "RMM2"
phase@long_name = "Phase"
amp@long_name = "Amplitude"
rmm1@_FillValue = 1e+36
rmm2@_FillValue = 1e+36
phase@_FillValue = 999
amp@_FillValue = 1e+36
rmmBoth = (/ rmm1, rmm2 /)
rmmBoth!0 = "evn"
rmmBoth!1 = "time"
rmmBoth&time = time
rmmBoth@long_name = "Both RMM PCs"
rmmBoth@_FillValue = rmm1@_FillValue
system( "rm " + ncPath )
ncFile = addfile( ncPath, "c" )
ncFile->time = time({minTime:maxTime})
ncFile->rmm1 = rmm1({minTime:maxTime})
ncFile->rmm2 = rmm2({minTime:maxTime})
ncFile->rmmBoth = rmmBoth(:,{minTime:maxTime})
ncFile->phase = phase({minTime:maxTime})
ncFile->amp = amp({minTime:maxTime})
print_clock( "Thank you, come again." )
end
...@@ -151,81 +151,83 @@ begin ; main ...@@ -151,81 +151,83 @@ begin ; main
outFile = addfile( outPath, "c" ) outFile = addfile( outPath, "c" )
char_outName = tochar( outName(:nStorm) ) char_outName = tochar( outName(:nStorm) )
char_outName!0 = "nStorm" char_outName!0 = "storm"
char_outName!1 = "nCharName" char_outName!1 = "nCharName"
char_outName@long_name = "Storm Name" char_outName@long_name = "Storm Name"
outFile->name = char_outName outFile->name = char_outName
char_outId = tochar( outId(:nStorm) ) char_outId = tochar( outId(:nStorm) )
char_outId!0 = "nStorm" char_outId!0 = "storm"
char_outId!1 = "nCharId" char_outId!1 = "nCharId"
char_outId@long_name = "Storm ID" char_outId@long_name = "Storm ID"
outFile->sid = char_outId outFile->sid = char_outId
char_outOrg = tochar( outOrg(:nStorm) ) char_outOrg = tochar( outOrg(:nStorm) )
char_outOrg!0 = "nStorm" char_outOrg!0 = "storm"
char_outOrg!1 = "nCharOrg" char_outOrg!1 = "nCharOrg"
char_outOrg@long_name = "NHC or JTWC" char_outOrg@long_name = "NHC or JTWC"
outFile->source = char_outOrg outFile->source = char_outOrg
outNfix!0 = "nStorm" outNfix!0 = "storm"
outNfix@long_name = "Fixes per storm" outNfix@long_name = "Fixes per storm"
outFile->nFix = outNfix(:nStorm) outFile->nFix = outNfix(:nStorm)
outTime!0 = "nStorm" outTime!0 = "storm"
outTime!1 = "nTime" outTime!1 = "date_time"
outTime@long_name = "Time" outTime@long_name = "Time"
outFile->time = outTime(:nStorm,:) outFile->time = outTime(:nStorm,:)
outLat!0 = "nStorm" outLat!0 = "storm"
outLat!1 = "nTime" outLat!1 = "date_time"
outLat@long_name = "Latitude" outLat@long_name = "Latitude"
outLat@units = "degrees_north" outLat@units = "degrees_north"
outFile->usa_lat = outLat(:nStorm,:) outFile->usa_lat = outLat(:nStorm,:)
outFile->lat = outLat(:nStorm,:)
outLon!0 = "nStorm" outLon!0 = "storm"
outLon!1 = "nTime" outLon!1 = "date_time"
outLon@long_name = "Longitude" outLon@long_name = "Longitude"
outLon@units = "degrees_east" outLon@units = "degrees_east"
outFile->usa_lon = outLon(:nStorm,:) outFile->usa_lon = outLon(:nStorm,:)
outFile->lon = outLon(:nStorm,:)
outWind!0 = "nStorm" outWind!0 = "storm"
outWind!1 = "nTime" outWind!1 = "date_time"
outWind@long_name = "Maximum Sustained Wind (MSW)" outWind@long_name = "Maximum Sustained Wind (MSW)"
outWind@units = "kt" outWind@units = "kt"
outFile->usa_wind = outWind(:nStorm,:) outFile->usa_wind = outWind(:nStorm,:)
outPres!0 = "nStorm" outPres!0 = "storm"
outPres!1 = "nTime" outPres!1 = "date_time"
outPres@long_name = "Minimum Central Pressure (MCP)" outPres@long_name = "Minimum Central Pressure (MCP)"
outPres@units = "mb" outPres@units = "mb"
outFile->usa_pres = outPres(:nStorm,:) outFile->usa_pres = outPres(:nStorm,:)
char_outBasin = tochar( basin(:nStorm,:) ) char_outBasin = tochar( basin(:nStorm,:) )
char_outBasin!0 = "nStorm" char_outBasin!0 = "storm"
char_outBasin!1 = "nTime" char_outBasin!1 = "date_time"
char_outBasin!2 = "nCharBasin" char_outBasin!2 = "nCharBasin"
char_outBasin@long_name = "Basin" char_outBasin@long_name = "Basin"
char_outBasin@units = "" char_outBasin@units = ""
outFile->basin = char_outBasin outFile->basin = char_outBasin
char_genBasin = tochar( genesis_basin(:nStorm) ) char_genBasin = tochar( genesis_basin(:nStorm) )
char_genBasin!0 = "nStorm" char_genBasin!0 = "storm"
char_genBasin!1 = "nCharGenBasin" char_genBasin!1 = "nCharGenBasin"
char_genBasin@long_name = "Basin of genesis" char_genBasin@long_name = "Basin of genesis"
char_genBasin@units = "" char_genBasin@units = ""
outFile->genesis_basin = char_genBasin outFile->genesis_basin = char_genBasin
yyyymm!0 = "nStorm" yyyymm!0 = "storm"
yyyymm!1 = "nTime" yyyymm!1 = "date_time"
yyyymm@long_name = "YYYYMM" yyyymm@long_name = "YYYYMM"
outFile->yyyymm = yyyymm(:nStorm,:) outFile->yyyymm = yyyymm(:nStorm,:)
nature = new( dimsizes(yyyymm), string ) nature = new( dimsizes(yyyymm), string )
nature = "TS" nature = "TS"
char_nature = tochar( nature(:nStorm,:) ) char_nature = tochar( nature(:nStorm,:) )
char_nature!0 = "nStorm" char_nature!0 = "storm"
char_nature!1 = "nTime" char_nature!1 = "date_time"
char_nature!2 = "nCharNature" char_nature!2 = "nCharNature"
char_nature@long_name = "Storm nature" char_nature@long_name = "Storm nature"
outFile->nature = char_nature outFile->nature = char_nature
...@@ -233,7 +235,7 @@ begin ; main ...@@ -233,7 +235,7 @@ begin ; main
track_type = new( dimsizes(genesis_basin), string ) track_type = new( dimsizes(genesis_basin), string )
track_type = "main" track_type = "main"
char_type = tochar( track_type(:nStorm) ) char_type = tochar( track_type(:nStorm) )
char_type!0 = "nStorm" char_type!0 = "storm"
char_type!1 = "nCharType" char_type!1 = "nCharType"
char_type@long_name = "Track type" char_type@long_name = "Track type"
outFile->track_type = char_type outFile->track_type = char_type
......
...@@ -25,8 +25,8 @@ begin ; main ...@@ -25,8 +25,8 @@ begin ; main
setfileoption("nc","CompressionLevel",compress) setfileoption("nc","CompressionLevel",compress)
timeUnits = "days since 1800-01-01 00:00:00" timeUnits = "days since 1800-01-01 00:00:00"
minYear = 1951 minYear = 2001
maxYear = 1978 maxYear = 2018
minTime = cd_inv_calendar( minYear, 01, 01, 00, 0, 0, timeUnits, 0 ) minTime = cd_inv_calendar( minYear, 01, 01, 00, 0, 0, timeUnits, 0 )
maxTime = cd_inv_calendar( maxYear, 12, 31, 18, 0, 0, timeUnits, 0 ) maxTime = cd_inv_calendar( maxYear, 12, 31, 18, 0, 0, timeUnits, 0 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment