Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a86bebf
cleanup
rgrumbine Nov 22, 2024
15ecfd1
clean up and converging cafs and rtofs
rgrumbine Nov 22, 2024
4b336ce
improved file name management
rgrumbine Nov 22, 2024
b370ade
update fallback date
rgrumbine Nov 26, 2024
33eb4e9
minor rtofs and nep work
rgrumbine Dec 11, 2024
ed444f3
nep and note
rgrumbine Dec 11, 2024
f243694
cleanup
rgrumbine Dec 11, 2024
6d68007
Merge pull request #39 from rgrumbine/dev/cactus2024
rgrumbine Dec 17, 2024
238ec24
Merge pull request #40 from rgrumbine/dev/nwp
rgrumbine Dec 17, 2024
0a6bf4e
cleaning up
rgrumbine Jan 6, 2025
1af514e
removing old debugging
rgrumbine Jan 6, 2025
e521728
update node assignment for new networkx, cleanup
rgrumbine Jan 8, 2025
80a066c
adding box and points definitions
rgrumbine Jan 14, 2025
2cbb8ac
adding ants and shapefile capabilities
rgrumbine Jan 28, 2025
133ca44
update fallback dates
rgrumbine Feb 6, 2025
7411ead
update cice ic edit
rgrumbine Feb 26, 2025
62380e6
updating the runup script
rgrumbine Apr 14, 2025
1bb6888
updating fallback dates
rgrumbine Apr 21, 2025
8604cbc
update fall back dates
rgrumbine May 21, 2025
8675004
run dataflow early as possible
rgrumbine May 28, 2025
1ae1ca2
support reruns of analysis
rgrumbine May 30, 2025
b941924
catching up nwp history
rgrumbine Jun 13, 2025
4194ca7
Merge pull request #42 from rgrumbine/dev/nwp_hera
rgrumbine Jun 13, 2025
9a25c24
Merge pull request #43 from rgrumbine/dev/cactus
rgrumbine Jun 13, 2025
79e286a
update fallback dates
rgrumbine Jun 17, 2025
fa9493d
prep for loss of ssmis
rgrumbine Jun 26, 2025
26ce540
compositing viirs concentration working
rgrumbine Jun 26, 2025
07a9d5b
viirs plotting and update fallback dates
rgrumbine Jun 30, 2025
ece6072
initial set up for cluster analysis
rgrumbine Jul 1, 2025
b6acf1d
full set, for 14th
rgrumbine Jul 1, 2025
223d9ef
viirs plotting
rgrumbine Jul 2, 2025
6c4772d
Merge branch 'develop' into dev/cactus
rgrumbine Jul 2, 2025
fd16d48
Merge pull request #44 from rgrumbine/dev/cactus
rgrumbine Jul 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
10 changes: 6 additions & 4 deletions amsr2.filter/amsr2.acquire/text.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/sh
#
tag=20230101
base=$HOME/noscrub/filter/
tag=20250102
base=$HOME/noscrub/com/seaice_analysis/

while [ $tag -le 20230531 ]
while [ $tag -le 20250614 ]
do
echo $tag
./seaice_totext ${base}/amsr2.${tag}/amsr2.$tag amsr2_${tag}.txt
if [ ! -f $base/seaice_analysis.${tag}/amsr2_${tag}.txt.1 ] ; then
time ./seaice_totext ${base}/seaice_analysis.${tag}/amsr2.bufr $base/seaice_analysis.${tag}/amsr2_${tag}.txt
fi

