- Timestamp:
- May 24, 2016, 11:04:16 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r769 r771 6 6 # Importing generic tools file 'generic_tools.py' 7 7 import generic_tools as gen 8 9 ####### Contents: 10 # add_dims: Function to add dimensions from a given netCDF object to another one 11 # add_globattrs: Function to add global attributes from a given netCDF object to another one 12 # addvals: Function to add values to a given variable at a given dimension 13 # add_vars: Function to add variables from a given netCDF object to another one 14 # attrinvar: Check existence of an attribute in a netCDF variable object 15 # basicvardef: Function to give the basic attributes to a variable (std_name, long_name, units) 16 # changevartype: Function to change the type of a variable (when possible) 17 # chdimname: Changing the name of the dimension 18 # checkAllValues: Function to check for variables with along all their dimensions with the same value in a file 19 # checkallvars: Function to check all variables of a file 20 # checkNaNs: Function to check for NaN values over all variables in a file 21 # check_times_file: Function to check time-steps of a given file 22 # chgtimestep: Function to change the values of a given time-step of a variable inside a netCDF for values from a nother file 23 # chvarname: Changing the name of the variable 24 # cls_time_information: Classs to provide information about variable time 25 # compute_deaccum: Function to compute deaccum: deaccumulation of a variable (VAR[t+1]-VAR[t]) 26 # compute_opersvarsfiles: Function to compute opersvarfiles: operation of variables from different files (OPER1.FILE1_VAR1 OPER2.FILE2_VAR2), operations are going to be secuentially made 27 # compute_opervaralltime: Function to compute opervaralltime: operation of variable successible allover the time-steps 28 # compute_opervartimes: Function to compute opervartimes: operation of variable for a given sub-set of time-steps 29 # compute_tevolboxtraj: Function to compute tevolboxtraj: temporal evolution at a given point along a box following a trajectory 30 # compute_tevolboxtraj_radialsec: Function to compute tevolboxtraj_radialsec: temporal evolution at a given point along a number of radii at a given frequency following a trajectory 31 # DataSetSection: Function to get a section (values along a dimension) of a given data-set 32 # DataSetSection_multidims: Function to get a section (values along multiple dimensions) of a given data-set 33 # DataSetSection_multivars: Function to get a section (values along multiple variables) of a given data-set 34 # DatesFiles: Function to find different time values on a series of WRF files in a folder 35 # DimsLoop: Function to provide the shape of the dimensions which are not selected 36 # dimToUnlimited: Operation to create an unlimited dimension from an existing one 37 # dimVar_creation: Function to add a 1D variable with the size of a given dimension in a file 38 # fattradd: Adding attributes from a reference file 39 # fgaddattr: Adding global attributes from a reference file 40 # fdimadd: Adding dimension from another reference file 41 # field_stats: Function to retrieve statistics from a field 42 # file_creation: Operation to create a file with one variable with a given set of dimensions 43 # file_oper_alongdims: Function to operate a file along different dimensions of a variable 44 # fill_ncvariable_lastdims: Function to fill the last [Nlastdims] dimensions of a variable [varn] from a netCDF object at the other dimensions at [prevdims] 45 # filter_2dim: Function to filter along 2 dimensions (moving grid-box means of a given size) values of the netCDF file 46 # flipdim: flips the value following one dimension [Nflipdim] 47 # fvaradd: Adding variable (and all its attributes and dimensions) from a reference file to a file 48 # gaddattr: Add a global attribute to a netCDF. Removes previous attribute if it exist 49 # gaddattrk: Add a global attribute to a netCDF caring about the type. Removes previous attribute if it exist 50 # get_1str_nc: Function to get 1 string value in a netCDF variable as a chain of 1char values 51 # get_attribute: Function to get an attribute from a netCDF file 52 # get_namelist_vars: Function to get namelist-like values ([varname] = [value]) 53 # get_str_nc: Function to get string values in a netCDF variable as a chains of 1char values 54 # getvalues_lonlat: Function to retrieve the values from the closest grid point to a set of longitude, latitude values 55 # grattr: Function to read a global atribute 56 # grmattr: Removing a global attribute 57 # igattrs: Give all the global attributes of a file 58 # increaseDimvar: Function to increase with 1 dimension an existing variable within a netcdf file. Values of the variable will be repeated along the new dimension 59 # insert_variable: Function to insert a variable in an existing file 60 # isgattrs: Give a single global attribute of a file and its type 61 # isvattrs: Give a single attribute of a variable 62 # ivars: Give all the variable names of a file 63 # ivattrs: Give all the attributes of a variable and its type 64 # load_ncvariable_lastdims: Function to load the last [Nlastdims] dimensions of a variable [varn] from a netCDF object at the other dimensions at [prevdims] 65 # lonlatProj: Function to compute longitudes and latitudes for a given projection following subroutine calc_resolution_in from ORCHIDEE/src_global/module_InterpWeight 66 # maskvar: Function to mask a variable using a mask. It is assumed that mask[...,dimM,dimJ,dimK] and var[...,dimM,dimJ,dimK] share the last dimensions 67 # ncreplace: Function to replace something from a netCDF file 68 # ncstepdiff: Function to compute differencies between time-steps (deacumulate) a netCDF file 69 # nctype: Function to provide the string for the variable creation in a netCDF file 70 # netcdf_concatenation: Function to concatenate netCDF files for a given set of variable 71 # netcdf_fold_concatenation: Function to concatenate netCDF files in a given folder for a given set of variables 72 # operation_alongdims: Function to operate along different dimensions of a variable 73 # ovar_onc: Function to copy an object variable to a nother netcdf object 74 # Partialmap_Entiremap: Function to transform from a partial global map (e.g.: only land points) to an entire one Coincidence of points is done throughout a first guess from fractions of the total domain of search 75 # Partialmap_EntiremapFor: Function to transform from a partial global map (e.g.: only land points) to an entire one usinf Fortran code 76 # Partialmap_EntiremapForExact: Function to transform from a partial global map (e.g.: only land points) to an entire one using Fortran code with exact location 77 # put_variable_slice: Function to add a variable from a netcdf object to a new one following a slice 78 # remapnn: Function to remap to the nearest neightbor a variable using projection from another file 79 # remapnn_old: Function to remap to the nearest neightbor a variable using projection from another fil 80 # seasmean: Function to compute the seasonal mean of a variable 81 # sellonlatbox: Function to select a lotlan box from a data-set 82 # sellonlatboxold: Function to select a lotlan box from a data-set 83 # sellonlatlevbox: Function to select a lotlan box and a given level from a data-set 84 # selvar: Function to select a series of variables from a netcdf file. Variables with the values of the associated dimensions will be also retrieved 85 # set_attribute: Sets a value of an attribute of a netCDF variable. Removes previous attribute value if exists 86 # set_attributek: Sets a value of an attribute of a netCDF variable with a kind. Removes previous attribute value if exists 87 # setvar_asciivalues: Function to set de values of a variable with an ASCII file (common Fortran-like format) 88 # SliceVar: Function to slice a given variable throughout a given list of dimensions 89 # slice_variable: Function to return a slice of a given variable according to values to its dimensions 90 # sorttimesmat: Function to sort the time values of a given file 91 # spacemean: Function to retrieve a space mean series from a multidimensional variable of a file 92 # SpatialWeightedMean: Function to compute the spatial mean using weights from a netCDF file 93 # statcompare_files: Python script to statistically compare two different files 94 # submns: Function to retrieve a series of months from a file 95 # subyrs: Function to retrieve a series of years from a file 96 # testvarinfile: Check existence of a variable inside a netCDF file 97 # TimeInf: Function to print all the information from the variable time 98 # time_information: Function to provide information about variable time 99 # timemean: Function to retrieve a time mean series from a multidimensional variable of a file 100 # timeshiftvar: Function to temporaly shift a number of time-steps a given variable inside a netCDF file 101 # TimeSplitmat: Function to transform a file with CFtimes to a matrix [Nyear,Nmonth,Nday,Nhour,Nminute,Nsecond] 102 # uploading_timestep: Function to upload a given time-step of a variable inside a netCDF 103 # valmod: Function to modify the value of a variable 104 # valmod_dim: Function to modify the value of a variable at a given dimension and value 105 # var_3desc: Function to provide std_name, long_name and units from an object variable 106 # varaddattr: Add an attribute to a variable. Removes previous attribute if it exists 107 # varaddattrk: Add an attribute to a variable caring about the type 108 # varaddref: Function to add a variable in an existing file copying characteristics from an existing one 109 # var_creation: Operation to create a new variable in a file with a given set of dimensions 110 # variable_inf: Class to provide the information from a given variable 111 # varinfile: Check existence of a variable inside a netCDF file 112 # varrmattr: Removing an attribute from a variable 113 # VarVal_FillValue: Function to transform a given value from a given variable to _FillValue in a netCDF file 114 # var_dim_dimv: Function to bring back which variables with the values should be use for a given variable 115 # varDimension: Function to find the variable with the values of a dimension. It is assumed, that given variable 116 # varout: Function when we want to output variable values 117 # varoutold: Function when we want to output variable values 118 # varrm: Removing a variable from a file 119 # vrattr: Function to remove an atribute from a variable 120 # writing_1str_nc: Function to write 1 string value in a netCDF variable as a chain of 1char values 121 # writing_str_nc: Function to write string values in a netCDF variable as a chain of 1char values 122 # WRF_CFlonlat_creation: Function to add a CF-convention longitude/latitude variables in a WRF file 123 # WRF_CFtime_creation: Function to add a CF-convention time unit in a WRF file 124 # WRF_CFxtime_creation: Function to add a CF-convention time unit in a WRF file using variable 'XTIME' 125 # WRF_d0Nref: Function for the generation of an extra WRF domain from a given one 8 126 9 127 main = 'nc_var_tools.py'
Note: See TracChangeset
for help on using the changeset viewer.