This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding=utf-8 | |
# Nathive (and this file) is free software: you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or newer. | |
# | |
# You should have received a copy of the GNU General Public License along with | |
# this file. If not, see <http://www.gnu.org/licenses/>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function newmap = b2r(cmin_input,cmax_input) | |
%BLUEWHITERED Blue, white, and red color map. | |
% this matlab file is designed to draw anomaly figures, the color of | |
% the colorbar is from blue to white and then to red, corresponding to | |
% the anomaly values from negative to zero to positive, respectively. | |
% The color white always correspondes to value zero. | |
% | |
% You should input two values like caxis in matlab, that is the min and | |
% the max value of color values designed. e.g. colormap(b2r(-3,5)) | |
% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample PBS job script | |
# | |
# Copy this script, customize it and then submit it with the ``qsub'' | |
# command. For example: | |
# | |
# cp pbs-template.sh myjob-pbs.sh | |
# {emacs|vi} myjob-pbs.sh | |
# qsub myjob-pbs.sh | |
# | |
# PBS directives are fully documented in the ``qsub'' man page. Directives |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <dirent.h> /* Defines DT_* constants */ | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <sys/stat.h> | |
#include <sys/syscall.h> | |
#define handle_error(msg) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flux2dIsen = calIsenFlux(vcomp3d,PT3d,pfull,isenCoord,deltaP,minP,maxP,ps2d) | |
% calculate mass flux in isentropic coordinate | |
%----INPUT---- | |
% vcomp3d: meridonal velocity at one time, 3d matrix (lon,lat,press) | |
% PT3d: potential temperature, 3d matrix | |
% pfull: temperature coordinate, unit mb, 1d array, for PT3d and | |
% vcomp3d | |
% isenCoord:isentropic coordinate that converts to, increases with index, 1d array | |
% usually should have regular spacing, or unexpect problem can happen | |
% deltaP: usually 10 mb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* nakeinterp3.c, use specifically for calIsenFlux */ | |
/* interpolate a 3d array A(i,j,k) only in k direction */ | |
/* interface as PT3dInterp = nakeinterp3(numx,numy,z,PT3d,zi) */ | |
/* numx, numy are the first two dimensions */ | |
/* z is the coordinate, zi is the interoplated coordinate */ | |
/* PT3d is the function to be interoplated, only done so in z */ | |
/* z and zi should be column vector */ | |
#include "mex.h" | |
#include "matrix.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mex.h" | |
#include "matrix.h" | |
// Gateway routine | |
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[]) | |
{ | |
const mxArray *xi, *xgrid; | |
mxArray *idx; | |
size_t nx, m, k, i1, i9, imid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flux1d = calIsenFlux1d(vcomp1d,PT1d,pfull,isenCoordEdge,pInterp) | |
% unit is not converted into standard using G | |
vcomp1dInterp = interp1(pfull,vcomp1d, pInterp,'spline','extrap'); | |
PT1dInterp = interp1(pfull,PT1d, pInterp,'spline','extrap'); | |
[~, bin] = histc(PT1dInterp,isenCoordEdge); | |
flux1d = zeros(length(isenCoordEdge)-1,1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mex.h" | |
#include "matrix.h" | |
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) | |
{ | |
double *vcomp3dInterp, *bin3d; /* pointers to the input matrixces */ | |
double *flux2dIsen; /* pointer to output matrix */ | |
double *numIndex; /* num of index array is third input */ | |
mwSignedIndex lon,lat,p,numIsen; /* matrix dimensions */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% driver script for callsenFlux | |
temp = ncread('Symmetric_HS=60K.nc','temp'); | |
vcomp = ncread('Symmetric_HS=60K.nc','vcomp'); | |
pfull = ncread('Symmetric_HS=60K.nc','pfull'); | |
tStart = 1000; | |
tEnd = 1100; | |
isenCoord = 240:5:360; | |
deltaP = 10; |
NewerOlder