tag=`expr $tag + 1`
tag=`$HOME/bin/dtgfix3 $tag`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 11 additions & 3 deletions amsr2.filter/amsr2.acquire/totext.C
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ int main(int argc, char *argv[]) {
for (int i = 0 ; i < ntargets; i++) {
hrgrids.resize(mgrids[i]->xpoints(), mgrids[i]->ypoints() );
lrgrids.resize(mgrids[i]->xpoints(), mgrids[i]->ypoints() );
//debug: printf("zzz calling scanner\n"); fflush(stdout);
scanner(fin, fout[i], *mgrids[i], hrgrids, lrgrids);
fclose(fout[i]);
}
Expand All @@ -70,18 +71,25 @@ void scanner(FILE *fin, FILE *fout, metricgrid<unsigned char> &mgrid, grid2<amsr
fijpt loc;
ijpt iloc;
latpt ll;
int count = 0;
size_t hread;

//debug: printf("zzz entered scanner\n"); fflush(stdout);
rewind(fin);
while (!feof(fin)) {
fread(&x, sizeof(x), 1, fin);
nobs = x.nspots;
hread = fread(&x, sizeof(x), 1, fin);
//debug: printf("zzz read x %d %d %d\n",count,(int) hread, x.nspots); fflush(stdout);
count++;

fread(&s[0], sizeof(amsr2_spot), nobs, fin);
nobs = x.nspots;
hread = fread(&s[0], sizeof(amsr2_spot), nobs, fin);
//debug: printf("zzz spot %d %d\n",count, (int) hread); fflush(stdout);
if (feof(fin)) continue;

// look at land fractions, land == 0
sum = 0;
for (i = 0; i < nobs; i++) { sum += s[i].alfr; }
//debug: printf("zzz total land fraction %f\n",(float) sum); fflush(stdout);

nread += 1;
if (x.clat < 25 && x.clat > -40.0) continue;
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion amsr2.filter/amsr2/browse/needed_imports

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 0 additions & 31 deletions amsr2.filter/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@ def apply_filters(filts, matchups, show = True):
print("filt ",ifilt, "match k",k, matchups[k].show(), flush=True )
if(to_filter):
applied += 1
<<<<<<< HEAD
#debug: print("tot applied: ",applied,flush=True)
return applied
=======
print("tot applied: ",applied,flush=True)
>>>>>>> develop



#tchn, tb_crit, bayes_out, p(tb> tbcrit), pbogus, p(tb > tbcrit | bogus)
Expand All @@ -89,15 +84,6 @@ def apply_filters(filts, matchups, show = True):
tfilters[k] = copy.deepcopy(tmp)
k += 1

<<<<<<< HEAD
=======
#debug: print("k, len",k, len(tfilters), flush=True)
#debug: tfilters[0].show()
#debug: tfilters[int(k/2)].show()
#debug:
#debug: exit(0)

>>>>>>> develop
# go through filters
for tchan in range(0, x.ntb):
#debug: print("tchan = ",tchan, flush=True)
Expand Down Expand Up @@ -266,7 +252,6 @@ def apply_filters(filts, matchups, show = True):

nfilt=len(notbogus)
show = False
<<<<<<< HEAD
print("len notbogus filters: ",len(notbogus), "\n")

print("tot match 00 ",len(match00), end="" )
Expand All @@ -284,19 +269,3 @@ def apply_filters(filts, matchups, show = True):
print("tot match 11 ",len(match11), end="" )
n = apply_filters(notbogus, match11, show)
print(" filter applied: ",n, float(n)/float(len(match11)) )
=======
print("len notbogus: ",len(notbogus))

print("tot match 00 ",len(match00) )
apply_filters(notbogus, match00, show)

print("tot match 01 ",len(match01) )
apply_filters(notbogus, match01, show)

print("tot match 10 ",len(match10) )
apply_filters(notbogus, match10, show)

print("tot match 11 ",len(match11) )
apply_filters(notbogus, match11, show)
>>>>>>> develop

132 changes: 90 additions & 42 deletions cice_tools/cice_ic_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,46 @@
import sys

import numpy
import numpy.ma as ma

import netCDF4

def enthalpy_snow(Tsfcn, vsnon):
#debug:
print("in enthalpy_snow ",Tsfcn.max(), Tsfcn.min(), vsnon.max(), vsnon.min())
rho_snow = 330.0
cp = 2160.0
L = 3.34e5
#enthalpy = -rho_snow*(cp*Tsfcn + L)*vsnon
enthalpy = Tsfcn
rho_snow = 330.0
cp = 2160.0
L = 3.34e5
enthalpy = -rho_snow*(cp*Tsfcn + L)*vsnon
print("a1 ",enthalpy.max(), enthalpy.min() )
#enthalpy *= cp
#enthalpy += L
enthalpy = (Tsfcn*cp + L)
print("a2 ",enthalpy.max(), enthalpy.min() )
enthalpy *= -rho_snow
enthalpy *= vsnon
#debug: print(enthalpy)
print("a4 ",enthalpy.max(), enthalpy.min() )
return enthalpy

stresses = ["uvel", "vvel", "strocnxT", "strocnyT", "stressp_1", "stressp_2", "stressp_3", "stressp_4", "stressm_1", "stressm_2", "stressm_3", "stressm_4", "stress12_1", "stress12_2", "stress12_3", "stress12_4"]
#dynamics:
dynam = [ "uvel", "vvel", "stressp_1", "stressp_2", "stressp_3", "stressp_4", "stressm_1", "stressm_2", "stressm_3", "stressm_4", "stress12_1", "stress12_2", "stress12_3", "stress12_4" ]

parms3 = [ "aicen", "vicen", "vsnon", "Tsfcn", "iage", "FY", "alvl", "vlvl", "apnd", "hpnd", "ipnd", "dhs", "ffrac", "fbrn", "first_ice", "sice001", "qice001", "sice002", "qice002", "sice003", "qice003", "sice004", "qice004", "sice005", "qice005", "sice006", "qice006", "sice007", "qice007", "qsno001" ]




# For reading: -------------------------------------------
model_in = netCDF4.Dataset(sys.argv[1], 'r')
model_in = netCDF4.Dataset(sys.argv[1], 'r', format="NETCDF4")
model_out = netCDF4.Dataset(sys.argv[2], "w", format="NETCDF4")

#After https://stackoverflow.com/questions/13936563/copy-netcdf-file-using-python
# Create the dimensions of the file
for name, dim in model_in.dimensions.items():
#debug: print("debug -- dimensions: ",name, dim, flush=True)
model_out.createDimension(name, len(dim) if not dim.isunlimited() else None)

# Copy the global attributes
Expand All @@ -28,59 +50,85 @@ def enthalpy_snow(Tsfcn, vsnon):
# Create the variables in the file
for name, var in model_in.variables.items():
model_out.createVariable(name, var.dtype, var.dimensions)
#debug: print(name, var.dtype, var.dimensions, flush=True)

# Copy the variable attributes
model_out.variables[name].setncatts({a:var.getncattr(a) for a in var.ncattrs()})

# Copy the variables values (as 'f4' eventually)
model_out.variables[name][:] = model_in.variables[name][:]

#name = aicen, vicen, vvel, uvel, ...
print(name, var.dimensions, flush=True)

#if (name == "aicen"):
# print(name, model_out.variables[name][:].max(), model_out.variables[name][:].min() )
#debug: if (name in parms3):
#debug: print(name, model_out.variables[name][:].max(), model_out.variables[name][:].min() )
#debug: for i in range (0,5):
#debug: print(i, name, model_out.variables[name][i].max(), model_out.variables[name][i].min() )

# Step with some editing. Stresses are actually unused (confirmed by expt)
if name in stresses:
model_out.variables[name][:] = 0.0

if (name == "vsnon"):
print(var.dimensions, dim)
vsnon = numpy.zeros((5,116,100))
model_out.variables[name][:] = 0.0

# To trim out excessively thin or low concentration ice,
# save ai and hi aside, then reprocess prior to write out
if (name == 'aicen' ):
tmp_aice = model_out.variables['aicen'][:]
if (name == 'vicen' ):
tmp_vice = model_out.variables['vicen'][:]


if (name == "qsno001"):
v = model_in.variables["vsnon"][:]
t = model_in.variables["Tsfcn"][:]
#v = model_in.variables["vsnon"][:]
v = vsnon
x = enthalpy_snow(t, v)
#print(x)
model_out.variables["qsno001"][:] = x

# Touch up hi and aice -- remove very low concentrations and/or thicknesses:
aice = tmp_aice[0]
hi = tmp_vice[0]
for k in range (1, 5):
aice += tmp_aice[k] # ncat, nj, ni
hi += tmp_vice[k]

print("ai, hi: ",aice.max(), aice.min(), hi.max(), hi.min() )

mask1 = ma.masked_array(aice > 0.)
mask2 = ma.masked_array(hi > 0.)
mask1 = ma.logical_and(mask1, aice < 0.01)
mask2 = ma.logical_and(mask2, hi < 0.01)
mask2 = ma.logical_or(mask2, mask1)
indices = mask2.nonzero()
for k in range(0, len(indices[0])):
i = indices[1][k]
j = indices[0][k]
tmp_aice[:,j,i] = 0.0
tmp_vice[:,j,i] = 0.0
model_out.variables['qice001'][:,j,i] = 0.0
model_out.variables['qice002'][:,j,i] = 0.0
model_out.variables['qice003'][:,j,i] = 0.0
model_out.variables['qice004'][:,j,i] = 0.0
model_out.variables['qice005'][:,j,i] = 0.0
model_out.variables['qice006'][:,j,i] = 0.0
model_out.variables['qice007'][:,j,i] = 0.0


model_out.variables['aicen'] = tmp_aice
model_out.variables['vicen'] = tmp_vice
#model_out.variables['qice001'] = qice001
#model_out.variables['qice002'] = qice002
#model_out.variables['qice003'] = qice003
#model_out.variables['qice004'] = qice004
#model_out.variables['qice005'] = qice005
#model_out.variables['qice006'] = qice006
#model_out.variables['qice007'] = qice007



# Save the file
model_out.close()

#aicen ('ncat', 'nj', 'ni')
#vicen ('ncat', 'nj', 'ni')
#Tsfcn ('ncat', 'nj', 'ni')
#iceumask ('nj', 'ni')
#vsnon ('ncat', 'nj', 'ni')
#qsno001 ('ncat', 'nj', 'ni')
#frz_onset ('nj', 'ni')
#Tin ('nilyr', 'ncat', 'nj', 'ni')
# Enthalpies:
#qice001 ('ncat', 'nj', 'ni')
#qice002 ('ncat', 'nj', 'ni')
#qice003 ('ncat', 'nj', 'ni')
#qice004 ('ncat', 'nj', 'ni')
#qice005 ('ncat', 'nj', 'ni')
#qice006 ('ncat', 'nj', 'ni')
#qice007 ('ncat', 'nj', 'ni')
# Salinities:
#sice001 ('ncat', 'nj', 'ni')
#sice002 ('ncat', 'nj', 'ni')
#sice003 ('ncat', 'nj', 'ni')
#sice004 ('ncat', 'nj', 'ni')
#sice005 ('ncat', 'nj', 'ni')
#sice006 ('ncat', 'nj', 'ni')
#sice007 ('ncat', 'nj', 'ni')
# Radiation:
#scale_factor ('nj', 'ni')
#coszen ('nj', 'ni')
#swvdr ('nj', 'ni')
#swvdf ('nj', 'ni')
#swidr ('nj', 'ni')
#swidf ('nj', 'ni')
17 changes: 17 additions & 0 deletions cluster/cdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys
import numpy as np

fin = open(sys.argv[1],"r")
counts = []
pcts = []
tot=0
for line in fin:
words = line.split()
counts.append(tot + int(words[6]))
pcts.append(float(words[4]))
tot += int(words[6])

for i in range(0,len(counts)):
print(i,pcts[i], counts[i]/tot)

#175 leaf 0.863 0.001 0.863 0.001 5565 0.0011524199057811305 0.863
Loading
Loading